rdm 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/Gemfile.lock +80 -0
  4. data/bin/rdm +78 -10
  5. data/example/.rdm/helpers/render_helper.rb +12 -0
  6. data/example/.rdm/templates/package/.gitignore +1 -0
  7. data/example/.rdm/templates/package/.rspec +2 -0
  8. data/example/.rdm/templates/package/<%=package_subdir_name%>/<%=package_name%>.rb +3 -0
  9. data/example/.rdm/templates/package/<%=package_subdir_name%>/<%=package_name%>/.gitkeep +0 -0
  10. data/{lib/rdm/templates/package/package.rb.erb → example/.rdm/templates/package/Package.rb} +0 -0
  11. data/{lib/rdm/templates/package/bin/console_irb → example/.rdm/templates/package/bin/console} +0 -0
  12. data/example/.rdm/templates/package/spec/spec_helper.rb +10 -0
  13. data/example/.rdm/templates/repository/dao/<%=name%>_dao.rb +4 -0
  14. data/example/.rdm/templates/repository/mapper/<%=name%>_mapper.rb +2 -0
  15. data/example/.rdm/templates/repository/repository/<%=name%>_repository.rb +2 -0
  16. data/example/.rdm/templates/repository/views/users.html.erb +2 -0
  17. data/example/Gemfile.lock +50 -0
  18. data/example/Rdm.packages +1 -0
  19. data/example/tests/diff_run +0 -0
  20. data/example/tests/run +0 -0
  21. data/lib/rdm.rb +40 -8
  22. data/lib/rdm/cli/compile_package.rb +56 -0
  23. data/lib/rdm/cli/dependencies_controller.rb +30 -0
  24. data/lib/rdm/cli/diff_package.rb +21 -0
  25. data/lib/rdm/cli/gen_package.rb +24 -32
  26. data/lib/rdm/cli/init.rb +20 -27
  27. data/lib/rdm/cli/template_generator.rb +38 -0
  28. data/lib/rdm/errors.rb +37 -0
  29. data/lib/rdm/gen/init.rb +29 -44
  30. data/lib/rdm/gen/package.rb +24 -78
  31. data/lib/rdm/git/diff_command.rb +13 -0
  32. data/lib/rdm/git/diff_manager.rb +30 -0
  33. data/lib/rdm/git/repository_locator.rb +23 -0
  34. data/lib/rdm/handlers/dependencies_handler.rb +110 -0
  35. data/lib/rdm/handlers/diff_package_handler.rb +48 -0
  36. data/lib/rdm/handlers/template_handler.rb +118 -0
  37. data/lib/rdm/helpers/path_helper.rb +15 -0
  38. data/lib/rdm/package.rb +6 -0
  39. data/lib/rdm/package_importer.rb +1 -1
  40. data/lib/rdm/packages/compiler_service.rb +78 -0
  41. data/lib/rdm/packages/locator.rb +28 -0
  42. data/lib/rdm/settings.rb +14 -1
  43. data/lib/rdm/spec_runner.rb +5 -0
  44. data/lib/rdm/spec_runner/command_generator.rb +28 -0
  45. data/lib/rdm/spec_runner/command_params.rb +3 -0
  46. data/lib/rdm/spec_runner/package_fetcher.rb +13 -0
  47. data/lib/rdm/spec_runner/runner.rb +122 -0
  48. data/lib/rdm/spec_runner/view.rb +20 -0
  49. data/lib/rdm/templates/init/.rdm/helpers/render_helper.rb +12 -0
  50. data/lib/rdm/templates/init/{Gemfile.erb → Gemfile} +0 -0
  51. data/lib/rdm/templates/init/{Rdm.packages.erb → Rdm.packages} +0 -0
  52. data/lib/rdm/templates/init/{Readme.md.erb → Readme.md} +0 -0
  53. data/lib/rdm/templates/init/tests/diff_run +29 -0
  54. data/lib/rdm/templates/init/tests/run +7 -210
  55. data/lib/rdm/templates/package/<%=package_subdir_name%>/<%=package_name%>.rb +3 -0
  56. data/lib/rdm/templates/package/<%=package_subdir_name%>/<%=package_name%>/.gitkeep +0 -0
  57. data/lib/rdm/templates/package/Package.rb +8 -0
  58. data/lib/rdm/templates/package/bin/console +16 -0
  59. data/lib/rdm/templates/template_detector.rb +32 -0
  60. data/lib/rdm/templates/template_renderer.rb +49 -0
  61. data/lib/rdm/utils/file_utils.rb +20 -0
  62. data/lib/rdm/utils/render_util.rb +24 -0
  63. data/lib/rdm/utils/string_utils.rb +16 -0
  64. data/lib/rdm/version.rb +1 -1
  65. data/rdm.gemspec +1 -1
  66. data/spec/helpers/example_project_helper.rb +217 -0
  67. data/spec/helpers/git_commands_helper.rb +13 -0
  68. data/spec/rdm/cli/compile_package_spec.rb +114 -0
  69. data/spec/rdm/cli/dependencies_controller_spec.rb +50 -0
  70. data/spec/rdm/cli/diff_package_spec.rb +5 -0
  71. data/spec/rdm/cli/gen_package_spec.rb +60 -86
  72. data/spec/rdm/cli/init_spec.rb +53 -70
  73. data/spec/rdm/gen/init_spec.rb +21 -38
  74. data/spec/rdm/gen/package_spec.rb +70 -51
  75. data/spec/rdm/git/diff_manager_spec.rb +81 -0
  76. data/spec/rdm/git/repository_locator_spec.rb +31 -0
  77. data/spec/rdm/handlers/dependencies_handler_spec.rb +84 -0
  78. data/spec/rdm/handlers/diff_package_handler_spec.rb +78 -0
  79. data/spec/rdm/handlers/template_handler_spec.rb +94 -0
  80. data/spec/rdm/helpers/path_helper_spec.rb +52 -0
  81. data/spec/rdm/package/compiler_service_spec.rb +124 -0
  82. data/spec/rdm/package/locator_spec.rb +31 -0
  83. data/spec/rdm/rdm_spec.rb +2 -2
  84. data/spec/rdm/spec_runner/runner_spec.rb +12 -0
  85. data/spec/rdm/templates/template_detector_spec.rb +39 -0
  86. data/spec/rdm/templates/template_renderer_spec.rb +42 -0
  87. data/spec/spec_helper.rb +31 -25
  88. metadata +84 -17
  89. data/lib/rdm/gen/concerns/template_handling.rb +0 -81
  90. data/lib/rdm/support/colorize.rb +0 -106
  91. data/lib/rdm/support/render.rb +0 -17
  92. data/lib/rdm/support/template.rb +0 -30
  93. data/lib/rdm/templates/package/main_module_file.rb.erb +0 -3
  94. data/spec/rdm/support/colorize_spec.rb +0 -24
  95. data/spec/rdm/support/template_spec.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0f78d232d36dc1f22ead77c386634b1136da103
