avm-tools 0.70.2 → 0.71.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc0ca6899907a27aa6b201493d4333c63fd975ad79c0f705171af4cbb7d12254
4
- data.tar.gz: f520c92fc4a738cb27a5b14cff784b4321a9bed091993571b1aa096484f1dc01
3
+ metadata.gz: 7f1459b957df5b13191a6411437651630d19ef6db3b12f62441d59238ede4679
4
+ data.tar.gz: 816d7f150ca0aa5e5cc573a77395b92c36fcba8fb41429f93dadc94f506233d8
5
5
  SHA512:
6
- metadata.gz: 7e5335434368d606d4d6bd23736fdec437ee2511748612fa2fa1b1f4c991038b50e740ede71149affa736c8314e662568bbeef92cb7c60ff25b1b8e993de57f5
7
- data.tar.gz: 2f675b8c6e57cb0f4eba761fdc227ec1f1f0a5dacea96ab5600733474a1c2d9258a5d8a8ae59c3566f3a2c492072bd8ff455dd36b076f97dd8e21e4763358814
6
+ metadata.gz: 422c93704e878d5894ac17e38f4df881d98a70ebd90696fa98fa9968b583710e2c2f7ff2f31cefb1df3fd9b01f2536d7ae6ee26ea35f6a98d5ae113415cec610
7
+ data.tar.gz: 3720efd94cdeb9dc295f53f7ac22e3460bf67f6e8c5ee1ef654ee4f3320de65138dfc70538d6bc2e2ae4f1b589c81960ca685af5685a4778f42158a59ce9118c
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_webapp_base0/instance'
4
- require 'avm/stereotypes/rails/instance'
4
+ require 'avm/rails/instance'
5
5
 
6
6
  module Avm
7
7
  module EacRailsBase0
8
8
  class Instance < ::Avm::EacWebappBase0::Instance
9
- include ::Avm::Stereotypes::Rails::Instance
9
+ include ::Avm::Rails::Instance
10
10
 
11
11
  FILES_UNITS = { uploads: 'public/uploads' }.freeze
12
12
  end
@@ -3,12 +3,12 @@
3
3
  require 'avm/eac_redmine_base0/data_unit'
4
4
  require 'avm/eac_ubuntu_base0/docker_image'
5
5
  require 'avm/eac_webapp_base0/instance'
6
- require 'avm/stereotypes/rails/instance'
6
+ require 'avm/rails/instance'
7
7
 
8
8
  module Avm
9
9
  module EacRedmineBase0
10
10
  class Instance < ::Avm::EacWebappBase0::Instance
11
- include ::Avm::Stereotypes::Rails::Instance
11
+ include ::Avm::Rails::Instance
12
12
 
13
13
  FILES_UNITS = { files: 'files' }.freeze
14
14
 
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Rails
5
+ module Instance
6
+ def bundle(*args)
7
+ the_gem.bundle(*args).chdir_root.envvar('RAILS_ENV', 'production')
8
+ end
9
+
10
+ def rake(*args)
11
+ bundle('exec', 'rake', *args)
12
+ end
13
+
14
+ def the_gem
15
+ @the_gem ||= ::EacRubyGemsUtils::Gem.new(::File.join(read_entry('fs_path')), host_env)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/entry_keys'
4
+ require 'eac_cli/core_ext'
5
+ require 'eac_ruby_utils/console/docopt_runner'
6
+ require 'shellwords'
7
+
8
+ module Avm
9
+ module Tools
10
+ class Runner < ::EacRubyUtils::Console::DocoptRunner
11
+ class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
12
+ class RailsServer
13
+ runner_with
14
+
15
+ runner_definition do
16
+ desc 'Run the embbeded Rails web server.'
17
+ arg_opt '-e', '--environment', 'Specifies the environment to run this server under' \
18
+ ' (development/test/production).'
19
+ end
20
+
21
+ def run
22
+ infov 'Bundle args', ::Shellwords.join(bundle_args)
23
+ infov 'Result', command.system
24
+ end
25
+
26
+ protected
27
+
28
+ def bundle_args
29
+ ['exec', 'rails', 'server', '--port',
30
+ runner_context.call(:instance).read_entry(::Avm::Instances::EntryKeys::WEB_PORT)] +
31
+ parsed.environment.if_present([]) { |v| ['--environment', v] }
32
+ end
33
+
34
+ def command
35
+ runner_context.call(:instance).bundle(*bundle_args).chdir_root
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.70.2'
5
+ VERSION = '0.71.0'
6
6
  end
