class Md2site::Testx

全サブコマンド実行クラス

Public Class Methods

new(option, mes, verbose, src_data_dir, opt_struct) click to toggle source

初期化

@param option [Hash] オプション @param mes [Messagex] Messagexクラスのインスタンス @param verbose [Boolean] FileUtilsクラスのメソッドのverbose引数に与える値 @param src_data_dir [String] テストデータコピー元 @param opt_struct [Struct] オプションストラクト

# File lib/md2site/testx.rb, line 13
def initialize(option, mes, verbose, src_data_dir, opt_struct)
  @option = option
  @mes = mes
  @verbose = verbose
  @src_data_dir = src_data_dir
  @opt_struct = opt_struct
end

Public Instance Methods

execute_subcommand_init(option_url) click to toggle source

initサブコマンド実行

@param option_url [Struct] オプションURL @return [void]

# File lib/md2site/testx.rb, line 26
def execute_subcommand_init(option_url)
  case option_url.value
  when /northern\-cross\.info/
    init_a(option_url, %q(/testdata/site.tsv), "testdata/*")
  when /www\.toppers\.jp/
    init_a(option_url, %q(/testdata/site.tsv), "testdata0/*")
  when /example\.com/
    init_b(@option, option_url)
  else
    init_b(@option, option_url)
  end
end
execute_subcommand_remain(env, content_path, str_variable, str_static, obj_by_yaml) click to toggle source

initサブコマンド以外のサブコマンド実行

@return [void]

# File lib/md2site/testx.rb, line 80
def execute_subcommand_remain(env, content_path, str_variable, str_static, obj_by_yaml)
  setup = Setup.new(env, @mes)
  optionx = @opt_struct.new("zcontents", content_path)
  setup.execute_subcommand(optionx)
  optionx = @opt_struct.new("getfiles", content_path)
  setup.execute_subcommand(optionx)
  optionx = @opt_struct.new("contentUpdate")
  setup.execute_subcommand(optionx)

  info = Info.new(env)
  optionx = @opt_struct.new("zlist")
  info.execute_subcommand(optionx)
  optionx = @opt_struct.new("zindex")
  info.execute_subcommand(optionx)

  make = Make.new(env, @mes, @verbose, str_variable, str_static, obj_by_yaml)

  env.commands.map {|x| make.do_multiple_commands(x[0]) }
end
init_a(option_url, tsv_filepath, test_data_dir_path) click to toggle source

initサブコマンドAパターン実行

@return [void]

# File lib/md2site/testx.rb, line 43
def init_a(option_url, tsv_filepath, test_data_dir_path)
  root_path = @option.value
  optionx = @opt_struct.new("init", root_path)
  init = Init.new(@src_data_dir, @mes, @verbose)
  init.execute_subcommand(optionx, option_url)

  conf_dir = File.join(root_path, init.hs["conf_dir"])
  conf_path = File.join(conf_dir, init.conf_file)
  dir = File.dirname(root_path)
  base = File.basename(root_path)
  content_path = File.join(dir, %Q(#{base}-contents))
  @mes.exc_make_directory(content_path) { FileUtils.mkdir_p(content_path) }
  src_path = File.join(@src_data_dir, tsv_filepath)
  dest_path = conf_dir
  @mes.exc_file_copy(src_path, dest_path) { FileUtils.copy(src_path, dest_path) }
  Dir[File.join(@src_data_dir, test_data_dir_path)].each do |x|
    next if File.directory?(x)
    @mes.exc_file_copy(x, conf_dir) { FileUtils.cp(x, conf_dir) }
  end

  [conf_path, content_path]
end
init_b(option, option_url) click to toggle source

initサブコマンドBパターン実行

@return [void]

# File lib/md2site/testx.rb, line 70
def init_b(option, option_url)
  @mes.output_warn(%Q(option=#{option.value}))
  @mes.output_warn(%Q(optionUrl=#{option_url.value}))
  exit(@mes.ec("EXIT_CODE_NORMAL_EXIT"))
end