nucleon 0.1.19 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +1 -0
  4. data/TODO.rdoc +0 -3
  5. data/VERSION +1 -1
  6. data/bin/nucleon +19 -0
  7. data/lib/core/config.rb +11 -7
  8. data/lib/core/environment.rb +338 -0
  9. data/lib/core/facade.rb +150 -98
  10. data/lib/core/manager.rb +160 -249
  11. data/lib/core/mixin/action/project.rb +2 -2
  12. data/lib/core/mixin/macro/plugin_interface.rb +11 -11
  13. data/lib/core/plugin/action.rb +277 -24
  14. data/lib/core/plugin/base.rb +22 -14
  15. data/lib/core/plugin/command.rb +1 -1
  16. data/lib/core/plugin/event.rb +3 -3
  17. data/lib/core/plugin/extension.rb +1 -1
  18. data/lib/core/plugin/project.rb +15 -15
  19. data/lib/core/plugin/template.rb +1 -1
  20. data/lib/core/plugin/translator.rb +1 -1
  21. data/lib/core/util/cache.rb +1 -1
  22. data/lib/core/util/cli.rb +32 -3
  23. data/lib/core/util/console.rb +30 -10
  24. data/lib/core/util/data.rb +11 -3
  25. data/lib/core/util/logger.rb +1 -1
  26. data/lib/core/util/shell.rb +6 -3
  27. data/lib/core/util/ssh.rb +148 -24
  28. data/lib/nucleon/action/extract.rb +11 -4
  29. data/lib/nucleon/action/{add.rb → project/add.rb} +13 -4
  30. data/lib/nucleon/action/{create.rb → project/create.rb} +12 -3
  31. data/lib/nucleon/action/{remove.rb → project/remove.rb} +11 -2
  32. data/lib/nucleon/action/{save.rb → project/save.rb} +11 -2
  33. data/lib/nucleon/action/{update.rb → project/update.rb} +11 -2
  34. data/lib/nucleon/command/bash.rb +1 -1
  35. data/lib/nucleon/event/regex.rb +1 -1
  36. data/lib/nucleon/project/git.rb +3 -3
  37. data/lib/nucleon/template/{json.rb → JSON.rb} +1 -1
  38. data/lib/nucleon/template/{yaml.rb → YAML.rb} +1 -1
  39. data/lib/nucleon/template/wrapper.rb +1 -1
  40. data/lib/nucleon/translator/{json.rb → JSON.rb} +1 -1
  41. data/lib/nucleon/translator/{yaml.rb → YAML.rb} +1 -1
  42. data/lib/nucleon_base.rb +26 -15
  43. data/locales/en.yml +69 -44
  44. data/nucleon.gemspec +129 -11
  45. data/rdoc/site/0.1.19/ARCHITECTURE_rdoc.html +634 -0
  46. data/rdoc/site/0.1.19/Hash.html +347 -0
  47. data/rdoc/site/0.1.19/Kernel.html +413 -0
  48. data/rdoc/site/0.1.19/Nucleon.html +570 -0
  49. data/rdoc/site/0.1.19/Nucleon/Action.html +280 -0
  50. data/rdoc/site/0.1.19/Nucleon/Action/Add.html +458 -0
  51. data/rdoc/site/0.1.19/Nucleon/Action/Create.html +415 -0
  52. data/rdoc/site/0.1.19/Nucleon/Action/Extract.html +413 -0
  53. data/rdoc/site/0.1.19/Nucleon/Action/Remove.html +461 -0
  54. data/rdoc/site/0.1.19/Nucleon/Action/Save.html +434 -0
  55. data/rdoc/site/0.1.19/Nucleon/Action/Update.html +381 -0
  56. data/rdoc/site/0.1.19/Nucleon/Codes.html +563 -0
  57. data/rdoc/site/0.1.19/Nucleon/Command.html +275 -0
  58. data/rdoc/site/0.1.19/Nucleon/Command/Bash.html +544 -0
  59. data/rdoc/site/0.1.19/Nucleon/Config.html +1623 -0
  60. data/rdoc/site/0.1.19/Nucleon/Config/Collection.html +509 -0
  61. data/rdoc/site/0.1.19/Nucleon/Config/Options.html +489 -0
  62. data/rdoc/site/0.1.19/Nucleon/Core.html +635 -0
  63. data/rdoc/site/0.1.19/Nucleon/Errors.html +275 -0
  64. data/rdoc/site/0.1.19/Nucleon/Errors/BatchError.html +281 -0
  65. data/rdoc/site/0.1.19/Nucleon/Errors/NucleonError.html +657 -0
  66. data/rdoc/site/0.1.19/Nucleon/Errors/SSHUnavailable.html +281 -0
  67. data/rdoc/site/0.1.19/Nucleon/Event.html +275 -0
  68. data/rdoc/site/0.1.19/Nucleon/Event/Regex.html +467 -0
  69. data/rdoc/site/0.1.19/Nucleon/Facade.html +2336 -0
  70. data/rdoc/site/0.1.19/Nucleon/Gems.html +635 -0
  71. data/rdoc/site/0.1.19/Nucleon/Manager.html +1828 -0
  72. data/rdoc/site/0.1.19/Nucleon/Mixin.html +284 -0
  73. data/rdoc/site/0.1.19/Nucleon/Mixin/Action.html +277 -0
  74. data/rdoc/site/0.1.19/Nucleon/Mixin/Action/Commit.html +381 -0
  75. data/rdoc/site/0.1.19/Nucleon/Mixin/Action/Project.html +395 -0
  76. data/rdoc/site/0.1.19/Nucleon/Mixin/Action/Push.html +371 -0
  77. data/rdoc/site/0.1.19/Nucleon/Mixin/Colors.html +545 -0
  78. data/rdoc/site/0.1.19/Nucleon/Mixin/ConfigCollection.html +481 -0
  79. data/rdoc/site/0.1.19/Nucleon/Mixin/ConfigOptions.html +449 -0
  80. data/rdoc/site/0.1.19/Nucleon/Mixin/Macro.html +276 -0
  81. data/rdoc/site/0.1.19/Nucleon/Mixin/Macro/ObjectInterface.html +695 -0
  82. data/rdoc/site/0.1.19/Nucleon/Mixin/Macro/PluginInterface.html +682 -0
  83. data/rdoc/site/0.1.19/Nucleon/Mixin/Settings.html +481 -0
  84. data/rdoc/site/0.1.19/Nucleon/Mixin/SubConfig.html +887 -0
  85. data/rdoc/site/0.1.19/Nucleon/Parallel.html +325 -0
  86. data/rdoc/site/0.1.19/Nucleon/Parallel/ClassMethods.html +325 -0
  87. data/rdoc/site/0.1.19/Nucleon/Parallel/InstanceMethods.html +334 -0
  88. data/rdoc/site/0.1.19/Nucleon/Plugin.html +282 -0
  89. data/rdoc/site/0.1.19/Nucleon/Plugin/Action.html +1368 -0
  90. data/rdoc/site/0.1.19/Nucleon/Plugin/Action/Option.html +459 -0
  91. data/rdoc/site/0.1.19/Nucleon/Plugin/Base.html +1737 -0
  92. data/rdoc/site/0.1.19/Nucleon/Plugin/Command.html +721 -0
  93. data/rdoc/site/0.1.19/Nucleon/Plugin/Event.html +442 -0
  94. data/rdoc/site/0.1.19/Nucleon/Plugin/Extension.html +281 -0
  95. data/rdoc/site/0.1.19/Nucleon/Plugin/Project.html +2864 -0
  96. data/rdoc/site/0.1.19/Nucleon/Plugin/Template.html +476 -0
  97. data/rdoc/site/0.1.19/Nucleon/Plugin/Translator.html +371 -0
  98. data/rdoc/site/0.1.19/Nucleon/Project.html +276 -0
  99. data/rdoc/site/0.1.19/Nucleon/Project/Git.html +1801 -0
  100. data/rdoc/site/0.1.19/Nucleon/Project/Github.html +549 -0
  101. data/rdoc/site/0.1.19/Nucleon/Template.html +277 -0
  102. data/rdoc/site/0.1.19/Nucleon/Template/Json.html +329 -0
  103. data/rdoc/site/0.1.19/Nucleon/Template/Wrapper.html +329 -0
  104. data/rdoc/site/0.1.19/Nucleon/Template/Yaml.html +329 -0
  105. data/rdoc/site/0.1.19/Nucleon/Translator.html +276 -0
  106. data/rdoc/site/0.1.19/Nucleon/Translator/Json.html +366 -0
  107. data/rdoc/site/0.1.19/Nucleon/Translator/Yaml.html +366 -0
  108. data/rdoc/site/0.1.19/Nucleon/Util.html +285 -0
  109. data/rdoc/site/0.1.19/Nucleon/Util/CLI.html +388 -0
  110. data/rdoc/site/0.1.19/Nucleon/Util/CLI/Parser.html +1183 -0
  111. data/rdoc/site/0.1.19/Nucleon/Util/Cache.html +780 -0
  112. data/rdoc/site/0.1.19/Nucleon/Util/Console.html +1294 -0
  113. data/rdoc/site/0.1.19/Nucleon/Util/Data.html +1399 -0
  114. data/rdoc/site/0.1.19/Nucleon/Util/Disk.html +522 -0
  115. data/rdoc/site/0.1.19/Nucleon/Util/Git.html +361 -0
  116. data/rdoc/site/0.1.19/Nucleon/Util/Liquid.html +365 -0
  117. data/rdoc/site/0.1.19/Nucleon/Util/Logger.html +806 -0
  118. data/rdoc/site/0.1.19/Nucleon/Util/Package.html +558 -0
  119. data/rdoc/site/0.1.19/Nucleon/Util/SSH.html +910 -0
  120. data/rdoc/site/0.1.19/Nucleon/Util/SSH/Keypair.html +453 -0
  121. data/rdoc/site/0.1.19/Nucleon/Util/Shell.html +686 -0
  122. data/rdoc/site/0.1.19/Nucleon/Util/Shell/Result.html +497 -0
  123. data/rdoc/site/0.1.19/README_rdoc.html +312 -0
  124. data/rdoc/site/0.1.19/TODO_rdoc.html +267 -0
  125. data/rdoc/site/0.1.19/created.rid +60 -0
  126. data/rdoc/site/0.1.19/images/add.png +0 -0
  127. data/rdoc/site/0.1.19/images/brick.png +0 -0
  128. data/rdoc/site/0.1.19/images/brick_link.png +0 -0
  129. data/rdoc/site/0.1.19/images/bug.png +0 -0
  130. data/rdoc/site/0.1.19/images/bullet_black.png +0 -0
  131. data/rdoc/site/0.1.19/images/bullet_toggle_minus.png +0 -0
  132. data/rdoc/site/0.1.19/images/bullet_toggle_plus.png +0 -0
  133. data/rdoc/site/0.1.19/images/date.png +0 -0
  134. data/rdoc/site/0.1.19/images/delete.png +0 -0
  135. data/rdoc/site/0.1.19/images/find.png +0 -0
  136. data/rdoc/site/0.1.19/images/loadingAnimation.gif +0 -0
  137. data/rdoc/site/0.1.19/images/macFFBgHack.png +0 -0
  138. data/rdoc/site/0.1.19/images/package.png +0 -0
  139. data/rdoc/site/0.1.19/images/page_green.png +0 -0
  140. data/rdoc/site/0.1.19/images/page_white_text.png +0 -0
  141. data/rdoc/site/0.1.19/images/page_white_width.png +0 -0
  142. data/rdoc/site/0.1.19/images/plugin.png +0 -0
  143. data/rdoc/site/0.1.19/images/ruby.png +0 -0
  144. data/rdoc/site/0.1.19/images/tag_blue.png +0 -0
  145. data/rdoc/site/0.1.19/images/tag_green.png +0 -0
  146. data/rdoc/site/0.1.19/images/transparent.png +0 -0
  147. data/rdoc/site/0.1.19/images/wrench.png +0 -0
  148. data/rdoc/site/0.1.19/images/wrench_orange.png +0 -0
  149. data/rdoc/site/0.1.19/images/zoom.png +0 -0
  150. data/rdoc/site/0.1.19/index.html +311 -0
  151. data/rdoc/site/0.1.19/js/darkfish.js +155 -0
  152. data/rdoc/site/0.1.19/js/jquery.js +18 -0
  153. data/rdoc/site/0.1.19/js/navigation.js +142 -0
  154. data/rdoc/site/0.1.19/js/search.js +94 -0
  155. data/rdoc/site/0.1.19/js/search_index.js +1 -0
  156. data/rdoc/site/0.1.19/js/searcher.js +228 -0
  157. data/rdoc/site/0.1.19/rdoc.css +543 -0
  158. data/rdoc/site/0.1.19/table_of_contents.html +1541 -0
  159. metadata +140 -11
