eac_launcher 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/lib/eac_launcher/context.rb +3 -1
  4. data/lib/eac_launcher/context/instance_discovery.rb +5 -3
  5. data/lib/eac_launcher/context/instance_manager.rb +10 -5
  6. data/lib/eac_launcher/context/settings.rb +3 -0
  7. data/lib/eac_launcher/git.rb +2 -0
  8. data/lib/eac_launcher/git/base.rb +7 -2
  9. data/lib/eac_launcher/git/base/subrepo.rb +8 -2
  10. data/lib/eac_launcher/git/base/underlying.rb +2 -0
  11. data/lib/eac_launcher/git/error.rb +2 -0
  12. data/lib/eac_launcher/git/mirror_update.rb +2 -0
  13. data/lib/eac_launcher/git/publish_base.rb +3 -0
  14. data/lib/eac_launcher/git/sub_warp_base.rb +4 -0
  15. data/lib/eac_launcher/git/warp_base.rb +3 -1
  16. data/lib/eac_launcher/instances.rb +2 -0
  17. data/lib/eac_launcher/instances/base.rb +7 -0
  18. data/lib/eac_launcher/instances/base/cache.rb +3 -0
  19. data/lib/eac_launcher/instances/error.rb +2 -0
  20. data/lib/eac_launcher/instances/runner_helper.rb +3 -0
  21. data/lib/eac_launcher/instances/settings.rb +2 -0
  22. data/lib/eac_launcher/paths.rb +2 -0
  23. data/lib/eac_launcher/paths/logical.rb +6 -3
  24. data/lib/eac_launcher/paths/real.rb +5 -0
  25. data/lib/eac_launcher/project.rb +2 -0
  26. data/lib/eac_launcher/publish.rb +2 -0
  27. data/lib/eac_launcher/publish/base.rb +7 -4
  28. data/lib/eac_launcher/publish/check_result.rb +5 -2
  29. data/lib/eac_launcher/ruby.rb +2 -0
  30. data/lib/eac_launcher/ruby/gem.rb +2 -0
  31. data/lib/eac_launcher/ruby/gem/build.rb +7 -1
  32. data/lib/eac_launcher/ruby/gem/specification.rb +4 -0
  33. data/lib/eac_launcher/runner.rb +3 -1
  34. data/lib/eac_launcher/runner/instances.rb +8 -6
  35. data/lib/eac_launcher/runner/projects.rb +9 -6
  36. data/lib/eac_launcher/runner/publish.rb +4 -1
  37. data/lib/eac_launcher/stereotype.rb +2 -0
  38. data/lib/eac_launcher/stereotypes.rb +2 -0
  39. data/lib/eac_launcher/stereotypes/git.rb +2 -0
  40. data/lib/eac_launcher/stereotypes/git/publish.rb +3 -1
  41. data/lib/eac_launcher/stereotypes/git/warp.rb +2 -0
  42. data/lib/eac_launcher/stereotypes/git_subrepo.rb +2 -0
  43. data/lib/eac_launcher/stereotypes/git_subrepo/publish.rb +2 -0
  44. data/lib/eac_launcher/stereotypes/git_subrepo/warp.rb +4 -0
  45. data/lib/eac_launcher/stereotypes/git_subtree.rb +12 -3
  46. data/lib/eac_launcher/stereotypes/git_subtree/publish.rb +2 -0
  47. data/lib/eac_launcher/stereotypes/git_subtree/warp.rb +2 -0
  48. data/lib/eac_launcher/stereotypes/rails.rb +2 -0
  49. data/lib/eac_launcher/stereotypes/redmine_plugin.rb +2 -0
  50. data/lib/eac_launcher/stereotypes/ruby_gem.rb +2 -0
  51. data/lib/eac_launcher/stereotypes/ruby_gem/publish.rb +3 -0
  52. data/lib/eac_launcher/vendor.rb +2 -0
  53. data/lib/eac_launcher/vendor/github.rb +3 -0
  54. data/lib/eac_launcher/version.rb +1 -1
  55. metadata +9 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd361cfa7ad448a1aeee023d843863bf0419744a0b17de9406399da242d0a6ee
