Class: Rdm::CLI::GenPackage
- Inherits:
-
Object
- Object
- Rdm::CLI::GenPackage
- Defined in:
- lib/rdm/cli/gen_package.rb
Instance Attribute Summary collapse
-
#current_dir ⇒ Object
Returns the value of attribute current_dir.
-
#package_name ⇒ Object
Returns the value of attribute package_name.
-
#package_relative_path ⇒ Object
Returns the value of attribute package_relative_path.
-
#skip_tests ⇒ Object
Returns the value of attribute skip_tests.
Class Method Summary collapse
Instance Method Summary collapse
- #check_preconditions! ⇒ Object
- #generate ⇒ Object
-
#initialize(package_name:, current_dir:, path:, skip_tests:) ⇒ GenPackage
constructor
A new instance of GenPackage.
- #run ⇒ Object
Constructor Details
#initialize(package_name:, current_dir:, path:, skip_tests:) ⇒ GenPackage
Returns a new instance of GenPackage.
11 12 13 14 15 16 |
# File 'lib/rdm/cli/gen_package.rb', line 11 def initialize(package_name:, current_dir:, path:, skip_tests:) @current_dir = current_dir @package_name = package_name @package_relative_path = path @skip_tests = skip_tests end |
Instance Attribute Details
#current_dir ⇒ Object
Returns the value of attribute current_dir.
10 11 12 |
# File 'lib/rdm/cli/gen_package.rb', line 10 def current_dir @current_dir end |
#package_name ⇒ Object
Returns the value of attribute package_name.
10 11 12 |
# File 'lib/rdm/cli/gen_package.rb', line 10 def package_name @package_name end |
#package_relative_path ⇒ Object
Returns the value of attribute package_relative_path.
10 11 12 |
# File 'lib/rdm/cli/gen_package.rb', line 10 def package_relative_path @package_relative_path end |
#skip_tests ⇒ Object
Returns the value of attribute skip_tests.
10 11 12 |
# File 'lib/rdm/cli/gen_package.rb', line 10 def skip_tests @skip_tests end |
Class Method Details
.run(opts = {}) ⇒ Object
5 6 7 |
# File 'lib/rdm/cli/gen_package.rb', line 5 def run(opts = {}) Rdm::CLI::GenPackage.new(opts).run end |
Instance Method Details
#check_preconditions! ⇒ Object
40 41 42 43 44 45 |
# File 'lib/rdm/cli/gen_package.rb', line 40 def check_preconditions! return unless package_name.empty? puts 'Package name was not specified!' exit 1 end |
#generate ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/rdm/cli/gen_package.rb', line 31 def generate Rdm::Gen::Package.generate( current_dir: current_dir, package_name: package_name, package_relative_path: package_relative_path, skip_tests: skip_tests ) end |
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rdm/cli/gen_package.rb', line 18 def run check_preconditions! begin generate rescue Errno::ENOENT => e puts "Error occurred. Possible reasons:\n #{Rdm::SOURCE_FILENAME} not found. Please run on directory containing #{Rdm::SOURCE_FILENAME} \n#{e.inspect}" rescue Rdm::Errors::PackageExists puts 'Error. Package already exist. Package was not generated' rescue Rdm::Errors::PackageDirExists puts "Error. Directory #{package_relative_path} exists. Package was not generated" end end |