nucleon 0.1.9 → 0.1.10
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.
- data/Gemfile +1 -1
- data/Gemfile.lock +13 -14
- data/VERSION +1 -1
- data/lib/core/facade.rb +1 -1
- data/lib/core/manager.rb +0 -1
- data/lib/core/mixin/action/project.rb +8 -7
- data/lib/core/plugin/action.rb +1 -1
- data/lib/core/plugin/project.rb +41 -16
- data/lib/core/util/git.rb +33 -28
- data/lib/nucleon/action/add.rb +23 -5
- data/lib/nucleon/action/create.rb +5 -11
- data/lib/nucleon/action/extract.rb +1 -1
- data/lib/nucleon/action/remove.rb +4 -3
- data/lib/nucleon/action/save.rb +3 -2
- data/lib/nucleon/action/update.rb +4 -3
- data/lib/nucleon/command/bash.rb +10 -1
- data/lib/nucleon/project/git.rb +176 -142
- data/lib/nucleon_base.rb +4 -1
- data/locales/en.yml +15 -14
- data/nucleon.gemspec +5 -5
- metadata +34 -34
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.3.
|
4
|
+
addressable (2.3.6)
|
5
|
+
atomic (1.1.16)
|
5
6
|
builder (3.2.2)
|
6
7
|
celluloid (0.15.2)
|
7
8
|
timers (~> 1.1.0)
|
8
|
-
childprocess (0.5.
|
9
|
+
childprocess (0.5.2)
|
9
10
|
ffi (~> 1.0, >= 1.0.11)
|
10
11
|
deep_merge (1.0.1)
|
11
|
-
descendants_tracker (0.0.
|
12
|
+
descendants_tracker (0.0.4)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
12
14
|
diff-lcs (1.2.5)
|
13
15
|
faraday (0.9.0)
|
14
16
|
multipart-post (>= 1.2, < 3)
|
@@ -22,10 +24,6 @@ GEM
|
|
22
24
|
multi_json (>= 1.7.5, < 2.0)
|
23
25
|
nokogiri (~> 1.6.0)
|
24
26
|
oauth2
|
25
|
-
grit (2.5.0)
|
26
|
-
diff-lcs (~> 1.1)
|
27
|
-
mime-types (~> 1.15)
|
28
|
-
posix-spawn (~> 0.3.6)
|
29
27
|
hashie (2.0.5)
|
30
28
|
highline (1.6.21)
|
31
29
|
i18n (0.6.9)
|
@@ -42,8 +40,7 @@ GEM
|
|
42
40
|
jwt (0.1.11)
|
43
41
|
multi_json (>= 1.5)
|
44
42
|
log4r (1.1.10)
|
45
|
-
|
46
|
-
mini_portile (0.5.2)
|
43
|
+
mini_portile (0.5.3)
|
47
44
|
multi_json (1.9.2)
|
48
45
|
multi_xml (0.5.5)
|
49
46
|
multipart-post (2.0.0)
|
@@ -58,9 +55,8 @@ GEM
|
|
58
55
|
rack (~> 1.2)
|
59
56
|
octokit (2.7.2)
|
60
57
|
sawyer (~> 0.5.2)
|
61
|
-
posix-spawn (0.3.8)
|
62
58
|
rack (1.5.2)
|
63
|
-
rake (10.
|
59
|
+
rake (10.2.2)
|
64
60
|
rdoc (3.12.2)
|
65
61
|
json (~> 1.4)
|
66
62
|
rspec (2.14.1)
|
@@ -71,12 +67,15 @@ GEM
|
|
71
67
|
rspec-expectations (2.14.5)
|
72
68
|
diff-lcs (>= 1.1.3, < 2.0)
|
73
69
|
rspec-mocks (2.14.6)
|
74
|
-
|
70
|
+
rugged (0.19.0)
|
71
|
+
sawyer (0.5.4)
|
75
72
|
addressable (~> 2.3.5)
|
76
73
|
faraday (~> 0.8, < 0.10)
|
77
74
|
sshkey (1.6.1)
|
75
|
+
thread_safe (0.3.1)
|
76
|
+
atomic (>= 1.1.7, < 2)
|
78
77
|
timers (1.1.0)
|
79
|
-
yard (0.8.7.
|
78
|
+
yard (0.8.7.4)
|
80
79
|
|
81
80
|
PLATFORMS
|
82
81
|
ruby
|
@@ -86,7 +85,6 @@ DEPENDENCIES
|
|
86
85
|
celluloid (~> 0.15)
|
87
86
|
childprocess (~> 0.5.0)
|
88
87
|
deep_merge (~> 1.0)
|
89
|
-
grit (~> 2.5)
|
90
88
|
i18n (~> 0.6)
|
91
89
|
jeweler (~> 2.0)
|
92
90
|
log4r (~> 1.1)
|
@@ -95,5 +93,6 @@ DEPENDENCIES
|
|
95
93
|
octokit (~> 2.7)
|
96
94
|
rdoc (~> 3.12)
|
97
95
|
rspec (~> 2.10)
|
96
|
+
rugged (~> 0.19)
|
98
97
|
sshkey (~> 1.6)
|
99
98
|
yard (~> 0.8)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
data/lib/core/facade.rb
CHANGED
@@ -332,7 +332,7 @@ module Facade
|
|
332
332
|
|
333
333
|
result = Util::Shell.connection.exec(command, config, &code)
|
334
334
|
|
335
|
-
unless result.status == Nucleon.code.success
|
335
|
+
unless config.get(:quiet, false) || result.status == Nucleon.code.success
|
336
336
|
ui.error("Command #{command} failed to execute")
|
337
337
|
end
|
338
338
|
result
|
data/lib/core/manager.rb
CHANGED
@@ -8,7 +8,7 @@ module Project
|
|
8
8
|
# Settings
|
9
9
|
|
10
10
|
def project_config
|
11
|
-
project_plugins =
|
11
|
+
project_plugins = Nucleon.loaded_plugins(:project)
|
12
12
|
|
13
13
|
register :project_provider, :str, :git, 'nucleon.core.mixin.action.project.options.project_provider' do |value|
|
14
14
|
value = value.to_sym
|
@@ -21,7 +21,7 @@ module Project
|
|
21
21
|
end
|
22
22
|
register :project_reference, :str, nil, 'nucleon.core.mixin.action.project.options.project_reference' do |value|
|
23
23
|
success = true
|
24
|
-
if info =
|
24
|
+
if info = Nucleon.plugin_class(:project).translate_reference(value)
|
25
25
|
if ! project_plugins.keys.include?(info[:provider].to_sym)
|
26
26
|
warn('nucleon.core.mixin.action.project.errors.project_reference', {
|
27
27
|
:value => value,
|
@@ -35,26 +35,27 @@ module Project
|
|
35
35
|
end
|
36
36
|
success
|
37
37
|
end
|
38
|
-
register :
|
38
|
+
register :project_revision, :str, :master, 'nucleon.core.mixin.action.project.options.project_revision'
|
39
39
|
end
|
40
40
|
|
41
41
|
#-----------------------------------------------------------------------------
|
42
42
|
# Operations
|
43
43
|
|
44
|
-
def project_load(root_dir, update = false)
|
44
|
+
def project_load(root_dir, create = false, update = false)
|
45
45
|
|
46
46
|
# 1. Set a default project provider (reference can override)
|
47
47
|
# 2. Get project from root directory
|
48
|
-
# 3. Initialize project if not yet initialized
|
48
|
+
# 3. Initialize project if not yet initialized if requested
|
49
49
|
# 4. Set remote if needed
|
50
50
|
# 5. Checkout revision if needed
|
51
51
|
# 6. Pull down updates if requested
|
52
52
|
|
53
53
|
return Nucleon.project(extended_config(:project, {
|
54
|
+
:create => create,
|
54
55
|
:provider => settings[:project_provider],
|
55
56
|
:directory => root_dir,
|
56
|
-
:url => settings[:
|
57
|
-
:revision => settings[:
|
57
|
+
:url => settings[:project_reference],
|
58
|
+
:revision => settings[:project_revision],
|
58
59
|
:pull => update
|
59
60
|
}))
|
60
61
|
end
|
data/lib/core/plugin/action.rb
CHANGED
@@ -337,7 +337,7 @@ class Action < Base
|
|
337
337
|
begin
|
338
338
|
if skip_validate || validate
|
339
339
|
yield if block_given? && ( skip_hooks || extension_check(:exec_init) )
|
340
|
-
myself.status = extension_set(:exec_exit) unless skip_hooks
|
340
|
+
myself.status = extension_set(:exec_exit, myself.status) unless skip_hooks
|
341
341
|
else
|
342
342
|
puts "\n" + I18n.t('corl.core.exec.help.usage') + ': ' + help + "\n" unless quiet?
|
343
343
|
myself.status = code.validation_failed
|
data/lib/core/plugin/project.rb
CHANGED
@@ -550,14 +550,16 @@ class Project < Base
|
|
550
550
|
|
551
551
|
#---
|
552
552
|
|
553
|
-
def update_subprojects
|
553
|
+
def update_subprojects(options = {})
|
554
554
|
if can_persist?
|
555
555
|
localize do
|
556
|
+
config = Config.ensure(options)
|
557
|
+
|
556
558
|
if extension_check(:update_projects)
|
557
559
|
logger.info("Updating sub projects in project #{name}")
|
558
560
|
|
559
561
|
success = false
|
560
|
-
success = yield if block_given?
|
562
|
+
success = yield(config) if block_given?
|
561
563
|
|
562
564
|
if success
|
563
565
|
extension(:update_projects_success)
|
@@ -723,11 +725,12 @@ class Project < Base
|
|
723
725
|
|
724
726
|
if extension_check(:pull, { :directory => directory, :config => config })
|
725
727
|
remote = config.delete(:remote)
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
728
|
+
|
729
|
+
if remote(remote)
|
730
|
+
logger.info("Pulling from #{remote} into #{directory}")
|
731
|
+
success = yield(config, remote) if block_given?
|
732
|
+
end
|
733
|
+
|
731
734
|
if success
|
732
735
|
load_revision
|
733
736
|
update_subprojects
|
@@ -763,20 +766,40 @@ class Project < Base
|
|
763
766
|
if extension_check(:push, { :directory => directory, :config => config })
|
764
767
|
remote = config.delete(:remote)
|
765
768
|
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
769
|
+
if remote(remote)
|
770
|
+
logger.info("Pushing to #{remote} from #{directory}")
|
771
|
+
success = yield(config, remote) if block_given? && pull(remote, options)
|
772
|
+
end
|
773
|
+
|
770
774
|
if success
|
771
775
|
config.delete(:revision)
|
772
776
|
|
773
777
|
extension(:push_success, { :directory => directory, :remote => remote, :config => config })
|
774
778
|
|
775
779
|
if config.get(:propogate, true)
|
776
|
-
|
780
|
+
unless parent.nil?
|
781
|
+
propogate_up = config.get(:propogate_up, nil)
|
782
|
+
|
783
|
+
if propogate_up.nil? || propogate_up
|
784
|
+
logger.debug("Commit to parent as parent exists and propogate option was given")
|
785
|
+
parent.push(remote, Config.new(config.export.dup).import({
|
786
|
+
:propogate_up => true,
|
787
|
+
:propogate_down => false
|
788
|
+
}))
|
789
|
+
end
|
790
|
+
end
|
791
|
+
|
792
|
+
logger.debug("Pushing sub projects")
|
793
|
+
|
794
|
+
propogate_down = config.get(:propogate_down, nil)
|
777
795
|
|
778
|
-
|
779
|
-
|
796
|
+
if propogate_down.nil? || propogate_down
|
797
|
+
each do |path, project|
|
798
|
+
project.push(remote, Config.new(config.export.dup).import({
|
799
|
+
:propogate_up => false,
|
800
|
+
:propogate_down => true
|
801
|
+
}))
|
802
|
+
end
|
780
803
|
end
|
781
804
|
end
|
782
805
|
end
|
@@ -883,9 +906,11 @@ class Project < Base
|
|
883
906
|
|
884
907
|
#---
|
885
908
|
|
886
|
-
def localize
|
909
|
+
def localize(path = nil)
|
887
910
|
prev_directory = Dir.pwd
|
888
|
-
|
911
|
+
path = directory if path.nil?
|
912
|
+
|
913
|
+
Dir.chdir(path)
|
889
914
|
|
890
915
|
result = safe_exec(true) do
|
891
916
|
yield
|
data/lib/core/util/git.rb
CHANGED
@@ -1,42 +1,47 @@
|
|
1
1
|
|
2
2
|
module Nucleon
|
3
3
|
module Util
|
4
|
-
class Git
|
4
|
+
class Git
|
5
5
|
|
6
6
|
#-----------------------------------------------------------------------------
|
7
|
-
#
|
8
|
-
|
9
|
-
def
|
7
|
+
# Git repo loader
|
8
|
+
|
9
|
+
def self.load(path, options = {})
|
10
10
|
epath = File.expand_path(path)
|
11
11
|
git_dir = File.join(epath, '.git')
|
12
|
+
git = nil
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
14
|
+
begin
|
15
|
+
if File.exist?(git_dir)
|
16
|
+
if File.directory?(git_dir)
|
17
|
+
git = Rugged::Repository.new(git_dir)
|
18
|
+
else
|
19
|
+
# TODO: Find out if this is actually necessary with Rugged / LibGit2
|
20
|
+
git_dir = Util::Disk.read(git_dir)
|
21
|
+
unless git_dir.nil?
|
22
|
+
git_dir = git_dir.gsub(/^gitdir\:\s*/, '').strip
|
23
|
+
|
24
|
+
if File.directory?(git_dir)
|
25
|
+
git = Rugged::Repository.new(git_dir)
|
26
|
+
git.workdir = epath
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
elsif File.directory?(epath) && (options[:bare] || (epath =~ /\.git$/ && File.exist?(File.join(epath, 'HEAD'))))
|
31
|
+
git = Rugged::Repository.bare(epath)
|
28
32
|
end
|
29
|
-
|
30
|
-
elsif File.directory?(epath) && (options[:is_bare] || (epath =~ /\.git$/ && File.exist?(File.join(epath, 'HEAD'))))
|
31
|
-
self.path = epath
|
32
|
-
@bare = true
|
33
|
-
|
34
|
-
else
|
35
|
-
self.path = git_dir
|
33
|
+
rescue
|
36
34
|
end
|
37
35
|
|
38
|
-
|
39
|
-
|
36
|
+
if git.nil? && options[:create]
|
37
|
+
FileUtils.mkdir_p(epath) unless File.directory?(epath)
|
38
|
+
if options[:bare]
|
39
|
+
git = Rugged::Repository.init_at(epath, :bare)
|
40
|
+
else
|
41
|
+
git = Rugged::Repository.init_at(epath)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
git
|
40
45
|
end
|
41
46
|
end
|
42
47
|
end
|
data/lib/nucleon/action/add.rb
CHANGED
@@ -14,8 +14,26 @@ class Add < Nucleon.plugin_class(:action)
|
|
14
14
|
codes :project_failure,
|
15
15
|
:add_failure,
|
16
16
|
:push_failure
|
17
|
-
|
17
|
+
|
18
|
+
register :path, :str, Dir.pwd
|
19
|
+
|
18
20
|
register :sub_path, :str, nil
|
21
|
+
register :sub_reference, :str, nil do |value|
|
22
|
+
success = true
|
23
|
+
if info = Nucleon.plugin_class(:project).translate_reference(value)
|
24
|
+
if ! Nucleon.loaded_plugins(:project).keys.include?(info[:provider].to_sym)
|
25
|
+
warn('nucleon.core.mixin.action.project.errors.project_reference', {
|
26
|
+
:value => value,
|
27
|
+
:provider => info[:provider],
|
28
|
+
:reference => info[:reference],
|
29
|
+
:url => info[:url],
|
30
|
+
:revision => info[:revision]
|
31
|
+
})
|
32
|
+
success = false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
success
|
36
|
+
end
|
19
37
|
register :editable, :bool, false
|
20
38
|
|
21
39
|
project_config
|
@@ -26,7 +44,7 @@ class Add < Nucleon.plugin_class(:action)
|
|
26
44
|
#---
|
27
45
|
|
28
46
|
def arguments
|
29
|
-
[ :sub_path, :
|
47
|
+
[ :sub_path, :sub_reference ]
|
30
48
|
end
|
31
49
|
|
32
50
|
#-----------------------------------------------------------------------------
|
@@ -36,15 +54,15 @@ class Add < Nucleon.plugin_class(:action)
|
|
36
54
|
super do
|
37
55
|
info('nucleon.actions.add.start')
|
38
56
|
|
39
|
-
if project = project_load(
|
40
|
-
sub_info = project.translate_reference(settings[:
|
57
|
+
if project = project_load(settings[:path], false)
|
58
|
+
sub_info = project.translate_reference(settings[:sub_reference], settings[:editable])
|
41
59
|
sub_path = settings[:sub_path]
|
42
60
|
|
43
61
|
if sub_info
|
44
62
|
sub_url = sub_info[:url]
|
45
63
|
sub_revision = sub_info[:revision]
|
46
64
|
else
|
47
|
-
sub_url = settings[:
|
65
|
+
sub_url = settings[:sub_reference]
|
48
66
|
sub_revision = nil
|
49
67
|
end
|
50
68
|
|
@@ -12,9 +12,10 @@ class Create < Nucleon.plugin_class(:action)
|
|
12
12
|
super do
|
13
13
|
codes :project_failure
|
14
14
|
|
15
|
-
register :path, :str, Dir.pwd
|
16
|
-
|
15
|
+
register :path, :str, Dir.pwd
|
17
16
|
project_config
|
17
|
+
|
18
|
+
config[:project_reference].default = ''
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
@@ -28,17 +29,10 @@ class Create < Nucleon.plugin_class(:action)
|
|
28
29
|
# Operations
|
29
30
|
|
30
31
|
def execute
|
31
|
-
super do
|
32
|
+
super do
|
32
33
|
info('nucleon.actions.create.start')
|
33
34
|
|
34
|
-
project
|
35
|
-
:create => true,
|
36
|
-
:directory => settings[:path],
|
37
|
-
:url => settings[:project_reference],
|
38
|
-
:revision => settings[:revision],
|
39
|
-
:pull => true
|
40
|
-
}), settings[:project_provider])
|
41
|
-
|
35
|
+
project = project_load(settings[:path], true, true)
|
42
36
|
myself.status = code.project_failure unless project
|
43
37
|
end
|
44
38
|
end
|
@@ -14,7 +14,8 @@ class Remove < Nucleon.plugin_class(:action)
|
|
14
14
|
codes :project_failure,
|
15
15
|
:delete_failure,
|
16
16
|
:push_failure
|
17
|
-
|
17
|
+
|
18
|
+
register :path, :str, Dir.pwd
|
18
19
|
register :sub_path, :str, nil
|
19
20
|
|
20
21
|
project_config
|
@@ -36,10 +37,10 @@ class Remove < Nucleon.plugin_class(:action)
|
|
36
37
|
# Operations
|
37
38
|
|
38
39
|
def execute
|
39
|
-
super do
|
40
|
+
super do
|
40
41
|
info('nucleon.actions.remove.start')
|
41
42
|
|
42
|
-
if project = project_load(
|
43
|
+
if project = project_load(settings[:path], false)
|
43
44
|
if project.delete_subproject(settings[:sub_path])
|
44
45
|
myself.status = code.push_failure unless push(project)
|
45
46
|
else
|