4
- data.tar.gz: d93808ebacfada34ac429c36bdb446908e7c67359f9dd2e52cbe93f763d242b5
3
+ metadata.gz: f453a237fe5a382f052500e8178c85135a8583557818ea13452d775f3579bddd
4
+ data.tar.gz: c51e91c7a7529219470a359a706f9655b5a5c2b5305ccbbb2a2a7b390032380c
5
5
  SHA512:
6
- metadata.gz: 18d69da69e448fff130c5cb94d74943c706f7999af039443979091217822ed5444b6dd9998f1b59804d1ae6a8df71cd0ecfc548bb70ead6d7a0197a357fcd2c4
7
- data.tar.gz: c3a5e35ca0ed7739fb2defe422d86511ce6e5ba95ab21a67341bf170ed745cc7ec101c7e33c1630f59b64b6dda728c610e75da7f5a0b5d51535bd6e00ae4ab1b
6
+ metadata.gz: 9fbd53bb2c9c6b8b58fe1fe2de939a4f971df5c6afa0833fe5d75228008879cf8d02a279c02ff8df544988d8a6399fa7254504ea9631514af2f9177f24dff2a0
7
+ data.tar.gz: fd25983e2b02d4a216be0bba799e6b5a0d67f6557ca46034353e97b469474fbcdac419f6eddd10fcd0ce9e7e6341374069897ab1388678e182305b1145071c7a
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Declare your gem's dependencies in users_support.gemspec.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/hash/indifferent_access'
2
4
  require 'eac_ruby_utils/simple_cache'
3
5
  require 'eac_ruby_utils/console/speaker'
@@ -12,7 +14,7 @@ module EacLauncher
12
14
  include ::EacRubyUtils::SimpleCache
13
15
  include ::EacRubyUtils::Console::Speaker
14
16
 
15
- DEFAULT_PROJECTS_ROOT = '.'.freeze
17
+ DEFAULT_PROJECTS_ROOT = '.'
16
18
  DEFAULT_SETTINGS_FILE = ::File.join(ENV['HOME'], '.config', 'eac_launcher', 'settings.yml')
17
19
  DEFAULT_CACHE_ROOT = ::File.join(ENV['HOME'], '.cache', 'eac_launcher')
18
20
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ruby-progressbar'
2
4
  require 'eac_launcher/instances/base'
3
5
 
@@ -11,7 +13,7 @@ module EacLauncher
11
13
  @progress = ::ProgressBar.create(title: 'Instance discovery', total: 1)
12
14
  @instances = path_instances(@context.root, nil)
13
15
  ensure
14
- @progress.finish if @progress
16
+ @progress&.finish
15
17
  end
16
18
 
17
19
  private
@@ -33,8 +35,8 @@ module EacLauncher
33
35
  r = []
34
36
  begin
35
37
  yield(r) if path.included?
36
- rescue StandardError => ex
37
- warn("#{path}: #{ex}")
38
+ rescue StandardError => e
39
+ warn("#{path}: #{e}")
38
40
  end
39
41
  r
40
42
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require('yaml')
2
4
 
3
5
  module EacLauncher
@@ -24,7 +26,7 @@ module EacLauncher
24
26
  private
25
27
 
26
28
  def instances_uncached
27
- (cached_instances ? cached_instances : search_instances).select(&:included?)
29
+ (cached_instances || search_instances).select(&:included?)
28
30
  end
29
31
 
30
32
  def search_instances
@@ -34,6 +36,7 @@ module EacLauncher
34
36
  def cached_instances
35
37
  return nil if @context.recache
36
38
  return nil unless cached_instances_file_content
39
+
37
40
  CachedInstances.new(cached_instances_file_content).instances
38
41
  end
39
42
 
@@ -61,6 +64,7 @@ module EacLauncher
61
64
  data = cached_instances_file_content
62
65
  return false unless data[instance.logical]
63
66
  return false unless data[instance.logical][:publish_state].is_a?(Hash)
67
+
64
68
  data[instance.logical][:publish_state].any? do |_k, v|
65
69
  ::EacLauncher::Publish::CheckResult.pending_status?(v)