4
- data.tar.gz: 768e4ce4671b3f658183eb3b6e9c9e578d7cd8a8
3
+ metadata.gz: 3be7fa147c5deb0f944dc1919c638b944f52f604
4
+ data.tar.gz: 77704c0186a53483449b4ef3a901049eac2ecc48
5
5
  SHA512:
6
- metadata.gz: f78f8e981907ad2857ef1cfc20d0c311c0f8b2584958d3b0c5c9d836ae19d5d50e47d11b8f707f4cc88f5822d359f16433cec4c0bd8d6fd5eb3820cb03836340
7
- data.tar.gz: 6c78593c2e6aa59257638dcdf4cc3a63ec581c70b82e62e90f6aef4d170dbf7f16ed8e3d4b4beedefdb563e1e5ac835ed6fe66f6e811f5ba52d0b75050b54653
6
+ metadata.gz: efcbc5233713e6b73b2d465188591a8ea7e1788c69b04c756a7fcdd98852146da7e215bf2ea004d45879456a2ad49db01c824b16c4ee899f334e48394fae303b
7
+ data.tar.gz: a252eece0678566eede4498e3878d5939256f05040383041bef8cbd74067175a59bad0759d75e63f5def62a927a697039390eb6bbccc54febec9bd2450625600
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  .DS_Store
2
- Gemfile.lock
3
2
  Package.rb.lock
