eac_launcher 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/eac_launcher.rb +2 -1
- data/lib/eac_launcher/context.rb +21 -16
- data/lib/eac_launcher/git/base.rb +1 -1
- data/lib/eac_launcher/git/base/subrepo.rb +8 -1
- data/lib/eac_launcher/git/base/underlying.rb +1 -1
- data/lib/eac_launcher/git/mirror_update.rb +3 -2
- data/lib/eac_launcher/git/publish_base.rb +1 -1
- data/lib/eac_launcher/git/warp_base.rb +3 -3
- data/lib/eac_launcher/instances/base.rb +24 -56
- data/lib/eac_launcher/instances/base/cache.rb +1 -1
- data/lib/eac_launcher/paths/logical.rb +59 -0
- data/lib/eac_launcher/paths/real.rb +37 -0
- data/lib/eac_launcher/ruby/gem/build.rb +1 -1
- data/lib/eac_launcher/stereotypes/git.rb +1 -1
- data/lib/eac_launcher/stereotypes/git_subrepo.rb +1 -1
- data/lib/eac_launcher/stereotypes/git_subrepo/warp.rb +4 -4
- data/lib/eac_launcher/stereotypes/git_subtree.rb +9 -5
- data/lib/eac_launcher/stereotypes/rails.rb +1 -1
- data/lib/eac_launcher/stereotypes/redmine_plugin.rb +1 -1
- data/lib/eac_launcher/stereotypes/ruby_gem.rb +1 -1
- data/lib/eac_launcher/stereotypes/ruby_gem/publish.rb +1 -1
- data/lib/eac_launcher/version.rb +1 -1
- metadata +4 -3
- data/lib/eac_launcher/path.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52aa71693d4a4209ac7290124875448649aaed7b
|
4
|
+
data.tar.gz: 16cd264adfe0fbd7803a0f1226211071fc9c47f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 647bcc691051e3f74abf673997c289ba5246b51104278ebc3e4c9d48669ffb54e3d01c7fcd904f6172d523bdf29cb9610aa5084c43e6fd3ff25bf3a3620dc363
|
7
|
+
data.tar.gz: 29a16f00a5abd889bc15719dd3e1c3e2a9c8d22ace0a9b41181e397178b3886d5ff9a42ac7199c21fa27d61a1bff5e26c767b40d654c8fb1d0d010c516178a2c
|
data/lib/eac_launcher.rb
CHANGED
@@ -14,7 +14,8 @@ require('yaml')
|
|
14
14
|
|
15
15
|
module EacLauncher
|
16
16
|
require 'eac_launcher/context'
|
17
|
-
require 'eac_launcher/
|
17
|
+
require 'eac_launcher/paths/logical'
|
18
|
+
require 'eac_launcher/paths/real'
|
18
19
|
require 'eac_launcher/project'
|
19
20
|
require 'eac_launcher/stereotype'
|
20
21
|
require 'eac_launcher/context/settings'
|
data/lib/eac_launcher/context.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module EacLauncher
|
2
2
|
class Context
|
3
3
|
include ::Eac::SimpleCache
|
4
|
+
include ::EacRubyUtils::Console::Speaker
|
4
5
|
|
5
6
|
DEFAULT_PROJECTS_ROOT = '.'.freeze
|
6
7
|
DEFAULT_SETTINGS_FILE = ::File.join(ENV['HOME'], '.config', 'eac_launcher', 'settings.yml')
|
@@ -23,7 +24,7 @@ module EacLauncher
|
|
23
24
|
|
24
25
|
def initialize(options = {})
|
25
26
|
@options = options.with_indifferent_access
|
26
|
-
@root = ::EacLauncher::
|
27
|
+
@root = ::EacLauncher::Paths::Logical.new(nil, build_option(:projects_root), '/')
|
27
28
|
@settings = ::EacLauncher::Context::Settings.new(build_option(:settings_file))
|
28
29
|
@cache_root = build_option(:cache_root)
|
29
30
|
@publish_options = { new: false, confirm: false, stereotype: nil }
|
@@ -50,30 +51,34 @@ module EacLauncher
|
|
50
51
|
def projects_uncached
|
51
52
|
r = {}
|
52
53
|
instances.each do |i|
|
53
|
-
r[i.
|
54
|
-
r[i.
|
54
|
+
r[i.project_name] ||= []
|
55
|
+
r[i.project_name] << i
|
55
56
|
end
|
56
57
|
r.map { |name, instances| ::EacLauncher::Project.new(name, instances) }
|
57
|
-
.select { |p| include_project?(p) }
|
58
58
|
end
|
59
59
|
|
60
60
|
def instances_uncached
|
61
|
-
|
61
|
+
path_instances(root, nil)
|
62
62
|
end
|
63
63
|
|
64
|
-
def
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
!@settings.excluded_projects.include?(p.name)
|
64
|
+
def path_instances(path, parent_instance)
|
65
|
+
on_rescued_path_instances(path) do |r|
|
66
|
+
if path.project?
|
67
|
+
parent_instance = ::EacLauncher::Instances::Base.instanciate(path, self, parent_instance)
|
68
|
+
r << path if path.included?
|
69
|
+
end
|
70
|
+
r.concat(path.children.flat_map { |c| path_instances(c, parent_instance) })
|
71
|
+
end
|
73
72
|
end
|
74
73
|
|
75
|
-
def
|
76
|
-
|
74
|
+
def on_rescued_path_instances(path)
|
75
|
+
r = []
|
76
|
+
begin
|
77
|
+
yield(r)
|
78
|
+
rescue StandardError => ex
|
79
|
+
warn("#{path}: #{ex}")
|
80
|
+
end
|
81
|
+
r
|
77
82
|
end
|
78
83
|
end
|
79
84
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module EacLauncher
|
2
2
|
module Git
|
3
|
-
class Base < ::EacLauncher::
|
3
|
+
class Base < ::EacLauncher::Paths::Real
|
4
4
|
module Subrepo
|
5
5
|
def subrepo_status(subrepo_path)
|
6
6
|
s = execute!('subrepo', 'status', subrepo_path.gsub(%r{\A/}, ''))
|
@@ -10,6 +10,13 @@ module EacLauncher
|
|
10
10
|
r
|
11
11
|
end
|
12
12
|
|
13
|
+
def subrepo_remote_url(subrepo_path)
|
14
|
+
h = subrepo_status(subrepo_path)
|
15
|
+
url = h['Remote URL']
|
16
|
+
return url if url.present?
|
17
|
+
raise "Remote URL is blank for subrepo \"#{subrepo_path}\" (Subrepo status: #{h})"
|
18
|
+
end
|
19
|
+
|
13
20
|
private
|
14
21
|
|
15
22
|
def subrepo_status_parse_output(s)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module EacLauncher
|
2
2
|
module Git
|
3
|
-
class MirrorUpdate < ::EacLauncher::
|
3
|
+
class MirrorUpdate < ::EacLauncher::Paths::Real
|
4
4
|
include ::Eac::SimpleCache
|
5
5
|
|
6
6
|
def initialize(target_path, source_path, source_rev)
|
@@ -20,7 +20,8 @@ module EacLauncher
|
|
20
20
|
|
21
21
|
def fetch_remote_source
|
22
22
|
@target_git.git
|
23
|
-
@target_git.
|
23
|
+
@target_git.assert_remote_url('origin', @source_git)
|
24
|
+
@target_git.fetch('origin', tags: true)
|
24
25
|
end
|
25
26
|
|
26
27
|
def reset_source_rev
|
@@ -4,7 +4,7 @@ module EacLauncher
|
|
4
4
|
# * source_instance
|
5
5
|
# * source_remote_name
|
6
6
|
# * current_ref
|
7
|
-
class WarpBase < ::EacLauncher::
|
7
|
+
class WarpBase < ::EacLauncher::Paths::Real
|
8
8
|
include ::Eac::SimpleCache
|
9
9
|
|
10
10
|
TARGET_REMOTE = 'target'.freeze
|
@@ -23,7 +23,7 @@ module EacLauncher
|
|
23
23
|
def update
|
24
24
|
::EacLauncher::Git::MirrorUpdate.new(
|
25
25
|
path,
|
26
|
-
source_instance,
|
26
|
+
source_instance.real,
|
27
27
|
source_instance.options.git_current_revision
|
28
28
|
)
|
29
29
|
end
|
@@ -33,7 +33,7 @@ module EacLauncher
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def source_git_uncached
|
36
|
-
::EacLauncher::Git::Base.new(source_instance)
|
36
|
+
::EacLauncher::Git::Base.new(source_instance.real)
|
37
37
|
end
|
38
38
|
|
39
39
|
def cache_git_uncached
|
@@ -2,41 +2,39 @@ require_relative 'base/cache'
|
|
2
2
|
|
3
3
|
module EacLauncher
|
4
4
|
module Instances
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
module Base
|
6
|
+
class << self
|
7
|
+
def extend_object(object)
|
8
|
+
object.extend ::Eac::SimpleCache
|
9
|
+
object.extend ::EacRubyUtils::Console::Speaker
|
10
|
+
object.extend ::EacLauncher::Instances::Base::Cache
|
11
|
+
super
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
def instanciate(path, context, parent)
|
15
|
+
unless path.is_a?(::EacLauncher::Instances::Base)
|
16
|
+
raise "#{path} is not a project" unless path.project?
|
17
|
+
path.extend(::EacLauncher::Instances::Base)
|
18
|
+
path.context = context
|
19
|
+
path.parent = parent
|
20
|
+
end
|
21
|
+
path
|
22
|
+
end
|
15
23
|
end
|
16
24
|
|
17
|
-
|
18
|
-
to_root_path
|
19
|
-
end
|
25
|
+
attr_accessor :context, :parent
|
20
26
|
|
21
|
-
def
|
22
|
-
|
27
|
+
def name
|
28
|
+
logical
|
23
29
|
end
|
24
30
|
|
25
31
|
def stereotype?(stereotype)
|
26
32
|
stereotypes.include?(stereotype)
|
27
33
|
end
|
28
34
|
|
29
|
-
def children
|
30
|
-
scan(self)
|
31
|
-
end
|
32
|
-
|
33
35
|
def to_parent_path
|
34
36
|
return self unless @parent
|
35
|
-
gsub(/\A#{Regexp.quote(@parent)}/, '')
|
36
|
-
end
|
37
|
-
|
38
|
-
def to_root_path
|
39
|
-
gsub(/\A#{root}/, '')
|
37
|
+
logical.gsub(/\A#{Regexp.quote(@parent.logical)}/, '')
|
40
38
|
end
|
41
39
|
|
42
40
|
def project?
|
@@ -60,14 +58,11 @@ module EacLauncher
|
|
60
58
|
end
|
61
59
|
|
62
60
|
def project_name
|
63
|
-
File.basename(
|
61
|
+
::File.basename(logical)
|
64
62
|
end
|
65
63
|
|
66
|
-
def
|
67
|
-
|
68
|
-
return s.warp_class.new(self) if s.warp_class
|
69
|
-
end
|
70
|
-
self
|
64
|
+
def included?
|
65
|
+
!::EacLauncher::Context.current.settings.excluded_projects.include?(project_name)
|
71
66
|
end
|
72
67
|
|
73
68
|
private
|
@@ -81,33 +76,6 @@ module EacLauncher
|
|
81
76
|
def options_uncached
|
82
77
|
::EacLauncher::Context.current.settings.instance_settings(self)
|
83
78
|
end
|
84
|
-
|
85
|
-
def root_uncached
|
86
|
-
return self unless @parent
|
87
|
-
@parent.root
|
88
|
-
end
|
89
|
-
|
90
|
-
def scan(path)
|
91
|
-
r = []
|
92
|
-
scan_subdirectories(path) do |sp|
|
93
|
-
c = self.class.new(sp, self)
|
94
|
-
if c.stereotypes.any?
|
95
|
-
r << c
|
96
|
-
else
|
97
|
-
r += scan(sp)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
r
|
101
|
-
end
|
102
|
-
|
103
|
-
def scan_subdirectories(path)
|
104
|
-
Dir.entries(path).each do |basename|
|
105
|
-
next if %w[. ..].include?(basename)
|
106
|
-
sp = path.subpath(basename)
|
107
|
-
next unless File.directory?(sp)
|
108
|
-
yield(sp)
|
109
|
-
end
|
110
|
-
end
|
111
79
|
end
|
112
80
|
end
|
113
81
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'eac_launcher/paths/real'
|
2
|
+
|
3
|
+
module EacLauncher
|
4
|
+
module Paths
|
5
|
+
class Logical
|
6
|
+
include ::Eac::SimpleCache
|
7
|
+
|
8
|
+
attr_reader :real, :logical, :parent_path
|
9
|
+
|
10
|
+
def initialize(parent_path, real, logical)
|
11
|
+
@parent_path = parent_path
|
12
|
+
@real = ::EacLauncher::Paths::Real.new(real)
|
13
|
+
@logical = logical
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
logical
|
18
|
+
end
|
19
|
+
|
20
|
+
def project?
|
21
|
+
stereotypes.any?
|
22
|
+
end
|
23
|
+
|
24
|
+
def children
|
25
|
+
r = []
|
26
|
+
Dir.entries(warped).each do |c|
|
27
|
+
c_path = ::File.join(warped, c)
|
28
|
+
next unless ::File.directory?(c_path)
|
29
|
+
next if c.start_with?('.')
|
30
|
+
r << build_child(c)
|
31
|
+
end
|
32
|
+
r
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def stereotypes_uncached
|
38
|
+
::EacLauncher::Stereotype.stereotypes.select { |s| s.match?(self) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def build_child(name)
|
42
|
+
::EacLauncher::Paths::Logical.new(
|
43
|
+
self,
|
44
|
+
::File.join(warped, name),
|
45
|
+
::File.join(logical, name)
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def warped_uncached
|
50
|
+
if is_a?(::EacLauncher::Instances::Base)
|
51
|
+
stereotypes.each do |s|
|
52
|
+
return s.warp_class.new(self) if s.warp_class
|
53
|
+
end
|
54
|
+
end
|
55
|
+
real
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module EacLauncher
|
2
|
+
module Paths
|
3
|
+
class Real < String
|
4
|
+
def initialize(path)
|
5
|
+
raise "Argument path is not a string: \"#{path}\"|#{path.class}" unless path.is_a?(String)
|
6
|
+
super(path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def subpath(relative_path)
|
10
|
+
::EacLauncher::Paths::Real.new(::File.expand_path(relative_path, self))
|
11
|
+
end
|
12
|
+
|
13
|
+
def basename
|
14
|
+
::File.basename(self)
|
15
|
+
end
|
16
|
+
|
17
|
+
def dirname
|
18
|
+
return nil if self == '/'
|
19
|
+
self.class.new(::File.dirname(self))
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_file_with_extension(extension)
|
23
|
+
r = find_files_with_extension(extension)
|
24
|
+
return r.first if r.any?
|
25
|
+
raise "Extension \"#{extension}\" not found in directory \"#{self}\""
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_files_with_extension(extension)
|
29
|
+
r = []
|
30
|
+
::Dir.entries(self).each do |i|
|
31
|
+
r << ::File.expand_path(i, self) if i =~ /#{::Regexp.quote(extension)}\z/
|
32
|
+
end
|
33
|
+
r
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module EacLauncher
|
2
2
|
module Stereotypes
|
3
3
|
class GitSubrepo
|
4
|
-
class Warp < ::EacLauncher::
|
4
|
+
class Warp < ::EacLauncher::Paths::Real
|
5
5
|
include ::Eac::SimpleCache
|
6
6
|
|
7
7
|
attr_reader :instance
|
@@ -41,11 +41,11 @@ module EacLauncher
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def parent_git_uncached
|
44
|
-
::EacLauncher::Git::Base.new(
|
44
|
+
::EacLauncher::Git::Base.new(parent_instance.real)
|
45
45
|
end
|
46
46
|
|
47
47
|
def parent_cache_git_uncached
|
48
|
-
::EacLauncher::Git::Base.new(parent_instance.
|
48
|
+
::EacLauncher::Git::Base.new(parent_instance.warped)
|
49
49
|
end
|
50
50
|
|
51
51
|
def aux_path
|
@@ -77,7 +77,7 @@ module EacLauncher
|
|
77
77
|
|
78
78
|
def target_remote_url
|
79
79
|
::EacLauncher::Vendor::Github.to_ssh_url(
|
80
|
-
|
80
|
+
parent_cache_git.subrepo_remote_url(subrepo_subdir)
|
81
81
|
)
|
82
82
|
end
|
83
83
|
end
|
@@ -5,12 +5,11 @@ module EacLauncher
|
|
5
5
|
|
6
6
|
class << self
|
7
7
|
def match?(path)
|
8
|
-
return false if
|
9
|
-
::EacLauncher::Stereotypes::GitSubrepo.match?(path)
|
8
|
+
return false if other_git_stereotype?(path)
|
10
9
|
return false unless other_nogit_stereotype?(path)
|
11
|
-
parent = parent_git(path.
|
10
|
+
parent = parent_git(path.parent_path)
|
12
11
|
return false unless parent
|
13
|
-
::Git.open(parent).remote(
|
12
|
+
::Git.open(parent.real).remote(path.real.basename).url ? true : false
|
14
13
|
end
|
15
14
|
|
16
15
|
def color
|
@@ -19,7 +18,12 @@ module EacLauncher
|
|
19
18
|
|
20
19
|
def parent_git(p)
|
21
20
|
return nil unless p
|
22
|
-
::EacLauncher::Stereotypes::Git.match?(p) ? p : parent_git(p.
|
21
|
+
::EacLauncher::Stereotypes::Git.match?(p) ? p : parent_git(p.parent_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
def other_git_stereotype?(path)
|
25
|
+
::EacLauncher::Stereotypes::Git.match?(path) ||
|
26
|
+
::EacLauncher::Stereotypes::GitSubrepo.match?(path)
|
23
27
|
end
|
24
28
|
|
25
29
|
def other_nogit_stereotype?(path)
|
data/lib/eac_launcher/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.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: 2018-05-
|
11
|
+
date: 2018-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -163,7 +163,8 @@ files:
|
|
163
163
|
- lib/eac_launcher/instances/error.rb
|
164
164
|
- lib/eac_launcher/instances/runner_helper.rb
|
165
165
|
- lib/eac_launcher/instances/settings.rb
|
166
|
-
- lib/eac_launcher/
|
166
|
+
- lib/eac_launcher/paths/logical.rb
|
167
|
+
- lib/eac_launcher/paths/real.rb
|
167
168
|
- lib/eac_launcher/project.rb
|
168
169
|
- lib/eac_launcher/publish/base.rb
|
169
170
|
- lib/eac_launcher/publish/check_result.rb
|
data/lib/eac_launcher/path.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module EacLauncher
|
2
|
-
class Path < String
|
3
|
-
def subpath(relative_path)
|
4
|
-
::EacLauncher::Path.new(::File.expand_path(relative_path, self))
|
5
|
-
end
|
6
|
-
|
7
|
-
def basename
|
8
|
-
::File.basename(self)
|
9
|
-
end
|
10
|
-
|
11
|
-
def find_file_with_extension(extension)
|
12
|
-
r = find_files_with_extension(extension)
|
13
|
-
return r.first if r.any?
|
14
|
-
raise "Extension \"#{extension}\" not found in directory \"#{self}\""
|
15
|
-
end
|
16
|
-
|
17
|
-
def find_files_with_extension(extension)
|
18
|
-
r = []
|
19
|
-
::Dir.entries(self).each do |i|
|
20
|
-
r << ::File.expand_path(i, self) if i =~ /#{::Regexp.quote(extension)}\z/
|
21
|
-
end
|
22
|
-
r
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|