7
7
  end
@@ -45,7 +45,7 @@ module EacCli
45
45
  module AfterClassMethods
46
46
  def create(*runner_context_args)
47
47
  r = new
48
- r.runner_context = ::EacCli::Runner::Context.new(*runner_context_args)
48
+ r.runner_context = ::EacCli::Runner::Context.new(r, *runner_context_args)
49
49
  r
50
50
  end
51
51
 
@@ -5,13 +5,30 @@ require 'eac_ruby_utils/core_ext'
5
5
  module EacCli
6
6
  module Runner
7
7
  class Context
8
- attr_reader :argv, :parent, :program_name
8
+ attr_reader :argv, :parent, :program_name, :runner
9
9
 
10
- def initialize(*context_args)
10
+ def initialize(runner, *context_args)
11
11
  options = context_args.extract_options!
12
12
  @argv = (context_args[0] || options.delete(:argv) || ARGV).dup.freeze
13
13
  @parent = context_args[1] || options.delete(:parent)
14
14
  @program_name = options.delete(:program_name)
15
+ @runner = runner
16
+ end
17
+
18
+ # Call a method in the runner or in one of it ancestors.
19
+ def call(method_name, *args)
20
+ return runner.send(method_name, *args) if runner.respond_to?(method_name)
21
+ return parent_call(method_name, *args) if parent.present?
22
+
23
+ raise ::NameError, "No method \"#{method_name}\" found in #{runner} or in its ancestors"
24
+ end
25
+
26
+ protected
27
+
28
+ def parent_call(method_name, *args)
29
+ return parent.context(method_name, *args) if parent.respond_to?(:context)
30
+
31
+ parent.runner_context.call(method_name, *args)
15
32
  end
16
33
  end
17
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.0'
5
5
  end
@@ -11,8 +11,9 @@ module EacRubyGemsUtils
11
11
 
12
12
  GEMSPEC_EXTNAME = '.gemspec'
13
13
 
14
- common_constructor :root do
14
+ common_constructor :root, :host_env, default: [nil] do
15
15
  @root = ::Pathname.new(root).expand_path
16
+ self.host_env ||= ::EacRubyUtils::Envs.local
16
17
  end
17
18
 
18
19
  def to_s
@@ -11,7 +11,7 @@ module EacRubyGemsUtils
11
11
 
12
12
  def initialize(gem, command_args, extra_options = {})
13
13
  @gem = gem
14
- super(command_args, extra_options)
14
+ super(command_args, extra_options.merge(host_env: gem.host_env))
15
15
  end
16
16
 
17
17
  # Changes current directory to the gem's directory.
@@ -12,14 +12,12 @@ module EacRubyGemsUtils
12
12
  log('running "bundle install"...')
13
13
  return if bundle('install').execute.fetch(:exit_code).zero?
14
14
 
15
- if can_remove_gemfile_lock?
16
- log('"bundle install" failed, removing Gemfile.lock and trying again...')
17
- gemfile_lock_path.unlink if gemfile_lock_path.exist?
18
- bundle('install').execute!
19
- else
15
+ unless can_remove_gemfile_lock?
20
16
  raise '"bundle install" failed and the Gemfile.lock is part of gem' \
21
- '(Should be changed by developer)'
17
+ '(Should be changed by developer)'
22
18
  end
19
+
20
+ prepare_with_removable_gemfile_lock
23
21
  end
24
22
 
25
23
  def tests