4
3
  pkg
5
4
  coverage/
@@ -0,0 +1,80 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rdm (0.3.0)
5
+ activesupport
6
+ commander (~> 4.4)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (5.1.2)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (~> 0.7)
14
+ minitest (~> 5.1)
15
+ tzinfo (~> 1.1)
16
+ ast (2.3.0)
17
+ byebug (9.0.6)
18
+ codecov (0.1.10)
19
+ json
20
+ simplecov
21
+ url
22
+ commander (4.4.3)
23
+ highline (~> 1.7.2)
24
+ concurrent-ruby (1.0.5)
25
+ diff-lcs (1.3)
26
+ docile (1.1.5)
27
+ highline (1.7.8)
28
+ i18n (0.8.4)
29
+ json (2.0.3)
30
+ minitest (5.10.2)
31
+ parser (2.3.3.1)
32
+ ast (~> 2.2)
33
+ powerpack (0.1.1)
34
+ rainbow (2.2.1)
35
+ rake (12.0.0)
36
+ rspec (3.5.0)
37
+ rspec-core (~> 3.5.0)
38
+ rspec-expectations (~> 3.5.0)
39
+ rspec-mocks (~> 3.5.0)
40
+ rspec-core (3.5.4)
41
+ rspec-support (~> 3.5.0)
42
+ rspec-expectations (3.5.0)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.5.0)
45
+ rspec-mocks (3.5.0)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.5.0)
48
+ rspec-support (3.5.0)
49
+ rubocop (0.46.0)
50
+ parser (>= 2.3.1.1, < 3.0)
51
+ powerpack (~> 0.1)
52
+ rainbow (>= 1.99.1, < 3.0)
53
+ ruby-progressbar (~> 1.7)
54
+ unicode-display_width (~> 1.0, >= 1.0.1)
55
+ ruby-progressbar (1.8.1)
56
+ simplecov (0.14.1)
57
+ docile (~> 1.1.0)
58
+ json (>= 1.8, < 3)
59
+ simplecov-html (~> 0.10.0)
60
+ simplecov-html (0.10.0)
61
+ thread_safe (0.3.6)
62
+ tzinfo (1.2.3)
63
+ thread_safe (~> 0.1)
64
+ unicode-display_width (1.1.2)
65
+ url (0.3.2)
66
+
67
+ PLATFORMS
68
+ ruby
69
+
70
+ DEPENDENCIES
71
+ bundler (~> 1.3)
72
+ byebug
73
+ codecov
74
+ rake
75
+ rdm!
76
+ rspec
77
+ rubocop (~> 0.46)
78
+
79
+ BUNDLED WITH
80
+ 1.15.1
data/bin/rdm CHANGED
@@ -26,12 +26,12 @@ class RdmCliRunner
26
26
  c.example 'generate scaffold with pry', 'rdm init --console=pry'
27
27
  c.option '--test FRAMEWORK', TESTFRAMEWORKS, "select test framework: #{TESTFRAMEWORKS.join(", ")}"
28
28
  c.option '--console CONSOLE', CONSOLES, "select console: #{CONSOLES.join(", ")}"
29
- c.option '--current_dir [ROOT_DIR]', String, 'Path for the root folder'
29
+ c.option '--current_path [ROOT_DIR]', String, 'Path for the root folder'
30
30
  c.action do |args, options|
31
31
  defaults = {
32
- test: "rspec",
33
- console: "irb",
34
- current_dir: `pwd`.strip
32
+ test: "rspec",
33
+ console: "irb",
34
+ current_path: `pwd`.strip
35
35
  }
36
36
  options_with_defaults = defaults.merge!(options.__hash__)
37
37
  Rdm::CLI::Init.run(options_with_defaults)
@@ -47,16 +47,14 @@ class RdmCliRunner
47
47
  c.example 'generate pack/age package',
48
48
  'rdm gen.package pack/age --path subsystems/package'
49
49
  c.example 'generate events package within /some/other/path folder',
