Class: Redbreast::Command::Setup
- Inherits:
-
Object
- Object
- Redbreast::Command::Setup
- Includes:
- Helper::General, Helper::HashHelper, Helper::Terminal
- Defined in:
- lib/redbreast/commands/setup.rb
Overview
Class for setting up the program
Constant Summary
Constants included from Helper::General
Helper::General::ESCAPE_KEYWORDS
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options = Commander::Command::Options.new) ⇒ Setup
constructor
A new instance of Setup.
Methods included from Helper::HashHelper
Methods included from Helper::General
#app_name, #bundles, #clean_case_name, #clean_enum_name, #clean_variable_name, #config, #escape_keyword_if_needed, #escape_with_underscore_if_needed, #indent, #programming_language, #upper_camel_case
Methods included from Helper::Terminal
Constructor Details
#initialize(options = Commander::Command::Options.new) ⇒ Setup
Returns a new instance of Setup.
16 17 18 |
# File 'lib/redbreast/commands/setup.rb', line 16 def initialize( = Commander::Command::Options.new) @options = end |
Class Method Details
.init(options = Commander::Command::Options.new) ⇒ Object
12 13 14 |
# File 'lib/redbreast/commands/setup.rb', line 12 def self.init( = Commander::Command::Options.new) new().call end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/redbreast/commands/setup.rb', line 20 def call app_name = app_name_prompt bundle_names = bundle_names_prompt().split(' ') bundles = bundle_names.map do |bundle| language = language_prompt(bundle) assets_types = assets_types_prompt(bundle) reference = bundle_reference(bundle, language) assets_search_path = assets_search_path_prompt(bundle) output_source_path_images = assets_types == 1 ? nil : images_sources_path_prompt(bundle, language) output_source_path_colors = assets_types.zero? ? nil : colors_sources_path_prompt(bundle, language) include_tests = create_tests_path_prompt?(bundle) output_test_path_images = assets_types != 1 && include_tests ? images_tests_path_prompt(bundle, language) : nil output_test_path_colors = assets_types != 0 && include_tests ? colors_tests_path_prompt(bundle, language) : nil fields = { language: language, name: bundle, reference: reference, assetsSearchPath: assets_search_path, outputSourcePathImages: output_source_path_images, outputSourcePathColors: output_source_path_colors, outputTestPathImages: output_test_path_images, outputTestPathColors: output_test_path_colors, testableImport: include_tests ? testable_import_prompt(bundle, app_name, language) : nil } compact fields end config = { bundles: bundles, app_name: app_name } Redbreast::IO::Config.write(config) success end |