@@ -37,11 +37,11 @@ class Shell < Core
37
37
  #---
38
38
 
39
39
  def append_output(output_str)
40
- @output << output_str
40
+ @output << output_str.rstrip << "\n"
41
41
  end
42
42
 
43
43
  def append_errors(error_str)
44
- @errors << error_str
44
+ @errors << error_str.rstrip << "\n"
45
45
  end
46
46
  end
47
47
 
@@ -82,7 +82,7 @@ class Shell < Core
82
82
  system_result = Result.new(command)
83
83
 
84
84
  for i in tries.downto(1)
85
- logger.info(">> running: #{command}")
85
+ logger.info(">> running shell: #{command}")
86
86
 
87
87
  begin
88
88
  t1, output_new, output_orig, output_reader = pipe_exec_stream($stdout, conditions, {
@@ -111,6 +111,9 @@ class Shell < Core
111
111
  error_success = close_exec_pipe(t2, $stderr, error_orig, error_new, 'error')
112
112
  end
113
113
 
114
+ logger.warn("`#{command}` messages: #{system_result.errors}") if system_result.errors.length > 0
115
+ logger.warn("`#{command}` status: #{system_result.status}") unless system_result.status == 0
116
+
114
117
  success = ( system_success && output_success && error_success )
115
118
 
116
119
  min -= 1
@@ -28,19 +28,20 @@ class SSH < Core
28
28
 
29
29
  private_key = config.get(:private_key, nil)
30
30
  original_key = nil
31
- key_comment = config.get(:comment, '')
31
+ key_comment = config.get(:comment, '')
32
+ passphrase = config.get(:passphrase, nil)
33
+ force = config.get(:force, false)
32
34
 
33
35
  if private_key.nil?
34
36
  key_type = config.get(:type, "RSA")
35
37
  key_bits = config.get(:bits, 2048)
36
- passphrase = config.get(:passphrase, nil)
37
-
38
- key_data = SSHKey.generate(
38
+
39
+ key_data = SSHKey.generate({
39
40
  :type => key_type,
40
41
  :bits => key_bits,
41
42
  :comment => key_comment,
42
43
  :passphrase => passphrase
43
- )
44
+ })
44
45
  is_new = true
45
46
 
46
47
  else
@@ -50,12 +51,18 @@ class SSH < Core
50
51
  original_key = Disk.read(private_key)
51
52
  end
52
53
 
53
- key_data = SSHKey.new(original_key, :comment => key_comment) if original_key
54
- is_new = false
54
+ if original_key
55
+ encrypted = original_key.include?('ENCRYPTED')
56
+ key_data = SSHKey.new(original_key, {
57
+ :comment => key_comment,
58
+ :passphrase => passphrase
59
+ }) if force || ! encrypted || passphrase
60
+ end
61
+ is_new = false
55
62
  end
56
63
 
57
64
  return nil unless key_data && ! key_data.ssh_public_key.empty?
58
- Keypair.new(key_data, is_new, original_key)
65
+ Keypair.new(key_data, is_new, original_key, passphrase)
59
66
  end
60
67
 
61
68
  #-----------------------------------------------------------------------------
@@ -69,39 +76,69 @@ class SSH < Core
69
76
  # Keypair interface
70
77
 
71
78
  class Keypair
72
- attr_reader :type, :private_key, :encrypted_key, :public_key, :ssh_key
79
+ attr_reader :type, :private_key, :encrypted_key, :public_key, :ssh_key, :passphrase
80
+
81
+ #---
73
82
 
74
- def initialize(key_data, is_new, original_key)
83
+ def initialize(key_data, is_new, original_key, passphrase = nil)
75
84
  @type = key_data.type
76
85
  @private_key = key_data.private_key
77
86
  @encrypted_key = is_new ? key_data.encrypted_private_key : original_key
78
87
  @public_key = key_data.public_key
79
88
  @ssh_key = key_data.ssh_public_key
89
+ @passphrase = passphrase
90
+ end
91
+
92
+ #---
93
+
94
+ def private_key_file(key_path = nil, key_base = 'id')
95
+ key_path = SSH.key_path if key_path.nil?
96
+ key_name = render(key_base)
97
+
98
+ File.join(key_path, "#{key_name}")
99
+ end
100
+
101
+ def public_key_file(key_path = nil, key_base = 'id')
102
+ private_key_file(key_path, key_base) + '.pub'
80
103
  end
81
104
 
82
105
  #---
83
106
 
84
- def store(key_path = nil, key_base = 'id')
85
- key_path = SSH.key_path if key_path.nil?
86
- private_key_file = File.join(key_path, "#{key_base}_#{type.downcase}")
87
- public_key_file = File.join(key_path, "#{key_base}_#{type.downcase}.pub")
107
+ def store(key_path = nil, key_base = 'id', secure = true)
108
+ private_key_file = private_key_file(key_path, key_base)
109
+ public_key_file = public_key_file(key_path, key_base)
88
110
 
89
- private_success = Disk.write(private_key_file, encrypted_key)
111
+ if secure
112
+ private_success = Disk.write(private_key_file, encrypted_key)
113
+ else
114
+ private_success = Disk.write(private_key_file, private_key)
115
+ end
90
116
  FileUtils.chmod(0600, private_key_file) if private_success
91
117
 
92
- public_success = Disk.write(public_key_file, ssh_key)
118
+ public_success = Disk.write(public_key_file, ssh_key)
93
119
 
94
120
  if private_success && public_success
95
121
  return { :private_key => private_key_file, :public_key => public_key_file }
96
122
  end
97
123
  false
98
124
  end
125
+
126
+ #---
127
+
128
+ def render(key_base = 'id')
129
+ self.class.render(type, key_base)
130
+ end
131
+
132
+ def self.render(type, key_base = 'id')
133
+ "#{key_base}_#{type.downcase}"
134
+ end
99
135
  end
100
136
 
101
137
  #-----------------------------------------------------------------------------
102
138
  # SSH Execution interface
103
139
 
104
140
  @@sessions = {}
141
+ @@auth = {}
105
142
 
106
143
  #---
107
144
 
@@ -114,23 +151,38 @@ class SSH < Core
114
151
  def self.session(hostname, user, port = 22, private_key = nil, reset = false, options = {})
115
152
  require 'net/ssh'
116
153
 
154
+ session_id = session_id(hostname, user)
155
+ config = Config.ensure(options)
156
+
117
157
  ssh_options = Config.new({
118
158
  :user_known_hosts_file => [ File.join(key_path, 'known_hosts'), File.join(key_path, 'known_hosts2') ],
119
- :key_data => [],
120
- :keys_only => false,
121
159
  :auth_methods => [ 'publickey' ],
122
160
  :paranoid => :very
123
- }).import(options)
161
+ }).import(Util::Data.subset(config, config.keys - [ :keypair, :key_dir, :key_name ]))
124
162
 