50
- 'rdm gen.package events --path core/domain/events --current_dir /some/other/path'
51
- c.example 'generate auth package without tests', 'rdm gen.package auth --path subsystems/auth --skip-tests'
50
+ 'rdm gen.package events --path core/domain/events --current_path /some/other/path'
51
+ c.example 'generate auth package without tests', 'rdm gen.package auth --path subsystems/auth'
52
52
  c.option '--path [RELATIVE_PATH]', String, 'Path for the package'
53
- c.option '--current_dir [ROOT_DIR]', String, 'Path for the root folder'
54
- c.option '--skip-test', '--skip-tests', 'Don\'t generate test files'
53
+ c.option '--current_path [ROOT_DIR]', String, 'Path for the root folder'
55
54
  c.action do |args, options|
56
55
  package_name = (args.first || "")
57
56
  defaults = {
58
- skip_tests: false,
59
- current_dir: `pwd`.chomp,
57
+ current_path: `pwd`.chomp,
60
58
  package_name: package_name,
61
59
  path: package_name.downcase.gsub(/\s+/, '_')
62
60
  }
@@ -64,6 +62,76 @@ class RdmCliRunner
64
62
  Rdm::CLI::GenPackage.run(options_with_defaults)
65
63
  end
66
64
  end
65
+
66
+ command :"git.diff" do |c|
67
+ c.syntax = 'rdm git.diff REVISION'
68
+ c.description = 'show list of modified packages from git revision'
69
+ c.summary = '> ' + c.description
70
+ c.example 'show list of modified packages from master',
71
+ 'rdm git.diff master'
72
+ c.action do |args, options|
73
+ revision = (args.first || "HEAD")
74
+ options = {
75
+ path: `pwd`.chomp,
76
+ revision: revision,
77
+ }
78
+ Rdm::CLI::DiffPackage.run(options)
79
+ end
80
+ end
81
+
82
+ command :"compile.package" do |c|
83
+ c.syntax = 'rdm compile.package PACKAGE_NAME [options]'
84
+ c.description = 'copy specified package and its dependencies to some folder'
85
+ c.summary = '> ' + c.description
86
+ c.example 'compilation of "commands" package to /tmp/commands dir',
87
+ 'rdm compile.package commands --path /tmp/commands'
88
+ c.option '--path [COMPILE_PATH]', String, 'Path for compiled package'
89
+ c.action do |args, options|
90
+ package_name = (args.first || "")
91
+ opts = {
92
+ project_path: `pwd`.chomp,
93
+ package_name: package_name,
94
+ compile_path: options.path
95
+ }
96
+ Rdm::CLI::CompilePackage.compile(opts)
97
+ end
98
+ end
99
+
100
+ command :"gen.template" do |c|
101
+ c.syntax = 'rdm gen.template TEMPLATE_NAME [options]'
102
+ c.description = 'generates template from ROOT/.rdm/templates folder with specified variables'
103
+ c.summary = '> ' + c.description
104
+ c.example 'creating new repository, mapper and dao files',
105
+ 'rdm gen.template repository --path infrastructure/storage'
106
+ c.option '--path [DESTINATION_PATH]', String, 'Location of generated folders'
107
+ c.option '--OPTION_NAME [OPTION_VALUE]', String, 'Local variables for template handler'
108
+ c.action do |args, options|
109
+ options_hash = options.__hash__
110
+
111
+ Rdm::CLI::TemplateGenerator.run(
112
+ template_name: (args.first || ""),
113
+ current_path: `pwd`.chomp,
114
+ local_path: options_hash.delete(:path),
115
+ locals: options_hash
116
+ )
117
+ end
118
+ end
119
+
120
+ command :"gen.deps" do |c|
121
+ c.syntax = 'rdm gen.deps PACKAGE_NAME'
122
+ c.description = 'puts list of recursive dependencies for specified package'
123
+ c.summary = '> ' + c.description
124
+ c.example 'show dependencies for `commands` package', 'rdm gen.deps commands'
125
+
126
+ c.action do |args, options|
127
+ package_name = args.first || ""
128
+
129
+ Rdm::CLI::DependenciesController.run(
130
+ package_name: package_name,
131
+ project_path: `pwd`.chomp
132
+ )
133
+ end
134
+ end
67
135
 