66
70
  end
@@ -76,12 +80,13 @@ module EacLauncher
76
80
  @content.keys.map { |k| by_logical_path(k) }
77
81
  end
78
82
 
79
- def by_logical_path(k)
80
- return @instances[k] if @instances.key?(k)
81
- h = @content[k]
83
+ def by_logical_path(key)
84
+ return @instances[key] if @instances.key?(key)
85
+
86
+ h = @content[key]
82
87
  parent_instance = h[:parent] ? by_logical_path(h[:parent]) : nil
83
88
  path = ::EacLauncher::Paths::Logical.from_h(@context, h)
84
- @instances[k] = ::EacLauncher::Instances::Base.instanciate(path, parent_instance)
89
+ @instances[key] = ::EacLauncher::Instances::Base.instanciate(path, parent_instance)
85
90
  end
86
91
  end
87
92
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_ruby_utils/simple_cache'
2
4
  require 'yaml'
3
5
  require 'eac_launcher/instances/settings'
@@ -37,6 +39,7 @@ module EacLauncher
37
39
  def node_value(data, path)
38
40
  return data if path.empty?
39
41
  return nil unless data.is_a?(Hash)
42
+
40
43
  node_value(data[path.first], path.drop(1))
41
44
  end
42
45
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/git/base'
2
4
  require 'eac_launcher/git/error'
3
5
  require 'eac_launcher/git/mirror_update'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_ruby_utils/simple_cache'
2
4
  require 'eac_ruby_utils/envs'
3
5
  require 'eac_launcher/paths/real'
@@ -22,6 +24,7 @@ module EacLauncher
22
24
  r.strip! if r.is_a?(String)
23
25
  return r if r.present?
24
26
  return nil unless required
27
+
25
28
  raise "Reference \"#{ref}\" not found"
26
29
  end
27
30
 
@@ -41,6 +44,7 @@ module EacLauncher
41
44
  def descendant?(descendant, ancestor)
42
45
  base = merge_base(descendant, ancestor)
43
46
  return false if base.blank?
47
+
44
48
  revparse = execute!('rev-parse', '--verify', ancestor).strip
45
49
  base == revparse
46
50
  end
@@ -50,6 +54,7 @@ module EacLauncher
50
54
  while refs.count > 1
51
55
  refs[1] = merge_base_pair(refs[0], refs[1])
52
56
  return nil if refs[1].blank?
57
+
53
58
  refs.shift
54
59
  end
55
60
  refs.first
@@ -105,8 +110,8 @@ module EacLauncher
105
110
 
106
111
  private
107
112
 
108
- def merge_base_pair(c1, c2)
109
- execute!('merge-base', c1, c2, exit_outputs: { 256 => '' }).strip
113
+ def merge_base_pair(commit1, commit2)
114
+ execute!('merge-base', commit1, commit2, exit_outputs: { 256 => '' }).strip
110
115
  end
111
116
  end
112
117
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/object'
2
4
 
3
5
  module EacLauncher
@@ -7,8 +9,10 @@ module EacLauncher
7
9
  def subrepo_status(subrepo_path)
8
10
  s = execute!('subrepo', 'status', subrepo_path.gsub(%r{\A/}, ''))
9
11
  raise s.strip.to_s if s.include?('is not a subrepo')
12
+
10
13
  r = subrepo_status_parse_output(s)
11
14
  raise "Empty subrepo status for |#{s}|\n" unless r.any?
15
+
12
16
  r
13
17
  end
14
18
 
@@ -16,16 +20,18 @@ module EacLauncher
16
20
  h = subrepo_status(subrepo_path)
17
21
  url = h['Remote URL']
18
22
  return url if url.present?
23
+
19
24
  raise "Remote URL is blank for subrepo \"#{subrepo_path}\" (Subrepo status: #{h})"
20
25
  end
21
26
 
22
27
  private
23
28
 
24
- def subrepo_status_parse_output(s)
29
+ def subrepo_status_parse_output(output)
25
30
  r = {}.with_indifferent_access