125
- ssh_options[:port] = port
126
- ssh_options[:keys] = private_key.nil? ? [] : [ private_key ]
163
+ if private_key
164
+ auth_id = [ session_id, private_key ].join('_')
165
+
166
+ if ! @@auth[auth_id] && keypair = unlock_private_key(private_key, config)
167
+ @@auth[auth_id] = keypair
168
+ end
169
+ config[:keypair] = @@auth[auth_id] # Reset so caller can access updated keypair
170
+
171
+ if @@auth[auth_id].is_a?(String)
172
+ ssh_options[:keys_only] = false
173
+ ssh_options[:keys] = [ @@auth[auth_id] ]
174
+ else
175
+ ssh_options[:keys_only] = true
176
+ ssh_options[:key_data] = [ @@auth[auth_id].private_key ]
177
+ end
178
+ end
127
179
 
128
- session_id = session_id(hostname, user)
180
+ ssh_options[:port] = port
129
181
 
130
182
  if reset || ! @@sessions.has_key?(session_id)
131
183
  @@sessions[session_id] = Net::SSH.start(hostname, user, ssh_options.export)
132
184
  end
133
- yield(@@sessions[session_id]) if block_given? && @@sessions[session_id]
185
+ yield(@@sessions[session_id]) if block_given? && @@sessions[session_id]
134
186
  @@sessions[session_id]