68
136
  run!
69
137
  end
@@ -0,0 +1,12 @@
1
+ module Rdm
2
+ module RenderHelper
3
+ def camelize(string, uppercase_first_letter = true)
4
+ if uppercase_first_letter
5
+ string = string.sub(/^[a-z\d]*/) { $&.capitalize }
6
+ else
7
+ string = string.sub(/^(?:(?=\b|[A-Z_])|\w)/) { $&.downcase }
8
+ end
9
+ string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,3 @@
1
+ module <%= camelize(package_name) %>
2
+
3
+ end
@@ -0,0 +1,10 @@
1
+ ENV['RUBY_ENV'] = 'test'
2
+
3
+ require 'rdm'
4
+ Rdm.init(File.expand_path('../../', __FILE__), :test)
5
+
6
+ require 'rspec'
7
+ require 'byebug'
8
+
9
+ RSpec.configure do |config|
10
+ end
@@ -0,0 +1,4 @@
1
+ require '<%=name%>_repository'
2
+
3
+ class <%= camelize(name) %>
4
+ end
@@ -0,0 +1,2 @@
1
+ class <%= camelize(name) %>
2
+ end
@@ -0,0 +1,2 @@
1
+ class <%= camelize(name) %>
2
+ end
@@ -0,0 +1,2 @@
1
+ class <%=name%>
2
+ end
@@ -0,0 +1,50 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ rdm (0.2.0)
5
+ activesupport
6
+ commander (~> 4.4)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (5.1.2)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (~> 0.7)
14
+ minitest (~> 5.1)
15
+ tzinfo (~> 1.1)
16
+ commander (4.4.3)
17
+ highline (~> 1.7.2)
18
+ concurrent-ruby (1.0.5)
19
+ diff-lcs (1.3)
20
+ highline (1.7.8)
21
+ i18n (0.8.4)
22
+ minitest (5.10.2)
23
+ rspec (3.6.0)
24
+ rspec-core (~> 3.6.0)
25
+ rspec-expectations (~> 3.6.0)
26
+ rspec-mocks (~> 3.6.0)
27
+ rspec-core (3.6.0)
28
+ rspec-support (~> 3.6.0)
29
+ rspec-expectations (3.6.0)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.6.0)
32
+ rspec-mocks (3.6.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.6.0)
35
+ rspec-support (3.6.0)
36
+ sequel (4.48.0)
37
+ thread_safe (0.3.6)
38
+ tzinfo (1.2.3)
39
+ thread_safe (~> 0.1)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ rdm!
46
+ rspec
47
+ sequel
48
+
49
+ BUNDLED WITH
50
+ 1.15.1
@@ -4,6 +4,7 @@ setup do
4
4
  config_path ":configs_dir/:config_name/default.yml"
5
5
  role_config_path ":configs_dir/:config_name/:role.yml"
6
6
  package_subdir_name "package"
7
+ compile_path "/tmp/rdm_compiled"
7
8
  end
8
9
 
9
10
  config :database
File without changes
File without changes
data/lib/rdm.rb CHANGED
@@ -3,17 +3,18 @@ module Rdm
3
3
  PACKAGE_FILENAME = 'Package.rb'.freeze
4
4
 
5
5
  # Utils
6
- require 'rdm/support/colorize'
7
- require 'rdm/support/render'
8
- require 'rdm/support/template'
6
+ require 'rdm/utils/render_util'
7
+ require 'rdm/utils/string_utils'
8
+ require 'rdm/utils/file_utils'
9
9
  require 'rdm/version'
10
10
 
11
11
  # CLI part
12
12
  require 'rdm/cli/gen_package'
13
+ require 'rdm/cli/compile_package'
13
14
  require 'rdm/cli/init'
14
- require 'rdm/gen/concerns/template_handling'
15
- require 'rdm/gen/package'
16
- require 'rdm/gen/init'
15
+ require 'rdm/cli/diff_package'
16
+ require 'rdm/cli/template_generator'
17
+ require 'rdm/cli/dependencies_controller'
17
18
 
18
19
  # Runtime part
19
20
  require 'rdm/config'
