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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00f9bc86d6b7cc661e86f2f8d68122deeba3c4b8
|
4
|
+
data.tar.gz: f2e4efb4452af26d9a01f61ef7403e0b20cfe176
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9d8f921ecd37fec93616291b3c209296ee4411e11d87a83e51b193c934d42d65abc47cd96e4b633bc5bd615131c77a33935d9987fa6de704ba3a885e28461f5
|
7
|
+
data.tar.gz: cd68ddf0980de41c10ba359af9a43fbb929217c8ed12b3e7b4c10595f9b23101072e7f7d0f171b5665c30bc7173344245e283e332858e0306ec76e94bdc2c26a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/lib/core/config.rb
CHANGED
data/lib/core/core.rb
CHANGED
@@ -14,8 +14,8 @@ class Core < Config
|
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Constructor / Destructor
|
16
16
|
|
17
|
-
def initialize(data = {}, defaults = {}, force = true, set_initialized = true)
|
18
|
-
super(data, defaults, force)
|
17
|
+
def initialize(data = {}, defaults = {}, force = true, set_initialized = true, basic_merge = true)
|
18
|
+
super(data, defaults, force, basic_merge)
|
19
19
|
|
20
20
|
@class_color = Util::Data.ensure_value(delete(:class_color, :cyan), :cyan)
|
21
21
|
@class_label = self.class.to_s.downcase.gsub(/^nucleon::/, '')
|
data/lib/core/environment.rb
CHANGED
@@ -81,6 +81,7 @@ class Environment
|
|
81
81
|
data = {
|
82
82
|
:namespace => namespace,
|
83
83
|
:type => plugin_type,
|
84
|
+
:base_path => base_path,
|
84
85
|
:file => file,
|
85
86
|
:provider => plugin_info[:provider],
|
86
87
|
:directory => plugin_info[:directory],
|
@@ -160,21 +161,23 @@ class Environment
|
|
160
161
|
namespace = namespace.to_sym
|
161
162
|
plugin_type = sanitize_id(plugin_type)
|
162
163
|
provider = sanitize_id(provider)
|
163
|
-
|
164
|
+
|
164
165
|
unless plugin_type_defined?(namespace, plugin_type)
|
165
166
|
return nil
|
166
167
|
end
|
167
168
|
|
168
169
|
if type_info = loaded_plugin(namespace, plugin_type, provider)
|
169
|
-
ids
|
170
|
-
|
171
|
-
|
172
|
-
instance_name = "#{provider}_" + Nucleon.sha1(instance_options)
|
170
|
+
ids = Util::Data.array(type_info[:class].register_ids).flatten
|
171
|
+
instance_config = Config.new(options)
|
172
|
+
ensure_new = instance_config.delete(:new, false)
|
173
173
|
|
174
|
+
instance_options = Util::Data.subset(instance_config.export, ids, true)
|
175
|
+
instance_name = "#{provider}_" + Nucleon.sha1(instance_options)
|
176
|
+
|
174
177
|
@active_info[namespace] = {} unless @active_info.has_key?(namespace)
|
175
178
|
@active_info[namespace][plugin_type] = {} unless @active_info[namespace].has_key?(plugin_type)
|
176
179
|
|
177
|
-
|
180
|
+
if ensure_new || ! ( instance_name && @active_info[namespace][plugin_type].has_key?(instance_name) )
|
178
181
|
type_info[:instance_name] = instance_name
|
179
182
|
|
180
183
|
options = code.call(type_info, options) if code
|
data/lib/core/facade.rb
CHANGED
@@ -236,8 +236,8 @@ module Facade
|
|
236
236
|
#-----------------------------------------------------------------------------
|
237
237
|
# Core plugin interface
|
238
238
|
|
239
|
-
def reload(core = false, &code)
|
240
|
-
Manager.connection.reload(core, &code)
|
239
|
+
def reload(core = false, loaded = [], &code)
|
240
|
+
Manager.connection.reload(core, loaded, &code)
|
241
241
|
end
|
242
242
|
|
243
243
|
#---
|
data/lib/core/gems.rb
CHANGED
@@ -28,12 +28,12 @@ module Gems
|
|
28
28
|
|
29
29
|
#---
|
30
30
|
|
31
|
-
def self.register(reset = false)
|
31
|
+
def self.register(reset = false, loaded = [])
|
32
32
|
if reset || Util::Data.empty?(@@gems)
|
33
33
|
logger.info("Registering external gem defined Nucleon plugins at #{Time.now}")
|
34
34
|
|
35
35
|
each_gem do |spec|
|
36
|
-
register_gem(spec)
|
36
|
+
register_gem(spec, loaded)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
@@gems
|
@@ -41,7 +41,7 @@ module Gems
|
|
41
41
|
|
42
42
|
#---
|
43
43
|
|
44
|
-
def self.register_gem(spec)
|
44
|
+
def self.register_gem(spec, loaded = [])
|
45
45
|
name = spec.name.to_sym
|
46
46
|
base_path = File.join(spec.full_gem_path, 'lib')
|
47
47
|
|
@@ -57,9 +57,16 @@ module Gems
|
|
57
57
|
Manager.connection.register(base_path) do |data|
|
58
58
|
namespace = data[:namespace]
|
59
59
|
plugin_path = data[:directory]
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
|
61
|
+
unless @@gems.has_key?(name)
|
62
|
+
logger.info("Registering gem #{name} at #{plugin_path} at #{Time.now}")
|
63
|
+
|
64
|
+
unless loaded.include?(name)
|
65
|
+
loader = File.join(base_path, "#{name}.rb")
|
66
|
+
require loader if File.exists?(loader)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
63
70
|
@@gems[name] = {
|
64
71
|
:spec => spec,
|
65
72
|
:base_path => base_path,
|
data/lib/core/manager.rb
CHANGED
@@ -111,7 +111,7 @@ class Manager
|
|
111
111
|
#-----------------------------------------------------------------------------
|
112
112
|
# Plugin registration / initialization
|
113
113
|
|
114
|
-
def reload(core = false, &code)
|
114
|
+
def reload(core = false, loaded = [], &code)
|
115
115
|
logger.info("Loading Nucleon plugins at #{Time.now}")
|
116
116
|
|
117
117
|
if core
|
@@ -131,13 +131,13 @@ class Manager
|
|
131
131
|
# Allow block level namespace and type registration
|
132
132
|
code.call(:define, myself) if code
|
133
133
|
|
134
|
-
load_plugins(core, &code)
|
134
|
+
load_plugins(core, loaded, &code)
|
135
135
|
logger.info("Finished loading Nucleon plugins at #{Time.now}")
|
136
136
|
end
|
137
137
|
|
138
138
|
#---
|
139
139
|
|
140
|
-
def load_plugins(core = false, &code)
|
140
|
+
def load_plugins(core = false, loaded = [], &code)
|
141
141
|
if core
|
142
142
|
# Register core plugins
|
143
143
|
logger.info("Initializing core plugins at #{Time.now}")
|
@@ -145,7 +145,7 @@ class Manager
|
|
145
145
|
end
|
146
146
|
|
147
147
|
# Register external Gem defined plugins
|
148
|
-
Gems.register(true)
|
148
|
+
Gems.register(true, Util::Data.array(loaded))
|
149
149
|
|
150
150
|
# Register any other extension plugins
|
151
151
|
exec(:register_plugins)
|
@@ -242,13 +242,15 @@ class Manager
|
|
242
242
|
options = translate_type(type_info, options)
|
243
243
|
config = Config.ensure(options)
|
244
244
|
name = config.get(:name, nil)
|
245
|
-
ensure_new = config.
|
245
|
+
ensure_new = config.get(:new, false)
|
246
246
|
|
247
247
|
if name
|
248
248
|
logger.debug("Looking up existing instance of #{name}")
|
249
249
|
|
250
250
|
if existing_instance = get(namespace, plugin_type, name)
|
251
251
|
unless ensure_new
|
252
|
+
config.delete(:new)
|
253
|
+
|
252
254
|
config.export.each do |property_name, value|
|
253
255
|
unless [ :name, :meta ].include?(property_name)
|
254
256
|
existing_instance[property_name] = value
|
@@ -274,6 +276,11 @@ class Manager
|
|
274
276
|
provider = config.delete(:provider, provider)
|
275
277
|
provider = default_provider unless provider
|
276
278
|
|
279
|
+
provider = value(:manager_plugin_provider, provider, Util::Data.merge([ config.export, {
|
280
|
+
:namespace => namespace,
|
281
|
+
:type => plugin_type
|
282
|
+
}]))
|
283
|
+
|
277
284
|
load_base(namespace, plugin_type, provider, config)
|
278
285
|
end
|
279
286
|
|
@@ -10,24 +10,30 @@ module Commit
|
|
10
10
|
def commit_config(optional = true)
|
11
11
|
|
12
12
|
if optional
|
13
|
-
|
13
|
+
register_bool :commit, :false, 'nucleon.core.mixin.action.commit.options.commit'
|
14
14
|
else
|
15
15
|
settings[:commit] = true
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
register_bool :allow_empty, true, 'nucleon.mixin.core.action.commit.options.allow_empty'
|
19
|
+
register_bool :propogate_commit, false, 'nucleon.core.mixin.action.commit.options.propogate_commit'
|
20
20
|
|
21
|
-
|
21
|
+
register_str :message, '', 'nucleon.core.mixin.action.commit.options.message'
|
22
22
|
|
23
|
-
|
23
|
+
register_str :author, nil, 'nucleon.core.mixin.action.commit.options.author' do |value|
|
24
24
|
if value.nil? || value.strip =~ /^[A-Za-z\s]+<\s*[^@]+@[^>]+\s*>$/
|
25
25
|
next true
|
26
26
|
end
|
27
|
-
warn('corl.core.
|
27
|
+
warn('corl.core.mixin.action.commit.errors.author', { :value => value })
|
28
28
|
false
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
#---
|
33
|
+
|
34
|
+
def commit_ignore
|
35
|
+
[ :commit, :allow_empty, :propogate_commit, :message, :author ]
|
36
|
+
end
|
31
37
|
|
32
38
|
#-----------------------------------------------------------------------------
|
33
39
|
# Operations
|
@@ -8,34 +8,21 @@ module Project
|
|
8
8
|
# Settings
|
9
9
|
|
10
10
|
def project_config
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
warn('nucleon.core.mixin.action.project.errors.project_reference', {
|
27
|
-
:value => value,
|
28
|
-
:provider => info[:provider],
|
29
|
-
:reference => info[:reference],
|
30
|
-
:url => info[:url],
|
31
|
-
:revision => info[:revision]
|
32
|
-
})
|
33
|
-
success = false
|
34
|
-
end
|
35
|
-
end
|
36
|
-
success
|
37
|
-
end
|
38
|
-
register :project_revision, :str, :master, 'nucleon.core.mixin.action.project.options.project_revision'
|
11
|
+
register_project_provider :project_provider, nil, [
|
12
|
+
'nucleon.core.mixin.action.project.options.project_provider',
|
13
|
+
'nucleon.core.mixin.action.project.errors.project_provider'
|
14
|
+
]
|
15
|
+
register_project :project_reference, nil, [
|
16
|
+
'nucleon.core.mixin.action.project.options.project_reference',
|
17
|
+
'nucleon.core.mixin.action.project.errors.project_reference'
|
18
|
+
]
|
19
|
+
register_str :project_revision, :master, 'nucleon.core.mixin.action.project.options.project_revision'
|
20
|
+
end
|
21
|
+
|
22
|
+
#---
|
23
|
+
|
24
|
+
def project_ignore
|
25
|
+
[ :project_provider, :project_reference, :project_revision ]
|
39
26
|
end
|
40
27
|
|
41
28
|
#-----------------------------------------------------------------------------
|
@@ -10,15 +10,23 @@ module Push
|
|
10
10
|
def push_config(optional = true)
|
11
11
|
|
12
12
|
if optional
|
13
|
-
|
13
|
+
register_bool :push, false, 'nucleon.core.mixin.action.push.options.push'
|
14
14
|
else
|
15
15
|
settings[:push] = true
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
register :revision, :str, :master, 'nucleon.core.mixin.action.push.options.revision'
|
18
|
+
register_bool :pull, true, 'nucleon.core.mixin.action.push.options.pull'
|
20
19
|
|
21
|
-
|
20
|
+
register_bool :propogate_push, false, 'nucleon.core.mixin.action.push.options.propogate_push'
|
21
|
+
|
22
|
+
register_str :remote, :edit, 'nucleon.core.mixin.action.push.options.remote'
|
23
|
+
register_str :revision, :master, 'nucleon.core.mixin.action.push.options.revision'
|
24
|
+
end
|
25
|
+
|
26
|
+
#---
|
27
|
+
|
28
|
+
def push_ignore
|
29
|
+
[ :push, :pull, :propogate_push, :remote, :revision ]
|
22
30
|
end
|
23
31
|
|
24
32
|
#-----------------------------------------------------------------------------
|
@@ -30,7 +38,8 @@ module Push
|
|
30
38
|
if project && settings[:push]
|
31
39
|
success = project.push(settings[:remote], extended_config(:push, {
|
32
40
|
:revision => settings[:revision],
|
33
|
-
:propogate => settings[:propogate_push]
|
41
|
+
:propogate => settings[:propogate_push],
|
42
|
+
:no_pull => ! settings[:pull]
|
34
43
|
}))
|
35
44
|
end
|
36
45
|
success
|
@@ -5,77 +5,326 @@ module Action
|
|
5
5
|
module Registration
|
6
6
|
|
7
7
|
#-----------------------------------------------------------------------------
|
8
|
-
#
|
8
|
+
# Registration definitions
|
9
|
+
|
10
|
+
def register_bool(name, default = false, locale = nil, &code)
|
11
|
+
register(name, :bool, default, locale, &code)
|
12
|
+
end
|
13
|
+
|
14
|
+
#---
|
15
|
+
|
16
|
+
def register_int(name, default = nil, locale = nil, &code)
|
17
|
+
register(name, :int, default, locale, &code)
|
18
|
+
end
|
19
|
+
|
20
|
+
#---
|
21
|
+
|
22
|
+
def register_float(name, default = nil, locale = nil, &code)
|
23
|
+
register(name, :float, default, locale, &code)
|
24
|
+
end
|
25
|
+
|
26
|
+
#---
|
27
|
+
|
28
|
+
def register_str(name, default = '', locale = nil, &code)
|
29
|
+
register(name, :str, default, locale, &code)
|
30
|
+
end
|
31
|
+
|
32
|
+
#---
|
33
|
+
|
34
|
+
def register_array(name, default = [], locale = nil, &code)
|
35
|
+
register(name, :array, default, locale, &code)
|
36
|
+
end
|
37
|
+
|
38
|
+
#---
|
9
39
|
|
10
|
-
def register_file(name, default = nil)
|
40
|
+
def register_file(name, default = nil, locale = nil, &code)
|
11
41
|
name = name.to_sym
|
12
42
|
|
13
|
-
|
14
|
-
validate_file(value)
|
43
|
+
register_str(name, default, locale) do |value|
|
44
|
+
success = validate_file(value)
|
45
|
+
success = code.call(value, success) if code
|
46
|
+
success
|
15
47
|
end
|
16
48
|
end
|
17
49
|
|
18
50
|
#---
|
19
|
-
|
20
|
-
def
|
51
|
+
|
52
|
+
def register_files(name, default = nil, locale = nil, &code)
|
21
53
|
name = name.to_sym
|
22
54
|
|
23
|
-
|
24
|
-
|
25
|
-
|
55
|
+
option_locale, validation_locale = split_locales(locale)
|
56
|
+
|
57
|
+
register_array(name, default, option_locale) do |values|
|
58
|
+
success = validate_files(values, validation_locale)
|
59
|
+
success = code.call(values, success) if code
|
60
|
+
success
|
61
|
+
end
|
26
62
|
end
|
27
63
|
|
28
64
|
#---
|
29
65
|
|
30
|
-
def
|
66
|
+
def register_directory(name, default = nil, locale = nil, &code)
|
31
67
|
name = name.to_sym
|
32
68
|
|
33
|
-
|
34
|
-
|
69
|
+
register_str(name, default, locale) do |value|
|
70
|
+
success = validate_directory(value)
|
71
|
+
success = code.call(value, success) if code
|
72
|
+
success
|
35
73
|
end
|
36
74
|
end
|
37
75
|
|
38
76
|
#---
|
77
|
+
|
78
|
+
def register_directories(name, default = nil, locale = nil, &code)
|
79
|
+
name = name.to_sym
|
39
80
|
|
40
|
-
|
81
|
+
option_locale, validation_locale = split_locales(locale)
|
82
|
+
|
83
|
+
register_array(name, default, option_locale) do |values|
|
84
|
+
success = validate_directories(values, validation_locale)
|
85
|
+
success = code.call(values, success) if code
|
86
|
+
success
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
#---
|
91
|
+
|
92
|
+
def register_plugin_type(namespace, name, default = nil, locale = nil, &code)
|
41
93
|
name = name.to_sym
|
42
94
|
|
43
|
-
|
44
|
-
|
45
|
-
|
95
|
+
option_locale, validation_locale = split_locales(locale)
|
96
|
+
|
97
|
+
register_str(name, default, option_locale) do |value|
|
98
|
+
success = validate_plugin_types(namespace, name, value, validation_locale)
|
99
|
+
success = code.call(value, success) if code
|
100
|
+
success
|
101
|
+
end
|
46
102
|
end
|
47
103
|
|
48
104
|
#---
|
105
|
+
|
106
|
+
def register_plugin_types(namespace, name, default = nil, locale = nil, &code)
|
107
|
+
name = name.to_sym
|
49
108
|
|
50
|
-
|
109
|
+
option_locale, validation_locale = split_locales(locale)
|
110
|
+
|
111
|
+
register_array(name, default, option_locale) do |values|
|
112
|
+
success = validate_plugin_types(namespace, name, values, validation_locale)
|
113
|
+
success = code.call(values, success) if code
|
114
|
+
success
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
#---
|
119
|
+
|
120
|
+
def register_plugin_provider(namespace, type, name, default = nil, locale = nil, &code)
|
121
|
+
name = name.to_sym
|
122
|
+
|
123
|
+
option_locale, validation_locale = split_locales(locale)
|
124
|
+
|
125
|
+
register_str(name, default, option_locale) do |value|
|
126
|
+
success = validate_plugin_providers(namespace, type, name, value, validation_locale)
|
127
|
+
success = code.call(value, success) if code
|
128
|
+
success
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
#---
|
133
|
+
|
134
|
+
def register_plugin_providers(namespace, type, name, default = nil, locale = nil, &code)
|
51
135
|
name = name.to_sym
|
52
136
|
|
53
|
-
|
54
|
-
|
55
|
-
|
137
|
+
option_locale, validation_locale = split_locales(locale)
|
138
|
+
|
139
|
+
register_array(name, default, option_locale) do |values|
|
140
|
+
success = validate_plugin_providers(namespace, type, name, values, validation_locale)
|
141
|
+
success = code.call(values, success) if code
|
142
|
+
success
|
143
|
+
end
|
56
144
|
end
|
57
145
|
|
58
146
|
#---
|
147
|
+
|
148
|
+
def register_plugin(namespace, type, name, default = nil, locale = nil, &code)
|
149
|
+
name = name.to_sym
|
59
150
|
|
60
|
-
|
151
|
+
option_locale, validation_locale = split_locales(locale)
|
152
|
+
|
153
|
+
register_str(name, default, option_locale) do |value|
|
154
|
+
success = validate_plugins(namespace, type, name, value, validation_locale)
|
155
|
+
success = code.call(value, success) if code
|
156
|
+
success
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
#---
|
161
|
+
|
162
|
+
def register_plugins(namespace, type, name, default = nil, locale = nil, &code)
|
61
163
|
name = name.to_sym
|
62
164
|
|
63
|
-
|
64
|
-
|
65
|
-
|
165
|
+
option_locale, validation_locale = split_locales(locale)
|
166
|
+
|
167
|
+
register_array(name, default, option_locale) do |values|
|
168
|
+
success = validate_plugins(namespace, type, name, values, validation_locale)
|
169
|
+
success = code.call(values, success) if code
|
170
|
+
success
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
#---
|
175
|
+
|
176
|
+
def register_project_provider(name, default = nil, locale = nil, &code)
|
177
|
+
register_plugin_provider(:nucleon, :project, name.to_sym, default, locale, &code)
|
178
|
+
end
|
179
|
+
|
180
|
+
#---
|
181
|
+
|
182
|
+
def register_project_providers(name, default = nil, locale = nil, &code)
|
183
|
+
register_plugin_providers(:nucleon, :project, name.to_sym, default, locale, &code)
|
184
|
+
end
|
185
|
+
|
186
|
+
#---
|
187
|
+
|
188
|
+
def register_project(name, default = nil, locale = nil, &code)
|
189
|
+
register_plugin(:nucleon, :project, name.to_sym, default, locale, &code)
|
190
|
+
end
|
191
|
+
|
192
|
+
#---
|
193
|
+
|
194
|
+
def register_projects(name, default = nil, locale = nil, &code)
|
195
|
+
register_plugins(:nucleon, :project, name.to_sym, default, locale, &code)
|
196
|
+
end
|
197
|
+
|
198
|
+
#---
|
199
|
+
|
200
|
+
def register_translator_provider(name, default = nil, locale = nil, &code)
|
201
|
+
register_plugin_provider(:nucleon, :translator, name.to_sym, default, locale, &code)
|
202
|
+
end
|
203
|
+
|
204
|
+
#---
|
205
|
+
|
206
|
+
def register_translator_providers(name, default = nil, locale = nil, &code)
|
207
|
+
register_plugin_providers(:nucleon, :translator, name.to_sym, default, locale, &code)
|
208
|
+
end
|
209
|
+
|
210
|
+
#---
|
211
|
+
|
212
|
+
def register_translator(name, default = nil, locale = nil, &code)
|
213
|
+
register_plugin(:nucleon, :translator, name.to_sym, default, locale, &code)
|
214
|
+
end
|
215
|
+
|
216
|
+
#---
|
217
|
+
|
218
|
+
def register_translators(name, default = nil, locale = nil, &code)
|
219
|
+
register_plugins(:nucleon, :translators, name.to_sym, default, locale, &code)
|
66
220
|
end
|
67
221
|
|
68
222
|
#-----------------------------------------------------------------------------
|
69
223
|
# Validators
|
70
224
|
|
71
|
-
def validate_file(file_name)
|
72
|
-
file_name.nil? || File.exists?(file_name)
|
225
|
+
def validate_file(file_name, locale = nil)
|
226
|
+
success = file_name.nil? || File.exists?(file_name)
|
227
|
+
warn(locale, { :file => file_name }) unless success
|
228
|
+
success
|
73
229
|
end
|
74
230
|
|
75
231
|
#---
|
76
232
|
|
77
|
-
def
|
78
|
-
|
233
|
+
def validate_files(file_names, locale = nil)
|
234
|
+
success = true
|
235
|
+
|
236
|
+
array(file_names).each do |file_name|
|
237
|
+
test = validate_file(file_name, locale)
|
238
|
+
success = false unless test
|
239
|
+
end
|
240
|
+
success
|
241
|
+
end
|
242
|
+
|
243
|
+
#---
|
244
|
+
|
245
|
+
def validate_directory(dir_name, locale = nil)
|
246
|
+
success = dir_name.nil? || File.directory?(dir_name)
|
247
|
+
warn(locale, { :directory => dir_name }) unless success
|
248
|
+
success
|
249
|
+
end
|
250
|
+
|
251
|
+
#---
|
252
|
+
|
253
|
+
def validate_directories(dir_names, locale = nil)
|
254
|
+
success = true
|
255
|
+
|
256
|
+
array(dir_names).each do |dir_name|
|
257
|
+
test = validate_directory(dir_name, locale)
|
258
|
+
success = false unless test
|
259
|
+
end
|
260
|
+
success
|
261
|
+
end
|
262
|
+
|
263
|
+
#---
|
264
|
+
|
265
|
+
def validate_plugin_types(namespace, name, values, locale = nil)
|
266
|
+
loaded_plugin_types = Nucleon.loaded_plugins(namespace).keys
|
267
|
+
success = true
|
268
|
+
locale = "validation.#{name}" unless locale
|
269
|
+
|
270
|
+
array(values).each do |value|
|
271
|
+
if ! loaded_plugin_types.include?(value.to_sym)
|
272
|
+
warn(locale, { :value => value, :choices => loaded_plugin_types.join(", ") })
|
273
|
+
success = false
|
274
|
+
end
|
275
|
+
end
|
276
|
+
success
|
277
|
+
end
|
278
|
+
|
279
|
+
#---
|
280
|
+
|
281
|
+
def validate_plugin_providers(namespace, type, name, values, locale = nil)
|
282
|
+
loaded_plugin_providers = Nucleon.loaded_plugins(namespace, type).keys
|
283
|
+
success = true
|
284
|
+
locale = "validation.#{name}" unless locale
|
285
|
+
|
286
|
+
array(values).each do |value|
|
287
|
+
if ! loaded_plugin_providers.include?(value.to_sym)
|
288
|
+
warn(locale, { :value => value, :choices => loaded_plugin_providers.join(", ") })
|
289
|
+
success = false
|
290
|
+
end
|
291
|
+
end
|
292
|
+
success
|
293
|
+
end
|
294
|
+
|
295
|
+
#---
|
296
|
+
|
297
|
+
def validate_plugins(namespace, type, name, values, locale = nil)
|
298
|
+
plugin_class = Nucleon.plugin_class(namespace, type)
|
299
|
+
loaded_plugins = Nucleon.loaded_plugins(namespace, type)
|
300
|
+
success = true
|
301
|
+
locale = "validation.#{name}" unless locale
|
302
|
+
|
303
|
+
array(values).each do |value|
|
304
|
+
if info = plugin_class.translate_reference(value)
|
305
|
+
if ! loaded_plugins.keys.include?(info[:provider].to_sym)
|
306
|
+
warn(locale, Util::Data.merge([ info, { :value => value, :choices => loaded_plugins.keys.join(", ") } ]))
|
307
|
+
success = false
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
success
|
312
|
+
end
|
313
|
+
|
314
|
+
#-----------------------------------------------------------------------------
|
315
|
+
# Utilities
|
316
|
+
|
317
|
+
def split_locales(locale)
|
318
|
+
option_locale = nil
|
319
|
+
validation_locale = nil
|
320
|
+
|
321
|
+
if locale.is_a?(Array)
|
322
|
+
option_locale = locale[0]
|
323
|
+
validation_locale = locale[1] if locale.size > 1
|
324
|
+
else
|
325
|
+
option_locale = locale
|
326
|
+
end
|
327
|
+
[ option_locale, validation_locale ]
|
79
328
|
end
|
80
329
|
end
|
81
330
|
end
|