135
187
  end
136
188
 
@@ -188,6 +240,8 @@ class SSH < Core
188
240
  command = command.flatten.join(' ') if command.is_a?(Array)
189
241
  command = command.to_s
190
242
  result = Shell::Result.new(command)
243
+
244
+ logger.info(">> running SSH: #{command}")
191
245
 
192
246
  ssh.open_channel do |ssh_channel|
193
247
  ssh_channel.request_pty
@@ -216,8 +270,11 @@ class SSH < Core
216
270
  end
217
271
  end
218
272
  end
219
- ssh.loop
273
+ logger.warn("`#{command}` messages: #{result.errors}") if result.errors.length > 0
274
+ logger.warn("`#{command}` status: #{result.status}") unless result.status == 0
275
+
220
276
  results << result
277
+ ssh.loop
221
278
  end
222
279
  end
223
280
  rescue Net::SSH::HostKeyMismatch => error
@@ -351,6 +408,73 @@ class SSH < Core
351
408
  process.wait
352
409
  process.exit_code
353
410
  end
411
+
412
+ #-----------------------------------------------------------------------------
413
+ # SSH utilities
414
+
415
+ def self.unlock_private_key(private_key, options = {})
416
+ require 'net/ssh'
417
+
418
+ config = Config.ensure(options)
419
+ keypair = config.get(:keypair, nil)
420
+ key_dir = config.get(:key_dir, nil)
421
+ key_name = config.get(:key_name, 'default')
422
+ no_file = ENV['NUCLEON_NO_SSH_KEY_SAVE']
423
+
424
+ password = nil
425
+ tmp_key_dir = nil
426
+
427
+ if private_key
428
+ keypair = nil if keypair && ! keypair.private_key
429
+
430
+ unless no_file
431
+ if key_dir && key_name && File.exists?(private_key) && loaded_private_key = Util::Disk.read(private_key)
432
+ FileUtils.mkdir_p(key_dir)
433
+
434
+ loaded_private_key =~ /BEGIN\s+([A-Z]+)\s+/
435
+
436
+ local_key_type = $1
437
+ local_key_name = Keypair.render(local_key_type, key_name)
438
+ local_key_path = File.join(key_dir, local_key_name)
439
+
440
+ keypair = generate({ :private_key => local_key_path }) if File.exists?(local_key_path)
441
+ end
442
+ end
443
+
444
+ unless keypair
445
+ key_manager_logger = ::Logger.new(STDERR)
446
+ key_manager_logger.level = ::Logger::FATAL
447
+ key_manager = Net::SSH::Authentication::KeyManager.new(key_manager_logger)
448
+
449
+ key_manager.each_identity do |identity|
450
+ if identity.comment == private_key
451
+ # Feed the key to the system password manager if it exists
452
+ keypair = private_key
453
+ end
454
+ end
455
+ key_manager.finish
456
+
457
+ until keypair
458
+ keypair = generate({
459
+ :private_key => private_key,
460
+ :passphrase => password
461
+ })
462
+ password = ui.ask("Enter passphrase for #{private_key}: ", { :echo => false }) unless keypair
463
+ end
464
+
465
+ unless no_file
466
+ if key_dir && key_name && ! keypair.is_a?(String)
467
+ key_files = keypair.store(key_dir, key_name, false)
468
+
469
+ if key_files && File.exists?(key_files[:private_key])
470
+ keypair = generate({ :private_key => key_files[:private_key] })
471
+ end
472
+ end
473
+ end
474
+ end
475
+ end
476
+ keypair
477
+ end
354
478
  end