@@ -27,10 +28,41 @@ module Rdm
27
28
  require 'rdm/source'
28
29
  require 'rdm/source_parser'
29
30
  require 'rdm/source_locator'
31
+ require 'rdm/git/diff_manager'
32
+ require 'rdm/git/diff_command'
33
+ require 'rdm/git/repository_locator'
34
+
35
+ # Package part
36
+ require 'rdm/packages/compiler_service'
37
+ require 'rdm/packages/locator'
38
+
39
+ # Handlers part
40
+ require 'rdm/gen/package'
41
+ require 'rdm/gen/init'
42
+ require 'rdm/handlers/diff_package_handler'
43
+ require 'rdm/handlers/template_handler'
44
+ require 'rdm/handlers/dependencies_handler'
45
+
46
+ require 'rdm/helpers/path_helper'
47
+
48
+ require 'rdm/templates/template_renderer'
49
+ require 'rdm/templates/template_detector'
50
+
51
+ # Spec runner
52
+ require 'rdm/spec_runner'
53
+ require 'rdm/spec_runner/command_generator'
54
+ require 'rdm/spec_runner/command_params'
55
+ require 'rdm/spec_runner/package_fetcher'
56
+ require 'rdm/spec_runner/runner'
57
+ require 'rdm/spec_runner/view'
58
+
59
+ extend Rdm::Helpers::PathHelper
30
60
 
31
61
  class << self
32
62
  # Initialize current package using Package.rb
33
- def init(package_path, group = nil)
63
+ def init(package_path, group = nil, stdout: $stdout)
64
+ @stdout = stdout
65
+
34
66
  Rdm::PackageImporter.import_file(package_path, group: group)
35
67
  end
36
68
 
@@ -51,7 +83,7 @@ module Rdm
51
83
 
52
84
  def root=(value)
53
85
  if @root && @root != value
54
- puts "Rdm has already been initialized and Rdm.root was set to #{@root}"
86
+ @stdout.puts "Rdm has already been initialized and Rdm.root was set to #{@root}"
55
87
  end
56
88
  @root = value
57
89
  end
@@ -0,0 +1,56 @@
1
+ module Rdm
2
+ module CLI
3
+ class CompilePackage
4
+ YES = 'y'
5
+
6
+ class << self
7
+ def compile(opts = {})
8
+ Rdm::CLI::CompilePackage.new(opts).compile
9
+ end
10
+ end
11
+
12
+ def initialize(package_name:, project_path:, compile_path: nil, overwrite_directory: nil)
13
+ @package_name = package_name
14
+ @project_path = project_path
15
+ @compile_path = compile_path
16
+ @overwrite_directory = overwrite_directory
17
+ end
18
+
19
+ def compile
20
+ Rdm::SourceParser.read_and_init_source(Rdm::SourceLocator.locate(@project_path))
21
+
22
+ @overwrite_directory ||= ->() { STDIN.gets.chomp.downcase == YES }
23
+ @compile_path ||= Rdm.settings.compile_path
24
+
25
+ if @package_name.blank?
26
+ puts 'Package name was not specified. Ex: rdm compile.package PACKAGE_NAME'
27
+ return
28
+ end
29
+
30
+ if @compile_path.blank?
31
+ puts 'Destination path was not specified. Ex: rdm compile.package package_name --path FOLDER_PATH'
32
+ return
33
+ end
34
+
35
+ if Dir.exists?(@compile_path)
36
+ puts "Destination directory exists. Overwrite it? (y/n)"
37
+ return unless @overwrite_directory.call
38
+ end
39
+
40
+ compiled_packages = Rdm::Packages::CompilerService.compile(
41
+ package_name: @package_name,
42
+ project_path: @project_path,
43
+ compile_path: @compile_path
44
+ )
45
+
46
+ puts <<~EOF
47
+ The following packages were copied:
48
+ #{compiled_packages.map(&:capitalize).join("\n")}
49
+ EOF
50
+
51
+ rescue Rdm::Errors::SourceFileDoesNotExist => e
52
+ puts "Rdm.packages was not found. Run 'rdm init' to create it"
53
+ end
54
+ end
55
+ end
56
+ end