nucleon 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/core/config.rb +1 -1
- data/lib/core/core.rb +2 -2
- data/lib/core/environment.rb +9 -6
- data/lib/core/facade.rb +2 -2
- data/lib/core/gems.rb +13 -6
- data/lib/core/manager.rb +12 -5
- data/lib/core/mixin/action/commit.rb +12 -6
- data/lib/core/mixin/action/project.rb +15 -28
- data/lib/core/mixin/action/push.rb +14 -5
- data/lib/core/mixin/action/registration.rb +277 -28
- data/lib/core/mixin/macro/object_interface.rb +3 -3
- data/lib/core/mixin/sub_config.rb +1 -1
- data/lib/core/plugin/action.rb +20 -51
- data/lib/core/plugin/base.rb +41 -8
- data/lib/core/plugin/project.rb +55 -8
- data/lib/nucleon/action/project/add.rb +6 -20
- data/lib/nucleon/action/project/create.rb +2 -2
- data/lib/nucleon/action/project/remove.rb +3 -3
- data/lib/nucleon/action/project/save.rb +3 -3
- data/lib/nucleon/action/project/update.rb +2 -2
- data/lib/nucleon/extension/project.rb +16 -0
- data/lib/nucleon/project/git.rb +1 -0
- data/lib/nucleon/project/github.rb +19 -7
- data/nucleon.gemspec +120 -2
- data/rdoc/site/0.2.1/ARCHITECTURE_rdoc.html +640 -0
- data/rdoc/site/0.2.1/Hash.html +353 -0
- data/rdoc/site/0.2.1/Kernel.html +420 -0
- data/rdoc/site/0.2.1/Nucleon.html +674 -0
- data/rdoc/site/0.2.1/Nucleon/Action.html +286 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Extract.html +457 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project.html +285 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Add.html +502 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Create.html +459 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Remove.html +505 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Save.html +478 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Update.html +425 -0
- data/rdoc/site/0.2.1/Nucleon/Codes.html +569 -0
- data/rdoc/site/0.2.1/Nucleon/Command.html +281 -0
- data/rdoc/site/0.2.1/Nucleon/Command/Bash.html +550 -0
- data/rdoc/site/0.2.1/Nucleon/Config.html +1634 -0
- data/rdoc/site/0.2.1/Nucleon/Config/Collection.html +515 -0
- data/rdoc/site/0.2.1/Nucleon/Config/Options.html +495 -0
- data/rdoc/site/0.2.1/Nucleon/Core.html +641 -0
- data/rdoc/site/0.2.1/Nucleon/Environment.html +1210 -0
- data/rdoc/site/0.2.1/Nucleon/Errors.html +281 -0
- data/rdoc/site/0.2.1/Nucleon/Errors/BatchError.html +287 -0
- data/rdoc/site/0.2.1/Nucleon/Errors/NucleonError.html +663 -0
- data/rdoc/site/0.2.1/Nucleon/Errors/SSHUnavailable.html +287 -0
- data/rdoc/site/0.2.1/Nucleon/Event.html +281 -0
- data/rdoc/site/0.2.1/Nucleon/Event/Regex.html +473 -0
- data/rdoc/site/0.2.1/Nucleon/Facade.html +2452 -0
- data/rdoc/site/0.2.1/Nucleon/Gems.html +641 -0
- data/rdoc/site/0.2.1/Nucleon/Manager.html +1862 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin.html +291 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action.html +284 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Commit.html +387 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Project.html +401 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Push.html +377 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Registration.html +575 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Colors.html +551 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigCollection.html +487 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigOptions.html +455 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Macro.html +282 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/ObjectInterface.html +701 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/PluginInterface.html +688 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Settings.html +487 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/SubConfig.html +893 -0
- data/rdoc/site/0.2.1/Nucleon/Parallel.html +332 -0
- data/rdoc/site/0.2.1/Nucleon/Parallel/ClassMethods.html +331 -0
- data/rdoc/site/0.2.1/Nucleon/Parallel/InstanceMethods.html +458 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin.html +288 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Action.html +2133 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Action/Option.html +465 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Base.html +1988 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Command.html +765 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Event.html +448 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Extension.html +287 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Project.html +2900 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Template.html +482 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Translator.html +377 -0
- data/rdoc/site/0.2.1/Nucleon/Project.html +282 -0
- data/rdoc/site/0.2.1/Nucleon/Project/Git.html +1807 -0
- data/rdoc/site/0.2.1/Nucleon/Project/Github.html +555 -0
- data/rdoc/site/0.2.1/Nucleon/Template.html +283 -0
- data/rdoc/site/0.2.1/Nucleon/Template/JSON.html +335 -0
- data/rdoc/site/0.2.1/Nucleon/Template/Wrapper.html +335 -0
- data/rdoc/site/0.2.1/Nucleon/Template/YAML.html +335 -0
- data/rdoc/site/0.2.1/Nucleon/Translator.html +282 -0
- data/rdoc/site/0.2.1/Nucleon/Translator/JSON.html +372 -0
- data/rdoc/site/0.2.1/Nucleon/Translator/YAML.html +372 -0
- data/rdoc/site/0.2.1/Nucleon/Util.html +291 -0
- data/rdoc/site/0.2.1/Nucleon/Util/CLI.html +394 -0
- data/rdoc/site/0.2.1/Nucleon/Util/CLI/Parser.html +1404 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Cache.html +824 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Console.html +1330 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Data.html +1423 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Disk.html +528 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Git.html +367 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Liquid.html +371 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Logger.html +822 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Package.html +564 -0
- data/rdoc/site/0.2.1/Nucleon/Util/SSH.html +1036 -0
- data/rdoc/site/0.2.1/Nucleon/Util/SSH/Keypair.html +607 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Shell.html +697 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Shell/Result.html +503 -0
- data/rdoc/site/0.2.1/README_rdoc.html +318 -0
- data/rdoc/site/0.2.1/TODO_rdoc.html +267 -0
- data/rdoc/site/0.2.1/created.rid +62 -0
- data/rdoc/site/0.2.1/images/add.png +0 -0
- data/rdoc/site/0.2.1/images/brick.png +0 -0
- data/rdoc/site/0.2.1/images/brick_link.png +0 -0
- data/rdoc/site/0.2.1/images/bug.png +0 -0
- data/rdoc/site/0.2.1/images/bullet_black.png +0 -0
- data/rdoc/site/0.2.1/images/bullet_toggle_minus.png +0 -0
- data/rdoc/site/0.2.1/images/bullet_toggle_plus.png +0 -0
- data/rdoc/site/0.2.1/images/date.png +0 -0
- data/rdoc/site/0.2.1/images/delete.png +0 -0
- data/rdoc/site/0.2.1/images/find.png +0 -0
- data/rdoc/site/0.2.1/images/loadingAnimation.gif +0 -0
- data/rdoc/site/0.2.1/images/macFFBgHack.png +0 -0
- data/rdoc/site/0.2.1/images/package.png +0 -0
- data/rdoc/site/0.2.1/images/page_green.png +0 -0
- data/rdoc/site/0.2.1/images/page_white_text.png +0 -0
- data/rdoc/site/0.2.1/images/page_white_width.png +0 -0
- data/rdoc/site/0.2.1/images/plugin.png +0 -0
- data/rdoc/site/0.2.1/images/ruby.png +0 -0
- data/rdoc/site/0.2.1/images/tag_blue.png +0 -0
- data/rdoc/site/0.2.1/images/tag_green.png +0 -0
- data/rdoc/site/0.2.1/images/transparent.png +0 -0
- data/rdoc/site/0.2.1/images/wrench.png +0 -0
- data/rdoc/site/0.2.1/images/wrench_orange.png +0 -0
- data/rdoc/site/0.2.1/images/zoom.png +0 -0
- data/rdoc/site/0.2.1/index.html +317 -0
- data/rdoc/site/0.2.1/js/darkfish.js +155 -0
- data/rdoc/site/0.2.1/js/jquery.js +18 -0
- data/rdoc/site/0.2.1/js/navigation.js +142 -0
- data/rdoc/site/0.2.1/js/search.js +94 -0
- data/rdoc/site/0.2.1/js/search_index.js +1 -0
- data/rdoc/site/0.2.1/js/searcher.js +228 -0
- data/rdoc/site/0.2.1/rdoc.css +543 -0
- data/rdoc/site/0.2.1/table_of_contents.html +1718 -0
- metadata +120 -2
@@ -291,11 +291,11 @@ module ObjectInterface
|
|
291
291
|
if group_options.has_key?(:settings)
|
292
292
|
group_options = add_settings.call(group_options, group_options[:settings])
|
293
293
|
end
|
294
|
-
local_options = Util::Data.merge([ local_options, group_options ], true)
|
294
|
+
local_options = Util::Data.merge([ local_options, group_options ], true, false)
|
295
295
|
end
|
296
296
|
end
|
297
297
|
unless local_options.empty?
|
298
|
-
final_options = Util::Data.merge([ local_options, final_options ], true)
|
298
|
+
final_options = Util::Data.merge([ local_options, final_options ], true, false)
|
299
299
|
end
|
300
300
|
end
|
301
301
|
final_options
|
@@ -332,7 +332,7 @@ module ObjectInterface
|
|
332
332
|
final_config = Config.new(Util::Data.merge([
|
333
333
|
Util::Data.clean(settings),
|
334
334
|
Util::Data.clean(obj_config.export)
|
335
|
-
], true))
|
335
|
+
], true, false))
|
336
336
|
value = final_config.get(keys)
|
337
337
|
|
338
338
|
logger.debug("Final configuration: #{final_config.export.inspect}")
|
data/lib/core/plugin/action.rb
CHANGED
@@ -5,6 +5,8 @@ class Action < Nucleon.plugin_class(:nucleon, :base)
|
|
5
5
|
|
6
6
|
extend Mixin::Colors
|
7
7
|
|
8
|
+
include Mixin::Action::Registration
|
9
|
+
|
8
10
|
#-----------------------------------------------------------------------------
|
9
11
|
# Info
|
10
12
|
|
@@ -12,14 +14,20 @@ class Action < Nucleon.plugin_class(:nucleon, :base)
|
|
12
14
|
describe_base(group, action, weight, description, help)
|
13
15
|
end
|
14
16
|
|
15
|
-
def self.describe_base(group = nil, action = 'unknown', weight = -1000, description = nil, help = nil)
|
16
|
-
if
|
17
|
-
|
18
|
-
description_id
|
19
|
-
help_id
|
17
|
+
def self.describe_base(group = nil, action = 'unknown', weight = -1000, description = nil, help = nil, provider_override = nil)
|
18
|
+
if provider_override
|
19
|
+
provider_override = provider_override.to_s.gsub('_', '.')
|
20
|
+
description_id = "#{namespace}.action.#{provider_override}.description"
|
21
|
+
help_id = "#{namespace}.action.#{provider_override}.help"
|
20
22
|
else
|
21
|
-
|
22
|
-
|
23
|
+
if group
|
24
|
+
group_name = Util::Data.array(group).join('.')
|
25
|
+
description_id = "#{namespace}.action.#{group_name}.#{action}.description"
|
26
|
+
help_id = "#{namespace}.action.#{group_name}.#{action}.help"
|
27
|
+
else
|
28
|
+
description_id = "#{namespace}.action.#{action}.description"
|
29
|
+
help_id = "#{namespace}.action.#{action}.help"
|
30
|
+
end
|
23
31
|
end
|
24
32
|
|
25
33
|
{
|
@@ -207,28 +215,6 @@ class Action < Nucleon.plugin_class(:nucleon, :base)
|
|
207
215
|
|
208
216
|
#---
|
209
217
|
|
210
|
-
def register_bool(name, default = false, locale = nil, &code)
|
211
|
-
register(name, :bool, default, locale, &code)
|
212
|
-
end
|
213
|
-
|
214
|
-
def register_int(name, default = nil, locale = nil, &code)
|
215
|
-
register(name, :int, default, locale, &code)
|
216
|
-
end
|
217
|
-
|
218
|
-
def register_float(name, default = nil, locale = nil, &code)
|
219
|
-
register(name, :float, default, locale, &code)
|
220
|
-
end
|
221
|
-
|
222
|
-
def register_str(name, default = '', locale = nil, &code)
|
223
|
-
register(name, :str, default, locale, &code)
|
224
|
-
end
|
225
|
-
|
226
|
-
def register_array(name, default = [], locale = nil, &code)
|
227
|
-
register(name, :array, default, locale, &code)
|
228
|
-
end
|
229
|
-
|
230
|
-
#---
|
231
|
-
|
232
218
|
def remove(names)
|
233
219
|
Util::Data.rm_keys(config, names)
|
234
220
|
Util::Data.rm_keys(settings, names)
|
@@ -318,7 +304,7 @@ class Action < Nucleon.plugin_class(:nucleon, :base)
|
|
318
304
|
|
319
305
|
help_text = ''
|
320
306
|
action_info[:description][:help].split("\n").each do |line|
|
321
|
-
help_text << ' ' + line + "\n"
|
307
|
+
help_text << ' ' + green(line) + "\n"
|
322
308
|
end
|
323
309
|
|
324
310
|
@parser = Util::CLI::Parser.new(args, usage, "\n#{help_text}\n") do |parser|
|
@@ -479,30 +465,13 @@ class Action < Nucleon.plugin_class(:nucleon, :base)
|
|
479
465
|
# Output
|
480
466
|
|
481
467
|
def render_options
|
482
|
-
|
468
|
+
options = super
|
469
|
+
options.merge(settings.export)
|
483
470
|
end
|
484
471
|
|
485
472
|
#-----------------------------------------------------------------------------
|
486
473
|
# Utilities
|
487
|
-
|
488
|
-
def validate_plugins(namespace, type, name, values)
|
489
|
-
plugin_class = Nucleon.plugin_class(namespace, type)
|
490
|
-
loaded_plugins = Nucleon.loaded_plugins(namespace, type)
|
491
|
-
success = true
|
492
|
-
|
493
|
-
array(values).each do |value|
|
494
|
-
if info = plugin_class.translate_reference(value)
|
495
|
-
if ! loaded_plugins.keys.include?(info[:provider].to_sym)
|
496
|
-
warn("corl.action.#{plugin_name.to_s.gsub('_', '.')}.errors.#{name}", Util::Data.merge([ info, { :value => value } ]))
|
497
|
-
success = false
|
498
|
-
end
|
499
|
-
end
|
500
|
-
end
|
501
|
-
success
|
502
|
-
end
|
503
|
-
|
504
|
-
#---
|
505
|
-
|
474
|
+
|
506
475
|
def self.components(search)
|
507
476
|
components = []
|
508
477
|
|
@@ -668,7 +637,7 @@ class Action < Nucleon.plugin_class(:nucleon, :base)
|
|
668
637
|
namespace = info[:description][:namespace]
|
669
638
|
group = info[:description][:group]
|
670
639
|
|
671
|
-
group_id = group.is_a?(Array) ? group.flatten.join('::') : group
|
640
|
+
group_id = group.is_a?(Array) ? group.flatten.join('::') : group.to_s
|
672
641
|
group_id = '' unless group_id
|
673
642
|
|
674
643
|
output << "\n" if group_id != last_group
|
data/lib/core/plugin/base.rb
CHANGED
@@ -20,7 +20,7 @@ class Base < Core
|
|
20
20
|
set_meta(config.delete(:meta, Config.new))
|
21
21
|
|
22
22
|
# No logging statements above this line!!
|
23
|
-
super(config.import({ :logger => "#{namespace}->#{plugin_type}->#{plugin_provider}" }), {}, true, false)
|
23
|
+
super(config.import({ :logger => "#{namespace}->#{plugin_type}->#{plugin_provider}" }), {}, true, false, false)
|
24
24
|
myself.plugin_name = name
|
25
25
|
|
26
26
|
logger.debug("Normalizing #{namespace} #{plugin_type} plugin #{plugin_name}")
|
@@ -219,18 +219,44 @@ class Base < Core
|
|
219
219
|
#-----------------------------------------------------------------------------
|
220
220
|
# Output
|
221
221
|
|
222
|
+
def render_provider
|
223
|
+
plugin_provider
|
224
|
+
end
|
225
|
+
protected :render_provider
|
226
|
+
|
227
|
+
#---
|
228
|
+
|
222
229
|
def render_options
|
223
|
-
export
|
230
|
+
export.merge({
|
231
|
+
:plugin_namespace => self.class.respond_to?(:namespace) ? self.class.namespace : plugin_namespace,
|
232
|
+
:plugin_type => plugin_type,
|
233
|
+
:plugin_provider => render_provider
|
234
|
+
})
|
224
235
|
end
|
225
236
|
protected :render_options
|
226
237
|
|
227
238
|
#---
|
228
239
|
|
229
240
|
def render_message(message, options = {})
|
230
|
-
config
|
241
|
+
config = Config.ensure(options)
|
242
|
+
use_prefix = true
|
231
243
|
|
232
244
|
if config.delete(:i18n, true)
|
233
|
-
|
245
|
+
Nucleon.namespaces.each do |namespace|
|
246
|
+
if message =~ /^#{namespace.to_s.downcase}\./
|
247
|
+
use_prefix = false
|
248
|
+
break
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
if use_prefix
|
253
|
+
plugin_namespace = self.class.namespace if self.class.respond_to?(:namespace)
|
254
|
+
operation_id = config.has_key?(:operation) ? config[:operation] : ''
|
255
|
+
prefix = "#{plugin_namespace}.#{plugin_type}.#{render_provider.to_s.gsub('_', '.')}."
|
256
|
+
|
257
|
+
message = prefix + ( operation_id.empty? ? '' : "#{operation_id}." ) + message.sub(/^#{prefix}/, '')
|
258
|
+
end
|
259
|
+
message = I18n.t(message, Util::Data.merge([ Config.ensure(render_options).export, config.export ], true))
|
234
260
|
end
|
235
261
|
message
|
236
262
|
end
|
@@ -254,7 +280,7 @@ class Base < Core
|
|
254
280
|
#---
|
255
281
|
|
256
282
|
def info(message, options = {})
|
257
|
-
config = Config.
|
283
|
+
config = Config.new(options).import({ :operation => :info })
|
258
284
|
|
259
285
|
unless quiet?
|
260
286
|
message = render_message(message, config)
|
@@ -266,7 +292,7 @@ class Base < Core
|
|
266
292
|
#---
|
267
293
|
|
268
294
|
def warn(message, options = {})
|
269
|
-
config = Config.
|
295
|
+
config = Config.new(options).import({ :operation => :warn })
|
270
296
|
|
271
297
|
unless quiet?
|
272
298
|
message = render_message(message, config)
|
@@ -278,7 +304,7 @@ class Base < Core
|
|
278
304
|
#---
|
279
305
|
|
280
306
|
def error(message, options = {})
|
281
|
-
config = Config.
|
307
|
+
config = Config.new(options).import({ :operation => :error })
|
282
308
|
|
283
309
|
unless quiet?
|
284
310
|
message = render_message(message, config)
|
@@ -290,7 +316,7 @@ class Base < Core
|
|
290
316
|
#---
|
291
317
|
|
292
318
|
def success(message, options = {})
|
293
|
-
config = Config.
|
319
|
+
config = Config.new(options).import({ :operation => :success })
|
294
320
|
|
295
321
|
unless quiet?
|
296
322
|
message = render_message(message, config)
|
@@ -299,6 +325,13 @@ class Base < Core
|
|
299
325
|
message
|
300
326
|
end
|
301
327
|
|
328
|
+
#---
|
329
|
+
|
330
|
+
def prefixed_message(type, prefix, message, options = {})
|
331
|
+
return unless [ :info, :warn, :error, :success ].include?(type.to_sym)
|
332
|
+
send(type, prefix.to_s + render_message(message, Config.new(options).import({ :prefix => false, :operation => type.to_sym }).export), Config.new(options).import({ :i18n => false }).export)
|
333
|
+
end
|
334
|
+
|
302
335
|
#-----------------------------------------------------------------------------
|
303
336
|
# Utilities
|
304
337
|
|
data/lib/core/plugin/project.rb
CHANGED
@@ -45,7 +45,9 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
45
45
|
def normalize(reload)
|
46
46
|
super
|
47
47
|
|
48
|
-
|
48
|
+
directory = Util::Disk.filename(get(:directory, Dir.pwd))
|
49
|
+
|
50
|
+
set_directory(directory)
|
49
51
|
register
|
50
52
|
|
51
53
|
set_url(get(:url)) if get(:url, false)
|
@@ -70,6 +72,10 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
70
72
|
unless reload
|
71
73
|
@cache = Util::Cache.new(directory, Nucleon.sha1(plugin_name), '.project_cache')
|
72
74
|
init_cache
|
75
|
+
|
76
|
+
unless self.class.load_provider(directory)
|
77
|
+
self.class.store_provider(directory, plugin_provider)
|
78
|
+
end
|
73
79
|
end
|
74
80
|
end
|
75
81
|
|
@@ -177,7 +183,7 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
177
183
|
#---
|
178
184
|
|
179
185
|
def set_url(url)
|
180
|
-
if url && url = extension_set(:set_url, url.strip)
|
186
|
+
if url && url = extension_set(:set_url, url.strip)
|
181
187
|
logger.info("Setting project #{name} url to #{url}")
|
182
188
|
|
183
189
|
set(:url, url)
|
@@ -326,7 +332,7 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
326
332
|
# Project operations
|
327
333
|
|
328
334
|
def init_cache
|
329
|
-
|
335
|
+
ignore(self.class.state_file)
|
330
336
|
end
|
331
337
|
protected :init_cache
|
332
338
|
|
@@ -806,11 +812,12 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
806
812
|
|
807
813
|
def push(remote = :edit, options = {})
|
808
814
|
config = Config.ensure(options).import({ :remote => remote })
|
815
|
+
no_pull = config.delete(:no_pull, false)
|
809
816
|
success = false
|
810
817
|
|
811
818
|
push_project = lambda do |push_remote|
|
812
819
|
logger.info("Pushing to #{push_remote} from #{directory}")
|
813
|
-
success = yield(config, push_remote) if block_given? && pull(push_remote, config)
|
820
|
+
success = yield(config, push_remote) if block_given? && ( no_pull || pull(push_remote, config) )
|
814
821
|
end
|
815
822
|
|
816
823
|
if can_persist?
|
@@ -870,7 +877,46 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
870
877
|
end
|
871
878
|
success
|
872
879
|
end
|
873
|
-
|
880
|
+
|
881
|
+
#-----------------------------------------------------------------------------
|
882
|
+
# State configurations
|
883
|
+
|
884
|
+
def self.state_file
|
885
|
+
'.corl'
|
886
|
+
end
|
887
|
+
|
888
|
+
#---
|
889
|
+
|
890
|
+
@@project_data = {}
|
891
|
+
|
892
|
+
def self.store_provider(directory, provider)
|
893
|
+
if File.directory?(directory)
|
894
|
+
@@project_data[directory] = {
|
895
|
+
:provider => provider
|
896
|
+
}
|
897
|
+
json_data = Util::Data.to_json(@@project_data[directory], true)
|
898
|
+
Util::Disk.write(File.join(directory, state_file), json_data)
|
899
|
+
end
|
900
|
+
end
|
901
|
+
|
902
|
+
#---
|
903
|
+
|
904
|
+
def self.clear_provider(directory)
|
905
|
+
@@project_data.delete(directory)
|
906
|
+
end
|
907
|
+
|
908
|
+
#---
|
909
|
+
|
910
|
+
def self.load_provider(directory, override = nil)
|
911
|
+
@@project_data[directory] = {} unless @@project_data.has_key?(directory)
|
912
|
+
|
913
|
+
if override.nil? && @@project_data[directory].empty?
|
914
|
+
json_data = Util::Disk.read(File.join(directory, state_file))
|
915
|
+
@@project_data[directory] = hash(Util::Data.parse_json(json_data)) if json_data
|
916
|
+
end
|
917
|
+
override.nil? ? symbol_map(@@project_data[directory])[:provider] : override
|
918
|
+
end
|
919
|
+
|
874
920
|
#-----------------------------------------------------------------------------
|
875
921
|
# Utilities
|
876
922
|
|
@@ -893,9 +939,10 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
893
939
|
|
894
940
|
if options.has_key?(:url)
|
895
941
|
if matches = translate_reference(options[:url])
|
896
|
-
options[:provider]
|
897
|
-
options[:
|
898
|
-
options[:
|
942
|
+
options[:provider] = matches[:provider]
|
943
|
+
options[:reference] = matches[:reference]
|
944
|
+
options[:url] = matches[:url]
|
945
|
+
options[:revision] = matches[:revision] unless options.has_key?(:revision)
|
899
946
|
|
900
947
|
logger.debug("Translating project options: #{options.inspect}")
|
901
948
|
end
|
@@ -23,26 +23,12 @@ class Add < Nucleon.plugin_class(:nucleon, :action)
|
|
23
23
|
:add_failure,
|
24
24
|
:push_failure
|
25
25
|
|
26
|
-
|
26
|
+
register_str :path, Dir.pwd
|
27
|
+
register_str :sub_path, nil
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
if info = Nucleon.plugin_class(:nucleon, :project).translate_reference(value)
|
32
|
-
if ! Nucleon.loaded_plugins(:nucleon, :project).keys.include?(info[:provider].to_sym)
|
33
|
-
warn('nucleon.core.mixin.action.project.errors.project_reference', {
|
34
|
-
:value => value,
|
35
|
-
:provider => info[:provider],
|
36
|
-
:reference => info[:reference],
|
37
|
-
:url => info[:url],
|
38
|
-
:revision => info[:revision]
|
39
|
-
})
|
40
|
-
success = false
|
41
|
-
end
|
42
|
-
end
|
43
|
-
success
|
44
|
-
end
|
45
|
-
register :editable, :bool, false
|
29
|
+
register_project :sub_reference, nil
|
30
|
+
|
31
|
+
register_bool :editable
|
46
32
|
|
47
33
|
project_config
|
48
34
|
push_config
|
@@ -60,7 +46,7 @@ class Add < Nucleon.plugin_class(:nucleon, :action)
|
|
60
46
|
|
61
47
|
def execute
|
62
48
|
super do
|
63
|
-
info('
|
49
|
+
info('start')
|
64
50
|
|
65
51
|
if project = project_load(settings[:path], false)
|
66
52
|
sub_info = project.translate_reference(settings[:sub_reference], settings[:editable])
|
@@ -20,7 +20,7 @@ class Create < Nucleon.plugin_class(:nucleon, :action)
|
|
20
20
|
super do
|
21
21
|
codes :project_failure
|
22
22
|
|
23
|
-
|
23
|
+
register_str :path, Dir.pwd
|
24
24
|
project_config
|
25
25
|
|
26
26
|
config[:project_reference].default = ''
|
@@ -38,7 +38,7 @@ class Create < Nucleon.plugin_class(:nucleon, :action)
|
|
38
38
|
|
39
39
|
def execute
|
40
40
|
super do
|
41
|
-
info('
|
41
|
+
info('start')
|
42
42
|
|
43
43
|
project = project_load(settings[:path], true, true)
|
44
44
|
myself.status = code.project_failure unless project
|
@@ -23,8 +23,8 @@ class Remove < Nucleon.plugin_class(:nucleon, :action)
|
|
23
23
|
:delete_failure,
|
24
24
|
:push_failure
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
register_str :path, Dir.pwd
|
27
|
+
register_str :sub_path, nil
|
28
28
|
|
29
29
|
project_config
|
30
30
|
push_config
|
@@ -46,7 +46,7 @@ class Remove < Nucleon.plugin_class(:nucleon, :action)
|
|
46
46
|
|
47
47
|
def execute
|
48
48
|
super do
|
49
|
-
info('
|
49
|
+
info('start')
|
50
50
|
|
51
51
|
if project = project_load(settings[:path], false)
|
52
52
|
if project.delete_subproject(settings[:sub_path])
|
@@ -24,8 +24,8 @@ class Save < Nucleon.plugin_class(:nucleon, :action)
|
|
24
24
|
:commit_failure,
|
25
25
|
:push_failure
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
register_str :path, Dir.pwd
|
28
|
+
register_files :files, '.'
|
29
29
|
|
30
30
|
project_config
|
31
31
|
commit_config(false)
|
@@ -44,7 +44,7 @@ class Save < Nucleon.plugin_class(:nucleon, :action)
|
|
44
44
|
|
45
45
|
def execute
|
46
46
|
super do
|
47
|
-
info('
|
47
|
+
info('start')
|
48
48
|
|
49
49
|
if project = project_load(settings[:path], false, false)
|
50
50
|
if commit(project, settings[:files])
|