355
479
  end
356
480
  end
@@ -1,8 +1,15 @@
1
1
 
2
2
  module Nucleon
3
3
  module Action
4
- class Extract < Nucleon.plugin_class(:action)
5
-
4
+ class Extract < Nucleon.plugin_class(:nucleon, :action)
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Info
8
+
9
+ def self.describe
10
+ super(nil, :extract, -50)
11
+ end
12
+
6
13
  #-----------------------------------------------------------------------------
7
14
  # Settings
8
15
 
@@ -12,7 +19,7 @@ class Extract < Nucleon.plugin_class(:action)
12
19
 
13
20
  register :path, :str, nil do |value|
14
21
  unless File.directory?(value)
15
- warn('nucleon.actions.extract.errors.path', { :value => value })
22
+ warn('nucleon.action.extract.errors.path', { :value => value })
16
23
  next false
17
24
  end
18
25
  true
@@ -20,7 +27,7 @@ class Extract < Nucleon.plugin_class(:action)
20
27
  register :encoded, :str, nil do |value|
21
28
  @package = Util::Package.new(value)
22
29
  if @package.data.export.empty?
23
- warn('nucleon.actions.extract.errors.encoded', { :value => value })
30
+ warn('nucleon.action.extract.errors.encoded', { :value => value })
24
31
  next false
