Class: Rdm::CLI::Init
- Inherits:
-
Object
- Object
- Rdm::CLI::Init
- Defined in:
- lib/rdm/cli/init.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(current_path, test, console, stdout) ⇒ Init
constructor
A new instance of Init.
- #run ⇒ Object
Constructor Details
#initialize(current_path, test, console, stdout) ⇒ Init
Returns a new instance of Init.
10 11 12 13 14 15 |
# File 'lib/rdm/cli/init.rb', line 10 def initialize(current_path, test, console, stdout) @current_path = current_path @test = test @console = console @stdout = stdout end |
Class Method Details
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rdm/cli/init.rb', line 17 def run generated_files_list = Rdm::Gen::Init.generate( current_path: @current_path, test: @test, console: @console, stdout: @stdout ) generated_files_list.compact.each { |file| @stdout.puts "Generated: #{file}" } rescue Errno::ENOENT => e @stdout.puts "Error occurred. Possible reasons:\n #{@current_path} not found. Please run on empty directory \n#{e.inspect}" rescue Rdm::Errors::ProjectAlreadyInitialized @stdout.puts 'Error. Project was already initialized' rescue Rdm::Errors::InvalidParams => e @stdout.puts e. rescue Rdm::Errors::InvalidProjectDir => e @stdout.puts "#{e.} doesn't exist. Initialize new rdm project with existing directory" end |