Class: Md2site::Make

Inherits:
Object
  • Object
show all
Defined in:
lib/md2site/make.rb

Overview

makeサブコマンドクラス

Instance Method Summary collapse

Constructor Details

#initialize(env, mes, verbose, str_variable, str_static, obj_by_yaml) ⇒ Make

初期化

Parameters:

  • env (Env)

    Envクラスのインスタンス

  • mes (Messagex)

    Messagexクラスのインスタンス

  • verbose (Boolean)

    FileUtilsクラスのメソッドのverbose引数に与える値

  • str_variable (String)

    2段階の変数置換が必要なeRubyスクリプト(一度置換をし、さらにもう一度置換が必要なeRubyスクリプト)

  • str_static (String)

    1段階の変数置換のみが必要なeRubyスクリプト(一度置換をしたら、その後は置換が必要ないeRubyスクリプト)

  • obj_by_yaml (Hash)

    変数置換に用いるハッシュ



15
16
17
18
19
20
21
22
23
24
# File 'lib/md2site/make.rb', line 15

def initialize(env, mes, verbose, str_variable, str_static, obj_by_yaml)
  @env = env
  @mes = mes
  @verbose = verbose
  @str_variable = str_variable
  @str_static = str_static
  @obj_by_yaml = obj_by_yaml
  @template_dir = @env.conf_hs["TEMPLELATE_DIR"]
  @default_table_template = @env.conf_hs["DEFAULT_TABLE_TEMPLATE"] # 5col_no_attr_b.erb
end

Instance Method Details

#do_multiple_commands(target_command) ⇒ void

This method returns an undefined value.

指定ターゲットコマンドに属する全サブターゲットコマンドを順次実行する

Parameters:

  • target_command (String)

    ターゲットコマンド名



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/md2site/make.rb', line 45

def do_multiple_commands(target_command)
  subtarget_command_names = @env.get_subtarget_commands(target_command)
  if !subtarget_command_names.empty?
    subtarget_command_names.map do |subtarget_command|
      @mes.output_info("#{target_command} #{subtarget_command}")
      do_single_command(target_command, subtarget_command)
    end
  else
    @mes.output_fatal("Illeagel targetcommand(#{target_command}")
    exit(@mes.ec("EXIT_CODE_ILLEAGAL_TARGETCOMMAND"))
  end
end

#execute_subcommand(target_command, subtarget_command) ⇒ void

This method returns an undefined value.

引数optionでの指定に従いサブコマンドを実行

Parameters:

  • target_command (String)

    ターゲットコマンド名

  • subtarget_command (String)

    サブターゲットコマンド名



32
33
34
35
36
37
38
# File 'lib/md2site/make.rb', line 32

def execute_subcommand(target_command, subtarget_command)
  if subtarget_command == SUB_TARGET_COMMAND_OF_ALL
    do_multiple_commands(target_command)
  else
    do_single_command(target_command, subtarget_command)
  end
end