25
32
  end
26
33
  true
@@ -1,10 +1,18 @@
1
1
 
2
2
  module Nucleon
3
3
  module Action
4
- class Add < Nucleon.plugin_class(:action)
4
+ module Project
5
+ class Add < Nucleon.plugin_class(:nucleon, :action)
5
6
 
6
7
  include Mixin::Action::Project
7
8
  include Mixin::Action::Push
9
+
10
+ #-----------------------------------------------------------------------------
11
+ # Info
12
+
13
+ def self.describe
14
+ super(:project, :add, 700)
15
+ end
8
16
 
9
17
  #-----------------------------------------------------------------------------
10
18
  # Settings
@@ -20,8 +28,8 @@ class Add < Nucleon.plugin_class(:action)
20
28
  register :sub_path, :str, nil
21
29
  register :sub_reference, :str, nil do |value|
22
30
  success = true
23
- if info = Nucleon.plugin_class(:project).translate_reference(value)
24
- if ! Nucleon.loaded_plugins(:project).keys.include?(info[:provider].to_sym)
31
+ if info = Nucleon.plugin_class(:nucleon, :project).translate_reference(value)
32
+ if ! Nucleon.loaded_plugins(:nucleon, :project).keys.include?(info[:provider].to_sym)
25
33
  warn('nucleon.core.mixin.action.project.errors.project_reference', {
26
34
  :value => value,
27
35
  :provider => info[:provider],
@@ -52,7 +60,7 @@ class Add < Nucleon.plugin_class(:action)
52
60
 
53
61
  def execute
54
62
  super do
55
- info('nucleon.actions.add.start')
63
+ info('nucleon.action.project.add.start')
56
64
 
57
65
  if project = project_load(settings[:path], false)
58
66
  sub_info = project.translate_reference(settings[:sub_reference], settings[:editable])
@@ -79,3 +87,4 @@ class Add < Nucleon.plugin_class(:action)
79
87
  end
80
88
  end
81
89
  end
90
+ end
@@ -1,10 +1,18 @@
1
1
 
2
2
  module Nucleon
3
3
  module Action
4
- class Create < Nucleon.plugin_class(:action)
4
+ module Project
5
+ class Create < Nucleon.plugin_class(:nucleon, :action)
5
6
 
6
7
  include Mixin::Action::Project
7
-
8
+
9
+ #-----------------------------------------------------------------------------
10
+ # Info
11
+
12
+ def self.describe
13
+ super(:project, :create, 1000)
14
+ end
15
+
8
16
  #-----------------------------------------------------------------------------
9
17
  # Settings
10
18
 
@@ -30,7 +38,7 @@ class Create < Nucleon.plugin_class(:action)
30
38
 
31
39
  def execute
32
40
  super do
33
- info('nucleon.actions.create.start')
41
+ info('nucleon.action.project.create.start')
34
42
 
35
43
  project = project_load(settings[:path], true, true)
36
44
  myself.status = code.project_failure unless project
@@ -39,3 +47,4 @@ class Create < Nucleon.plugin_class(:action)
39
47
  end
40
48
  end
41
49
  end
50
+ end
@@ -1,10 +1,18 @@
1
1
 
2
2
  module Nucleon
3
3
  module Action
4
- class Remove < Nucleon.plugin_class(:action)
4
+ module Project
5
+ class Remove < Nucleon.plugin_class(:nucleon, :action)
5
6
 
6
7
  include Mixin::Action::Project
7
8
  include Mixin::Action::Push
9
+
10
+ #-----------------------------------------------------------------------------
11
+ # Info
12
+
13
+ def self.describe
14
+ super(:project, :remove, 600)
15
+ end
8
16
 
9
17
  #-----------------------------------------------------------------------------
10
18
  # Settings
@@ -38,7 +46,7 @@ class Remove < Nucleon.plugin_class(:action)
38
46
 
39
47
  def execute
40
48
  super do
41
- info('nucleon.actions.remove.start')
49
+ info('nucleon.action.project.remove.start')
42
50
 
43
51
  if project = project_load(settings[:path], false)
44
52
  if project.delete_subproject(settings[:sub_path])
@@ -54,3 +62,4 @@ class Remove < Nucleon.plugin_class(:action)
54
62
  end
55
63
  end
56
64
  end
65
+ end
@@ -1,11 +1,19 @@
1
1
 
2
2
  module Nucleon
3
3
  module Action
4
- class Save < Nucleon.plugin_class(:action)
4
+ module Project
5
+ class Save < Nucleon.plugin_class(:nucleon, :action)
5
6
 
6
7
  include Mixin::Action::Project
7
8
  include Mixin::Action::Commit
8
9
  include Mixin::Action::Push
10
+
11
+ #-----------------------------------------------------------------------------
12
+ # Info
13
+
14
+ def self.describe
15
+ super(:project, :save, 800)
16
+ end
9
17
 
10
18
  #-----------------------------------------------------------------------------
11
19
  # Settings
@@ -36,7 +44,7 @@ class Save < Nucleon.plugin_class(:action)
36
44
 
37
45
  def execute
38
46
  super do
39
- info('nucleon.actions.save.start')
47
+ info('nucleon.action.project.save.start')
40
48
 
41
49
  if project = project_load(settings[:path], false, false)
42
50
  if commit(project, settings[:files])
@@ -52,3 +60,4 @@ class Save < Nucleon.plugin_class(:action)
52
60
  end
53
61
  end
54
62
  end
63
+ end