Class: Flist::Cli

Inherits:
Object
  • Object
show all
Includes:
Ykutils::DebugUtils
Defined in:
lib/flist/cli.rb

Overview

コマンドライン処理クラス

Instance Method Summary collapse

Constructor Details

#initialize(verbose) ⇒ Cli

Returns a new instance of Cli.



8
9
10
11
# File 'lib/flist/cli.rb', line 8

def initialize(verbose)
  debug_utils_init
  set_debug(verbose)
end

Instance Method Details

#load_config_yaml_fileObject

setting.ymlのロード



42
43
44
45
46
47
# File 'lib/flist/cli.rb', line 42

def load_config_yaml_file
  # settingファイル
  config_yaml_file = ::Flist::CONFIG_YAML_FILE
  config = Ykxutils.yaml_load_compati(config_yaml_file) if config_yaml_file.exist?
  config
end

#setupObject

構成情報設定



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/flist/cli.rb', line 14

def setup
  setup_config

  env = ENV.fetch('ENV', nil)
  # env ||= "development"
  env ||= 'production'

  {
    'db_dir' => Arxutils_Sqlite3::Config::DB_DIR,
    'migrate_dir' => Arxutils_Sqlite3::Config::MIGRATE_DIR,
    'config_dir' => Arxutils_Sqlite3::Config::CONFIG_DIR,
    'dbconfig' => Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3,
    'env' => env,
    'log_fname' => Arxutils_Sqlite3::Config::DATABASELOG,
    'output_dir' => ::Flist::OUTPUT_DIR,
    'pstore_dir' => ::Flist::PSTORE_DIR
  }
end

#setup_configObject



33
34
35
36
37
38
39
# File 'lib/flist/cli.rb', line 33

def setup_config
  scope = {}
  value_hash = {}
  content = Ykutils::Erubyx.erubi_render_with_template_file(::Flist::ERB_CONFIG_YAML_FILE, scope, value_hash)
  File.write(::Flist::SAMPLE_CONFIG_YAML_FILE, content)
  Ykxutils.yaml_load_compati(content)
end