@@ -33,6 +31,12 @@ module EacRubyGemsUtils
33
31
  infov self, message
34
32
  end
35
33
 
34
+ def prepare_with_removable_gemfile_lock
35
+ log('"bundle install" failed, removing Gemfile.lock and trying again...')
36
+ gemfile_lock_path.unlink if gemfile_lock_path.exist?
37
+ bundle('install').execute!
38
+ end
39
+
36
40
  def can_remove_gemfile_lock?
37
41
  !files.include?(gemfile_lock_path.relative_path_from(root))
38
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemsUtils
4
- VERSION = '0.7.2'
4
+ VERSION = '0.8.0'
5
5
  end
@@ -8,7 +8,8 @@ module EacRubyUtils
8
8
  # A [EacRubyUtils::Envs::Command] which runs in a clean Ruby environment.
9
9
  class Command < ::EacRubyUtils::Envs::Command
10
10
  def initialize(bundle_args, extra_options = {})
11
- super(::EacRubyUtils::Envs.local, bundle_args, extra_options)
11
+ host_env = extra_options.delete(:host_env)
12
+ super(host_env || ::EacRubyUtils::Envs.local, bundle_args, extra_options)
12
13
  end
13
14
 
14
15
  %w[system execute].each do |method_prefix|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.46.0'
4
+ VERSION = '0.47.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.70.2
4
+ version: 0.71.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-13 00:00:00.000000000 Z
11
+ date: 2020-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -425,6 +425,7 @@ files:
425
425
  - lib/avm/projects/stereotypes/ruby_gem/update.rb
426
426
  - lib/avm/projects/stereotypes/ruby_gem/version_bump.rb
427
427
  - lib/avm/rails.rb
428
+ - lib/avm/rails/instance.rb
428
429
  - lib/avm/rails/runners.rb
429
430
  - lib/avm/rails/runners/bundle.rb
430
431
  - lib/avm/rails/runners/runner.rb
@@ -454,7 +455,6 @@ files:
454
455
  - lib/avm/stereotypes/postgresql/instance/data_unit.rb
455
456
  - lib/avm/stereotypes/postgresql/instance_with.rb
456
457
  - lib/avm/stereotypes/rails.rb
457
- - lib/avm/stereotypes/rails/instance.rb
458
458
  - lib/avm/sync.rb
459
459
  - lib/avm/tools.rb
460
460
  - lib/avm/tools/runner.rb
@@ -464,6 +464,7 @@ files:
464
464
  - lib/avm/tools/runner/eac_rails_base0/bundle.rb
465
465
  - lib/avm/tools/runner/eac_rails_base0/data.rb
466
466
  - lib/avm/tools/runner/eac_rails_base0/deploy.rb
467
+ - lib/avm/tools/runner/eac_rails_base0/rails_server.rb
467
468
  - lib/avm/tools/runner/eac_rails_base0/runner.rb
468
469
  - lib/avm/tools/runner/eac_redmine_base0.rb
469
470
  - lib/avm/tools/runner/eac_redmine_base0/bundle.rb
@@ -836,10 +837,10 @@ files:
836
837
  - vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb
837
838
  - vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb
838
839
  - vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb
840
+ - vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb
839
841
  - vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
840
842
  - vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
841
843
  - vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb
842
- - vendor/eac_ruby_gems_utils/spec/rubocop_check_spec.rb
843
844
  - vendor/eac_ruby_gems_utils/spec/spec_helper.rb
844
845
  - vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile
845
846
  - vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile.lock
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Stereotypes
5
- module Rails
6
- module Instance
7
- def bundle(*args)
8
- host_env.command('bundle', *args)
9
- .envvar('BUNDLE_GEMFILE', ::File.join(read_entry('fs_path'), 'Gemfile'))
10
- .envvar('RAILS_ENV', 'production')
11
- .chdir(read_entry('fs_path'))
12
- end
13
-
14
- def rake(*args)
15
- bundle('exec', 'rake', *args)
16
- end
17
- end
18
- end
19
- end
20
- end