26
- s.each_line do |l|
31
+ output.each_line do |l|
27
32
  m = /\A([^\:]+)\:(.*)\z/.match(l.strip)
28
33
  next unless m && m[2].present?
34
+
29
35
  r[m[1].strip] = m[2].strip
30
36
  end
31
37
  r
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_ruby_utils/envs'
2
4
  require 'git'
3
5
  require 'eac_launcher/paths/real'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  module Git
3
5
  class Error < StandardError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/git/base'
2
4
 
3
5
  module EacLauncher
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_ruby_utils/simple_cache'
2
4
  require 'eac_ruby_utils/simple_cache'
3
5
  require 'eac_launcher/publish/base'
@@ -51,6 +53,7 @@ module EacLauncher
51
53
 
52
54
  def local_following?
53
55
  return true if remote_sha.blank?
56
+
54
57
  sgit.descendant?(local_sha, remote_sha)
55
58
  end
56
59
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/instances/error'
2
4
 
3
5
  module EacLauncher
@@ -8,11 +10,13 @@ module EacLauncher
8
10
  def parent_instance_uncached
9
11
  r = find_parent_instance(instance.parent)
10
12
  return r if r
13
+
11
14
  ::EacLauncher::Instances::Error.new('Git parent not found')
12
15
  end
13
16
 
14
17
  def find_parent_instance(current)
15
18
  return current if current.stereotype?(::EacLauncher::Stereotypes::Git)
19
+
16
20
  current.parent ? find_parent_instance(current.parent) : nil
17
21
  end
18
22
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/git/mirror_update'
2
4
  require 'eac_launcher/vendor/github'
3
5
 
@@ -10,7 +12,7 @@ module EacLauncher
10
12
  class WarpBase < ::EacLauncher::Paths::Real
11
13
  include ::EacRubyUtils::SimpleCache
12
14
 
13
- TARGET_REMOTE = 'target'.freeze
15
+ TARGET_REMOTE = 'target'
14
16
 
15
17
  def initialize(instance)
16
18
  @instance = instance
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/instances/base'
2
4
  require 'eac_launcher/instances/error'
3
5
  require 'eac_launcher/instances/runner_helper'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base/cache'
2
4
 
3
5
  module EacLauncher
@@ -14,6 +16,7 @@ module EacLauncher
14
16
  def instanciate(path, parent)
15
17
  unless path.is_a?(::EacLauncher::Instances::Base)
16
18
  raise "#{path} is not a project" unless path.project?
19
+
17
20
  path.extend(::EacLauncher::Instances::Base)
18
21
  path.parent = parent
19
22
  end
@@ -33,6 +36,7 @@ module EacLauncher
33
36
 
34
37
  def to_parent_path
35
38
  return self unless @parent
39
+
36
40
  logical.gsub(/\A#{Regexp.quote(@parent.logical)}/, '')
37
41
  end
38
42
 
@@ -43,6 +47,7 @@ module EacLauncher
43
47
  def publish_run
44
48
  stereotypes.each do |s|
45
49
  next unless publish?(s)
50
+
46
51
  infov(name, "publishing #{s.stereotype_name_in_color}")
47
52
  s.publish_class.new(self).run
48
53
  end
@@ -51,6 +56,7 @@ module EacLauncher
51
56
  def publish_check
52
57
  stereotypes.each do |s|
53
58
  next unless publish?(s)
59
+
54
60
  puts "#{name.to_s.cyan}|#{s.stereotype_name_in_color}|" \
55
61
  "#{s.publish_class.new(self).check}"
56
62
  end
@@ -72,6 +78,7 @@ module EacLauncher
72
78
 
73
79
  def publish?(stereotype)
74
80
  return false unless stereotype.publish_class
81
+
75
82
  filter = ::EacLauncher::Context.current.publish_options[:stereotype]
76
83
  filter.blank? ? true : filter == stereotype.name.demodulize
77
84
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  module Instances
3
5
  module Base
@@ -9,6 +11,7 @@ module EacLauncher
9
11
  def cache_key(key, &block)
10
12
  v = cache_key_get(key)
11
13
  return v if v.present? || block.nil?
14
+
12
15
  v = yield
13
16
  cache_key_write(key, v)
14
17
  v
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  module Instances
3
5
  class Error < StandardError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_ruby_utils/console/docopt_runner'
2
4
  require 'eac_ruby_utils/console/speaker'
3
5
 
@@ -17,6 +19,7 @@ module EacLauncher
17
19
  def find_instance!(instance_path)
18
20
  instance = find_instance(instance_path)
19
21
  return instance if instance
22
+
20
23
  raise "Instance not found in \"#{instance_path}\""
21
24
  end
22
25
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  module Instances
3
5
  class Settings
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/paths/logical'
2
4
  require 'eac_launcher/paths/real'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/paths/real'
2
4
  require 'eac_launcher/stereotypes'
3
5
 
@@ -7,9 +9,9 @@ module EacLauncher
7
9
  include ::EacRubyUtils::SimpleCache
8
10
 
9
11
  class << self
10
- def from_h(context, h)
11
- parent_path = h[:parent_path] ? from_h(context, h[:parent_path]) : nil
12
- new(context, parent_path, h[:real], h[:logical])
12
+ def from_h(context, hash)
13
+ parent_path = hash[:parent_path] ? from_h(context, hash[:parent_path]) : nil
14
+ new(context, parent_path, hash[:real], hash[:logical])
13
15
  end
14
16
  end
15
17
 
@@ -40,6 +42,7 @@ module EacLauncher
40
42
  c_path = ::File.join(warped, c)
41
43
  next unless ::File.directory?(c_path)
42
44
  next if c.start_with?('.')
45
+
43
46
  r << build_child(c)
44
47
  end
45
48
  r
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  module Paths
3
5
  class Real < String
4
6
  def initialize(path)
5
7
  raise "Argument path is not a string: \"#{path}\"|#{path.class}" unless path.is_a?(String)
8
+
6
9
  super(path)
7
10
  end
8
11
 
@@ -16,12 +19,14 @@ module EacLauncher
16
19
 
17
20
  def dirname
18
21
  return nil if self == '/'
22
+
19
23
  self.class.new(::File.dirname(self))
20
24
  end
21
25
 
22
26
  def find_file_with_extension(extension)
23
27
  r = find_files_with_extension(extension)
24
28
  return r.first if r.any?
29
+
25
30
  raise "Extension \"#{extension}\" not found in directory \"#{self}\""
26
31
  end
27
32
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  class Project
3
5
  attr_reader :name, :instances
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/publish/base'
2
4
  require 'eac_launcher/publish/check_result'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/instances/error'
2
4
 
3
5
  module EacLauncher
@@ -13,6 +15,7 @@ module EacLauncher
13
15
  s = check
14
16
  info("Check: #{s}")
15
17
  return unless s.status == ::EacLauncher::Publish::CheckResult::STATUS_PENDING
18
+
16
19
  publish
17
20
  end
18
21
 
@@ -32,10 +35,10 @@ module EacLauncher
32
35
 
33
36
  def check_with_rescue
34
37
  internal_check
35
- rescue ::EacLauncher::Instances::Error => ex
36
- ::EacLauncher::Publish::CheckResult.blocked("Error: #{ex}")
37
- rescue ::EacLauncher::Git::Error => ex
38
- ::EacLauncher::Publish::CheckResult.blocked("Git error: #{ex}")
38
+ rescue ::EacLauncher::Instances::Error => e
39
+ ::EacLauncher::Publish::CheckResult.blocked("Error: #{e}")
40
+ rescue ::EacLauncher::Git::Error => e
41
+ ::EacLauncher::Publish::CheckResult.blocked("Git error: #{e}")
39
42
  end
40
43
  end
41
44
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern' # Missing on "eac/listable"
2
4
  require 'active_support/hash_with_indifferent_access'
3
- require 'eac/listable'
5
+ require 'eac_ruby_utils/listable'
4
6
 
5
7
  module EacLauncher
6
8
  module Publish
7
9
  class CheckResult
8
- include ::Eac::Listable
10
+ include ::EacRubyUtils::Listable
9
11
 
10
12
  lists.add_string :status, :updated, :pending, :blocked, :outdated
11
13
 
@@ -44,6 +46,7 @@ module EacLauncher
44
46
  def initialize(status, message)
45
47
  raise "Status \"#{status}\" not in #{self.class.lists.status.values}" unless
46
48
  self.class.lists.status.values.include?(status)
49
+
47
50
  @status = status
48
51
  @message = message
49
52
  end
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/ruby/gem'
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/ruby/gem/build'
2
4
  require 'eac_launcher/ruby/gem/specification'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tmpdir'
2
4
  require 'eac_ruby_utils/console/speaker'
3
5
  require 'eac_ruby_utils/envs'
@@ -15,6 +17,7 @@ module EacLauncher
15
17
 
16
18
  def output_file
17
19
  return nil unless @gem_root
20
+
18
21
  @gem_root.find_files_with_extension('.gem').first
19
22
  end
20
23
 
@@ -24,6 +27,7 @@ module EacLauncher
24
27
 
25
28
  def build
26
29
  return if builded?
30
+
27
31
  copy_gem_files
28
32
  build_gem
29
33
  check_gem_empty_size
@@ -85,12 +89,14 @@ module EacLauncher
85
89
  def check_gem_version
86
90
  spec = ::EacLauncher::Ruby::Gem::Specification.new(gemspec_file)
87
91
  return if ::File.basename(output_file, '.gem') == spec.full_name
92
+
88
93
  raise("Builded gem is not the same version of gemspec (#{spec}, #{output_file})")
89
94
  end
90
95
 
91
96
  def bundle_dependencies
92
97
  gemfile = @gem_root.subpath('Gemfile')
93
98
  return unless ::File.exist?(gemfile)
99
+
94
100
  Dir.chdir(@gem_root) do
95
101
  EacRubyUtils::Envs.local.command('bundle', 'install').execute!
96
102
  end
@@ -105,7 +111,7 @@ module EacLauncher
105
111
  old_values.keys.each { |k| ENV.delete(k) }
106
112
  yield
107
113
  ensure
108
- old_values.each { |k, v| ENV[k] = v } if old_values
114
+ old_values&.each { |k, v| ENV[k] = v }
109
115
  end
110
116
 
111
117
  def envvars_starting_with(start_with_vars)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/object'
2
4
 
3
5
  module EacLauncher
@@ -21,6 +23,7 @@ module EacLauncher
21
23
  def version
22
24
  v = self.class.parse_version_file(version_file)
23
25
  return v if v.present?
26
+
24
27
  raise "Version not found on file \"#{version_file}\""
25
28
  end
26
29
 
@@ -45,6 +48,7 @@ module EacLauncher
45
48
  def version_file
46
49
  f = ::File.join(gem_root, 'lib', *namespace_parts, 'version.rb')
47
50
  return f if ::File.exist?(f)
51
+
48
52
  raise "Version file \"#{f}\" does not exist"
49
53
  end
50
54
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_ruby_utils/console/docopt_runner'
2
4
  require 'eac_launcher/runner/instances'
3
5
  require 'eac_launcher/runner/projects'
@@ -5,7 +7,7 @@ require 'eac_launcher/runner/publish'
5
7
 
6
8
  module EacLauncher
7
9
  class Runner < ::EacRubyUtils::Console::DocoptRunner
8
- DOC = <<DOCOPT.freeze
10
+ DOC = <<DOCOPT
9
11
  Utilities to deploy applications and libraries.
10
12
 
11
13
  Usage:
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/instances/runner_helper'
2
4
 
3
5
  module EacLauncher
4
6
  class Runner < ::EacRubyUtils::Console::DocoptRunner
5
7
  class Instances < ::EacLauncher::Instances::RunnerHelper
6
- DOC = <<DOCOPT.freeze
8
+ DOC = <<DOCOPT
7
9
  Mostra informações sobre instâncias.
8
10
 
9
11
  Usage:
@@ -24,11 +26,11 @@ DOCOPT
24
26
 
25
27
  private
26
28
 
27
- def show_instance(i)
28
- puts instance_label(i)
29
- infov(' * Parent', (i.parent ? instance_label(i.parent) : '-'))
30
- infov(' * Git current revision', i.options.git_current_revision)
31
- infov(' * Git publish remote', i.options.git_publish_remote)
29
+ def show_instance(instance)
30
+ puts instance_label(instance)
31
+ infov(' * Parent', (instance.parent ? instance_label(instance.parent) : '-'))
32
+ infov(' * Git current revision', instance.options.git_current_revision)
33
+ infov(' * Git publish remote', instance.options.git_publish_remote)
32
34
  end
33
35
 
34
36
  def instance_path
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/context'
2
4
  require 'eac_launcher/instances/runner_helper'
3
5
 
4
6
  module EacLauncher
5
7
  class Runner < ::EacRubyUtils::Console::DocoptRunner
6
8
  class Projects < ::EacLauncher::Instances::RunnerHelper
7
- DOC = <<DOCOPT.freeze
9
+ DOC = <<DOCOPT
8
10
  Shows available projects.
9
11
 
10
12
  Usage:
@@ -27,16 +29,17 @@ DOCOPT
27
29
 
28
30
  private
29
31
 
30
- def show_project(p)
31
- puts project_label(p)
32
+ def show_project(project)
33
+ puts project_label(project)
32
34
  return unless options['--instances']
33
- p.instances.each do |i|
35
+
36
+ project.instances.each do |i|
34
37
  puts " * #{instance_label(i)}"
35
38
  end
36
39
  end
37
40
 
38
- def project_label(p)
39
- p.to_s.cyan.to_s
41
+ def project_label(project)
42
+ project.to_s.cyan.to_s
40
43
  end
41
44
  end
42
45
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  class Runner < ::EacRubyUtils::Console::DocoptRunner
3
5
  class Publish < ::EacLauncher::Instances::RunnerHelper
4
- DOC = <<DOCOPT.freeze
6
+ DOC = <<DOCOPT
5
7
  Publica projetos ou instâncias.
6
8
 
7
9
  Usage:
@@ -27,6 +29,7 @@ DOCOPT
27
29
  build_publish_options
28
30
  instances.each do |i|
29
31
  next unless i.options.publishable?
32
+
30
33
  i.send(instance_method)
31
34
  end
32
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/string/inflections'
2
4
 
3
5
  module EacLauncher
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/stereotypes/git'
2
4
  require 'eac_launcher/stereotypes/git_subrepo'
3
5
  require 'eac_launcher/stereotypes/git_subtree'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/stereotype'
2
4
 
3
5
  module EacLauncher
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/git/publish_base'
2
4
 
3
5
  module EacLauncher
4
6
  module Stereotypes
5
7
  class Git
6
8
  class Publish < ::EacLauncher::Git::PublishBase
7
- PUBLISH_GIT_REMOTE_NAME = 'publish'.freeze
9
+ PUBLISH_GIT_REMOTE_NAME = 'publish'
8
10
  end
9
11
  end
10
12
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/git/warp_base'
2
4
 
3
5
  module EacLauncher
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/git/error'
2
4
  require 'eac_launcher/stereotype'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/git/publish_base'
2
4
 
3
5
  module EacLauncher
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_ruby_utils/simple_cache'
2
4
  require 'eac_launcher/git/sub_warp_base'
3
5
  require 'eac_launcher/instances/error'
@@ -28,6 +30,7 @@ module EacLauncher
28
30
  def check_parent
29
31
  return if parent_git_warped.rev_parse(subrepo_parent_hash) &&
30
32
  parent_git_warped.descendant?('HEAD', subrepo_parent_hash)
33
+
31
34
  raise EacLauncher::Instances::Error, "Subrepo parent hash \"#{subrepo_parent_hash}\""\
32
35
  " not found in \"#{parent_git_warped}\""
33
36
  end
@@ -36,6 +39,7 @@ module EacLauncher
36
39
  data = parent_git_warped.subrepo_status(to_parent_git_path)
37
40
  h = data['Pull Parent']
38
41
  return h if h.present?
42
+
39
43
  raise EacLauncher::Instances::Error, "Subrepo parent hash is blank: #{data}"
40
44
  end
41
45
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/stereotype'
2
4
  require 'eac_launcher/stereotypes/git'
3
5
 
@@ -10,8 +12,10 @@ module EacLauncher
10
12
  def match?(path)
11
13
  return false if other_git_stereotype?(path)
12
14
  return false unless other_nogit_stereotype?(path)
15
+
13
16
  parent = parent_git(path.parent_path)
14
17
  return false unless parent
18
+
15
19
  ::Git.open(parent.real).remote(path.real.basename).url ? true : false
16
20
  end
17
21
 
@@ -19,9 +23,14 @@ module EacLauncher
19
23
  :green
20
24
  end
21
25
 
22
- def parent_git(p)
23
- return nil unless p
24
- ::EacLauncher::Stereotypes::Git.match?(p) ? p : parent_git(p.parent_path)
26
+ def parent_git(parent_path)
27
+ return nil unless parent_path
28
+
29
+ if ::EacLauncher::Stereotypes::Git.match?(parent_path)
30
+ parent_path
31
+ else
32
+ parent_git(parent_path.parent_path)
33
+ end
25
34
  end
26
35
 
27
36
  def other_git_stereotype?(path)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  module Stereotypes
3
5
  class GitSubtree
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  module Stereotypes
3
5
  class GitSubtree
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/stereotype'
2
4
 
3
5
  module EacLauncher
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/stereotype'
2
4
 
3
5
  module EacLauncher
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/ruby/gem/specification'
2
4
  require 'eac_launcher/stereotype'
3
5
  require 'eac_launcher/stereotypes/ruby_gem/publish'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'curb'
2
4
  require 'json'
3
5
  require 'eac_ruby_utils/simple_cache'
@@ -98,6 +100,7 @@ module EacLauncher
98
100
  http = Curl.get("https://rubygems.org/api/v1/versions/#{gem_spec.name}.json")
99
101
  return JSON.parse!(http.body_str) if /\A2/ =~ http.status
100
102
  return [] if /\A4/ =~ http.status
103
+
101
104
  raise "#{http} code error: #{http.status}"
102
105
  end
103
106
 
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'eac_launcher/vendor/github'
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EacLauncher
2
4
  module Vendor
3
5
  module Github
4
6
  class << self
5
7
  def to_ssh_url(url)
6
8
  return nil if url.blank?
9
+
7
10
  m = %r{\Ahttps://github.com/([^/]+)/([^/]+)\z}.match(url.to_s)
8
11
  m ? "git@github.com:#{m[1]}/#{m[2]}.git" : url
9
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacLauncher
4
- VERSION = '0.6.0'.freeze
4
+ VERSION = '0.6.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
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: 2019-07-29 00:00:00.000000000 Z
11
+ date: 2019-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -59,39 +59,25 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: 0.9.4
61
61
  - !ruby/object:Gem::Dependency
62
- name: eac_rails_utils
62
+ name: eac_ruby_utils
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0.1'
67
+ version: '0.10'
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: 0.1.14
70
+ version: 0.10.1
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '0.1'
77
+ version: '0.10'
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 0.1.14
81
- - !ruby/object:Gem::Dependency
82
- name: eac_ruby_utils
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "~>"
86
- - !ruby/object:Gem::Version
87
- version: '0.7'
88
- type: :runtime
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "~>"
93
- - !ruby/object:Gem::Version
94
- version: '0.7'
80
+ version: 0.10.1
95
81
  - !ruby/object:Gem::Dependency
96
82
  name: git
97
83
  requirement: !ruby/object:Gem::Requirement
@@ -140,14 +126,14 @@ dependencies:
140
126
  requirements:
141
127
  - - "~>"
142
128
  - !ruby/object:Gem::Version
143
- version: 0.49.1
129
+ version: '0.74'
144
130
  type: :development
145
131
  prerelease: false
146
132
  version_requirements: !ruby/object:Gem::Requirement
147
133
  requirements:
148
134
  - - "~>"
149
135
  - !ruby/object:Gem::Version
150
- version: 0.49.1
136
+ version: '0.74'
151
137
  description:
152
138
  email:
153
139
  executables: