nucleon 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43e949a33f99d15fb8422c9a7a36f5945b70317b
4
- data.tar.gz: 257c8ea9bc29a2fc897ca84d3f8c793b14d5cc84
3
+ metadata.gz: 86ef1a6188d37c66e891020f166c601c6706716d
4
+ data.tar.gz: 7a41ff27a66c1a3dac4ed7a9d1b1b30414122a22
5
5
  SHA512:
6
- metadata.gz: ac2d24aa0b236ce1f317dfd2d43e9cb34e416bfb59be665c2e95157246b76b9479408a8e0e85c613f6be7bbfbbe2598268c80e6eb4a528681d254092c413ff97
7
- data.tar.gz: 08b1115576d89bb5ae0ee0f3b375539f3c1fdeffedb85ca77713e94d325d896225c6f16e06914ef19cb1612b650046827333e8e307b75d9a60d779bbad9e9367
6
+ metadata.gz: e46474f787fa900f9d2707500fa70a160cc9a15559db2529cbdba33307c9f12c30d08a0d19f1c25c7a7664b7ed8f2459d48f374df144e3f460d8e05d5885e3a3
7
+ data.tar.gz: 2379443b256a10edd441a9aec2db8011fa87786faed0c0e194acdb04c987c39f5918ac3ed40f61884787d24fea743951bfd4ed2a59de08a030dbbf01339d623d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -29,7 +29,8 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
29
29
 
30
30
  return Nucleon.project(config.import({
31
31
  :name => directory,
32
- :directory => directory
32
+ :directory => directory,
33
+ :corl_file => config.get(:corl_file, true)
33
34
  }), provider)
34
35
 
35
36
  else
@@ -73,7 +74,7 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
73
74
  @cache = Util::Cache.new(directory, Nucleon.sha1(plugin_name), '.project_cache')
74
75
  init_cache
75
76
 
76
- unless self.class.load_provider(directory)
77
+ if get(:corl_file, true) && ! self.class.load_provider(directory)
77
78
  self.class.store_provider(directory, plugin_provider)
78
79
  end
79
80
  end
@@ -522,7 +523,7 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
522
523
  if add_project
523
524
  logger.debug("Directory #{project_path} is a valid sub project for this #{plugin_provider} project")
524
525
 
525
- project = myself.class.open(project_path, plugin_provider)
526
+ project = myself.class.open(project_path, plugin_provider, { :corl_file => get(:corl_file, true) })
526
527
 
527
528
  extension(:load_project, { :project => project })
528
529
  subprojects[path] = project
@@ -263,6 +263,41 @@ class Logger
263
263
  self.class.add_logger(@resource, @logger) unless self.class.loggers.has_key?(@resource)
264
264
  end
265
265
 
266
+ # Set instance logger level
267
+ #
268
+ # NOTE: This will detach the logger from the global log level!
269
+ #
270
+ # * *Parameters*
271
+ # - [Integer] *level* Log4r::Logger level
272
+ #
273
+ # * *Returns*
274
+ # - [Void] This method does not return a value
275
+ #
276
+ # * *Errors*
277
+ #
278
+ # See also:
279
+ # - Log4r::Logger
280
+ #
281
+ def level=level
282
+ @logger.level = level unless level.nil?
283
+ end
284
+
285
+ # Get instance logger level
286
+ #
287
+ # * *Parameters*
288
+ #
289
+ # * *Returns*
290
+ # - [Integer] Return current Log4r::Logger level
291
+ #
292
+ # * *Errors*
293
+ #
294
+ # See also:
295
+ # - Log4r::Logger
296
+ #
297
+ def level
298
+ @logger.level
299
+ end
300
+
266
301
  #*****************************************************************************
267
302
  # Log statements
268
303
 
@@ -321,6 +321,17 @@ module Nucleon
321
321
 
322
322
  #*****************************************************************************
323
323
 
324
+ #
325
+ # Check for no-parallel flag early so we can avoid loading unncessary
326
+ # libraries. In case we are coming in through the CLI.
327
+ #
328
+ ARGV.each do |arg|
329
+ if arg == '--no-parallel'
330
+ ENV['NUCLEON_NO_PARALLEL'] = '1'
331
+ break
332
+ end
333
+ end
334
+
324
335
  # Check if parallel execution is enabled
325
336
  #
326
337
  # This uses the environment variable *"NUCLEON_NO_PARALLEL"*. Parallelism is
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: nucleon 0.2.3 ruby lib
5
+ # stub: nucleon 0.2.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "nucleon"
9
- s.version = "0.2.3"
9
+ s.version = "0.2.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Adrian Webb"]
14
- s.date = "2014-12-03"
14
+ s.date = "2014-12-27"
15
15
  s.description = "\nA framework that provides a simple foundation for building Ruby applications that are:\n\n* Highly configurable (with both distributed and persistent configurations)\n* Extremely pluggable and extendable\n* Easily parallel\n\nNote: This framework is still very early in development!\n"
16
16
  s.email = "adrian.webb@coralnexus.com"
17
17
  s.executables = ["nucleon"]
@@ -111,7 +111,7 @@ Gem::Specification.new do |s|
111
111
  s.rdoc_options = ["--title", "Nucleon", "--main", "README.rdoc", "--line-numbers"]
112
112
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
113
113
  s.rubyforge_project = "nucleon"
114
- s.rubygems_version = "2.4.4"
114
+ s.rubygems_version = "2.4.2"
115
115
  s.summary = "Easy and minimal framework for building extensible distributed applications"
116
116
 
117
117
  if s.respond_to? :specification_version then
@@ -9,28 +9,65 @@ module Nucleon
9
9
 
10
10
 
11
11
  #***************************************************************************
12
-
12
+
13
13
  def environment(*args, &code)
14
14
  test_object(Environment, *args, &code)
15
15
  end
16
+
17
+ def test_loaded_plugin(environment, plugin_type, provider_map)
18
+ plugin_define_plugins(environment, plugin_type, provider_map) do |type, provider|
19
+ plugin_info = environment.loaded_plugin(:nucleon, type, provider)
20
+ test_eq plugin_info, plugin_loaded_plugins[:nucleon][type][provider]
21
+ end
22
+ end
23
+
24
+ def test_loaded_plugins(environment, plugin_type, provider_map)
25
+ plugin_define_plugins(environment, plugin_type, provider_map)
26
+ test_eq environment.loaded_plugins[:nucleon][plugin_type], plugin_loaded_plugins[:nucleon][plugin_type]
27
+ end
28
+
29
+ def test_create_plugin(environment, plugin_type, provider, options)
30
+ plugin_autoload_test_environment(environment)
31
+ plugin = environment.create_plugin(:nucleon, plugin_type, provider, options)
32
+ test_config plugin, options
33
+ end
34
+
35
+ def test_create_plugin_math(environment, plugin_type, provider, options, num1, num2, result)
36
+ plugin_autoload_test_environment(environment)
37
+ plugin = environment.create_plugin(:nucleon, plugin_type, provider, options)
38
+ test_eq plugin.math(num1, num2), result
39
+ end
40
+
41
+ def test_get_plugin(environment, plugin_type, provider, options)
42
+ plugin_autoload_test_environment(environment)
43
+ environment.create_plugin(:nucleon, plugin_type, provider, options)
44
+ test_config environment.get_plugin(:nucleon, plugin_type, provider), options
45
+ end
46
+
47
+ def test_remove_plugin(environment, plugin_type, provider, options)
48
+ plugin_autoload_test_environment(environment)
49
+ plugin = environment.create_plugin(:nucleon, plugin_type, provider, options)
50
+ test_config environment.remove_plugin(:nucleon, plugin_type, plugin.plugin_instance_name), options
51
+ end
52
+
53
+
16
54
 
17
55
 
18
- #*****************************************************************************
19
- # Constructor / Destructor
56
+ #*****************************************************************************
57
+ # Constructor / Destructor
20
58
 
21
59
  describe "#initialize" do
22
60
 
23
61
  it "tests initialize method" do
24
62
  test_config environment, plugin_environment_empty
25
63
  end
26
-
27
64
  end
28
65
 
29
- #*****************************************************************************
30
- # Plugin type accessor / modifiers
66
+ #*****************************************************************************
67
+ # Plugin type accessor / modifiers
31
68
 
32
69
  describe "#namespaces" do
33
-
70
+
34
71
  it "tests namespaces with empty array values" do
35
72
  test_eq environment.namespaces,[]
36
73
  end
@@ -43,7 +80,6 @@ module Nucleon
43
80
  test_eq environment.namespaces, [:nucleon, :unit, :testing]
44
81
  end
45
82
  end
46
-
47
83
  end
48
84
 
49
85
  describe "#plugin_types" do
@@ -64,46 +100,35 @@ module Nucleon
64
100
  environment.define_plugin_type :nucleon, :test, :first
65
101
  test_eq environment.plugin_types(:nonexist), []
66
102
  end
67
- end
68
-
103
+ end
69
104
  end
70
105
 
71
- # Define a new plugin type in a specified namespace.
72
- #
106
+ # Define a new plugin type in a specified namespace.
107
+ #
73
108
 
74
109
  describe "#define_plugin_type" do
75
110
 
76
111
  it "returns loaded plugins state" do
77
- test_config environment.define_plugin_type(:nucleon, :test, :first), {
78
- :plugin_types=>{:nucleon=>{:test=>:first}},
79
- :load_info=>{},
80
- :active_info=>{}
81
- }
82
- end
83
-
112
+ test_config environment.define_plugin_type(:nucleon, :test, :first), plugin_environment_test1
113
+ end
84
114
  end
85
115
 
86
- # Define one or more new plugin types in a specified namespace.
87
- #
88
-
116
+ # Define one or more new plugin types in a specified namespace.
117
+ #
118
+
89
119
  describe "#define_plugin_types" do
90
120
 
91
121
  it "returns loaded plugins state" do
92
- test_config environment.define_plugin_types(:nucleon, { :test1 => "test2", :test3 => "test4"}),{
93
- :plugin_types=>{:nucleon=>{:test1=>"test2", :test3=>"test4"}},
94
- :load_info=>{},
95
- :active_info=>{}
96
- }
122
+ test_config environment.define_plugin_types(:nucleon, { :test1 => "test2", :test3 => "test4"}),plugin_environment_test2
97
123
  end
98
124
 
99
125
  it "returns environment object" do
100
126
  test_type environment.define_plugin_types(:nucleon, { :test1 => "test2", :test3 => "test4"}), Nucleon::Environment
101
127
  end
102
-
103
128
  end
104
129
 
105
- # Check if a specified plugin type has been defined
106
- #
130
+ # Check if a specified plugin type has been defined
131
+ #
107
132
 
108
133
  describe "#plugin_type_defined?" do
109
134
 
@@ -122,8 +147,8 @@ module Nucleon
122
147
  end
123
148
  end
124
149
 
125
- # Return the default provider currently registered for a plugin type
126
- #
150
+ # Return the default provider currently registered for a plugin type
151
+ #
127
152
 
128
153
  describe "#plugin_type_default" do
129
154
 
@@ -140,9 +165,367 @@ module Nucleon
140
165
  test_eq environment.plugin_type_default(:nucleon1, :test3),"test4"
141
166
  end
142
167
  end
143
-
144
168
  end
145
169
 
146
- end
170
+ #*****************************************************************************
171
+ # Loaded plugin accessor / modifiers
147
172
 
173
+ describe "#define_plugin" do
174
+
175
+ it "registers translator plugins" do
176
+ plugin_define_plugins(environment, :translator, { :json => 'JSON', :yaml => 'YAML' })
177
+ end
178
+
179
+ it "registers template plugins" do
180
+ plugin_define_plugins(environment, :template, { :json => 'JSON', :yaml => 'YAML', :wrapper => 'wrapper' })
181
+ end
182
+
183
+ it "registers project plugins" do
184
+ plugin_define_plugins(environment, :project, { :git => 'git', :github => 'github' })
185
+ end
186
+
187
+ it "registers extension plugins" do
188
+ plugin_define_plugins(environment, :extension, { :project => 'project' })
189
+ end
190
+
191
+ it "registers event plugins" do
192
+ plugin_define_plugins(environment, :event, { :regex => 'regex' })
193
+ end
194
+
195
+ it "registers command plugins" do
196
+ plugin_define_plugins(environment, :command, { :bash => 'bash' })
197
+ end
198
+
199
+ it "registers action plugins" do
200
+ plugin_define_plugins(environment, :action, { :project_update => [ 'project', 'update' ], :project_ceate => [ 'project', 'create' ], :project_save => [ 'project', 'save' ],
201
+ :project_remove => [ 'project', 'remove' ], :project_add => [ 'project', 'add' ],:extract => 'extract' })
202
+ end
203
+ end
204
+
205
+ # Return the load information for a specified plugin provider if it exists
206
+ #
207
+
208
+ describe "#loaded_plugin" do
209
+
210
+ it "load info of translator plugins" do
211
+ test_loaded_plugin(environment, :translator, {:json => 'JSON', :yaml => 'YAML' })
212
+ end
213
+
214
+ it "load info of template plugins" do
215
+ test_loaded_plugin(environment, :template, { :json => 'JSON', :yaml => 'YAML', :wrapper => 'wrapper' })
216
+ end
217
+
218
+ it "load info of project plugins" do
219
+ test_loaded_plugin(environment, :project, { :git => 'git', :github => 'github' })
220
+ end
221
+
222
+ it "load info of extension plugins" do
223
+ test_loaded_plugin(environment, :extension, { :project => 'project' })
224
+ end
225
+
226
+ it "load info of event plugins" do
227
+ test_loaded_plugin(environment, :event, { :regex => 'regex' })
228
+ end
229
+
230
+ it "load info of command plugins" do
231
+ test_loaded_plugin(environment, :command, { :bash => 'bash' })
232
+ end
233
+
234
+ it "load info of action - project plugins" do
235
+ plugin_define_plugins(environment, :action, { :project_update => [ 'project', 'update' ], :project_ceate => [ 'project', 'create' ], :project_save => [ 'project', 'save' ],
236
+ :project_remove => [ 'project', 'remove' ], :project_add => [ 'project', 'add' ],:extract => 'extract' })
237
+ end
238
+ end
239
+
240
+ # Return the load information for namespaces, plugin types, providers if it exists
241
+ #
242
+
243
+ describe "#loaded_plugins" do
244
+
245
+ it "returns loaded plugins for nil params" do
246
+ test_eq environment.loaded_plugins, {}
247
+ environment do |environment|
248
+ plugin_define_plugins(environment, :project, { :github => 'github', :git => 'git' })
249
+ plugin_define_plugins(environment, :event, { :regex => 'regex' })
250
+ plugin_define_plugins(environment, :extension, { :project => 'project' })
251
+ plugin_define_plugins(environment, :command, { :bash => 'bash' })
252
+ plugin_define_plugins(environment, :translator, { :json => 'JSON', :yaml => 'YAML' })
253
+ plugin_define_plugins(environment, :action, { :project_update => [ 'project', 'update' ], :project_ceate => [ 'project', 'create' ], :project_save => [ 'project', 'save' ],
254
+ :project_remove => [ 'project', 'remove' ], :project_add => [ 'project', 'add' ],:extract => 'extract' })
255
+ plugin_define_plugins(environment, :template, { :json => 'JSON', :yaml => 'YAML', :wrapper => 'wrapper' })
256
+
257
+ test_eq environment.loaded_plugins, plugin_loaded_plugins
258
+ end
259
+
260
+ end
261
+
262
+ it "returns loaded translator plugins provided namespace alone" do
263
+ test_loaded_plugins environment, :translator,{ :json => 'JSON', :yaml => 'YAML' }
264
+ end
265
+
266
+ it "returns loaded template plugins provide namespace alone" do
267
+ test_loaded_plugins environment, :template,{ :json => 'JSON', :wrapper => 'wrapper', :yaml => 'YAML' }
268
+ end
269
+
270
+ it "returns loaded project plugins provide namespace alone" do
271
+ test_loaded_plugins environment, :project,{ :git => 'git', :github => 'github' }
272
+ end
273
+
274
+ it "returns loaded extension plugins provide namespace alone" do
275
+ test_loaded_plugins environment, :extension,{ :project => 'project' }
276
+ end
277
+
278
+ it "returns loaded event plugins provide namespace alone" do
279
+ test_loaded_plugins environment, :event,{ :regex => 'regex' }
280
+ end
281
+
282
+ it "returns loaded command plugins provide namespace alone" do
283
+ test_loaded_plugins environment, :command,{ :bash => 'bash' }
284
+ end
285
+
286
+ it "returns action command plugins provide namespace alone" do
287
+ test_loaded_plugins environment, :action,{ :project_update => [ 'project', 'update' ], :project_save => [ 'project', 'save' ], :project_remove => [ 'project', 'remove' ],
288
+ :project_ceate => [ 'project', 'create' ],:project_add => [ 'project', 'add' ],:extract => 'extract' }
289
+ end
290
+
291
+ it "returns loaded translator plugins provided namespace and plugin type" do
292
+ test_loaded_plugins environment, :translator,{ :json => 'JSON', :yaml => 'YAML' }
293
+ end
294
+
295
+ it "returns loaded template plugins provide namespace and plugin type" do
296
+ test_loaded_plugins environment, :template,{ :json => 'JSON', :wrapper => 'wrapper', :yaml => 'YAML' }
297
+ end
298
+
299
+ it "returns loaded project plugins provide namespace and plugin type" do
300
+ test_loaded_plugins environment, :project,{ :git => 'git', :github => 'github' }
301
+ end
302
+
303
+ it "returns loaded extension plugins provide namespace and plugin type" do
304
+ test_loaded_plugins environment, :extension,{ :project => 'project' }
305
+ end
306
+
307
+ it "returns loaded event plugins provide namespace and plugin type" do
308
+ test_loaded_plugins environment, :event,{ :regex => 'regex' }
309
+ end
310
+
311
+ it "returns loaded command plugins provide namespace and plugin type" do
312
+ test_loaded_plugins environment, :command,{ :bash => 'bash' }
313
+ end
314
+
315
+ it "returns action command plugins provide namespace and plugin type" do
316
+ test_loaded_plugins environment, :action,{ :project_update => [ 'project', 'update' ], :project_save => [ 'project', 'save' ], :project_remove => [ 'project', 'remove' ],
317
+ :project_ceate => [ 'project', 'create' ],:project_add => [ 'project', 'add' ],:extract => 'extract' }
318
+ end
319
+
320
+ it "returns loaded translator plugins provided namespace ,plugin type and provider" do
321
+ test_loaded_plugins environment, :translator,{ :json => 'JSON', :yaml => 'YAML' }
322
+ end
323
+
324
+ it "returns loaded template plugins provide namespace ,plugin type and provider" do
325
+ test_loaded_plugins environment, :template,{ :json => 'JSON', :wrapper => 'wrapper', :yaml => 'YAML' }
326
+ end
327
+
328
+ it "returns loaded project plugins provide namespace ,plugin type and provider" do
329
+ test_loaded_plugins environment, :project,{ :git => 'git', :github => 'github' }
330
+ end
331
+
332
+ it "returns loaded extension plugins provide namespace ,plugin type and provider" do
333
+ test_loaded_plugins environment, :extension,{ :project => 'project' }
334
+ end
335
+
336
+ it "returns loaded event plugins provide namespace ,plugin type and provider" do
337
+ test_loaded_plugins environment, :event,{ :regex => 'regex' }
338
+ end
339
+
340
+ it "returns loaded command plugins provide namespace ,plugin type and provider" do
341
+ test_loaded_plugins environment, :command,{ :bash => 'bash' }
342
+ end
343
+
344
+ it "returns action command plugins provide namespace ,plugin type and provider" do
345
+ test_loaded_plugins environment, :action,{ :project_update => [ 'project', 'update' ], :project_save => [ 'project', 'save' ], :project_remove => [ 'project', 'remove' ],
346
+ :project_ceate => [ 'project', 'create' ],:project_add => [ 'project', 'add' ],:extract => 'extract' }
347
+ end
348
+ end
349
+
350
+ # Check if a specified plugin type has been loaded
351
+ #
352
+
353
+ describe "#plugin_has_type?" do
354
+
355
+ it "returns true for a loaded plugin type" do
356
+ environment do |environment|
357
+ plugin_define_plugins environment, :translator,{ :json => 'JSON', :yaml => 'YAML' }
358
+ test_eq environment.plugin_has_type?(:nucleon, :translator), true
359
+ end
360
+
361
+ end
362
+
363
+ it "returns false for a non loaded plugin type" do
364
+ environment do |environment|
365
+ plugin_define_plugins environment, :translator,{ :json => 'JSON', :yaml => 'YAML' }
366
+ test_eq environment.plugin_has_type?(:nucleon, :action), false
367
+ end
368
+ end
369
+ end
370
+
371
+ # Check if a specified plugin provider has been loaded
372
+ #
373
+
374
+ describe "#plugin_has_provider?" do
375
+
376
+ it "returns true for a loded plugin and provider" do
377
+ environment do |environment|
378
+ plugin_define_plugins environment, :translator,{ :json => 'JSON' }
379
+ test_eq environment.plugin_has_provider?(:nucleon, :translator, :json), true
380
+ end
381
+ end
382
+
383
+ it "returns false for a non loded plugin and provider" do
384
+ environment do |environment|
385
+ plugin_define_plugins environment, :action,{ :project_update => [ 'project', 'update' ], :project_save => [ 'project', 'save' ], :project_remove => [ 'project', 'remove' ],
386
+ :project_add => [ 'project', 'add' ],:extract => 'extract' }
387
+ test_eq environment.plugin_has_provider?(:nucleon, :action, :project_ceate), false
388
+ end
389
+ end
390
+ end
391
+
392
+ # Autoload all of the defined plugins
393
+ #
394
+
395
+ describe "#autoload" do
396
+
397
+ it "tests autoloaded plugin export" do
398
+ plugin_autoload_test_environment(environment)
399
+ end
400
+ end
401
+
402
+ #*****************************************************************************
403
+ # Active plugin accessor / modifiers
404
+
405
+ describe "#create_plugin" do
406
+
407
+ it "tests create plugin export value" do
408
+ test_create_plugin environment, :test, :first, { :test1 => 13 }
409
+ end
410
+
411
+ it "tests create plugin math value" do
412
+ test_create_plugin_math environment, :test, :first, { :test1 => 13 }, 12, 12, 3744
413
+ end
414
+
415
+ it "tests create plugin export value" do
416
+ test_create_plugin environment, :test, :second, { :test1 => 15 }
417
+ end
418
+
419
+ it "tests create plugin math value" do
420
+ test_create_plugin_math environment, :test, :second, { :test1 => 15 }, 12, 12, 41
421
+ end
422
+ end
423
+
424
+ # Return a plugin instance by name if it exists
425
+ #
426
+
427
+ describe "#get_plugin" do
428
+
429
+ it "returns the created plugins 1" do
430
+ test_get_plugin environment, :test, :first, { :test1 => 13 , :test2 => 5}
431
+ end
432
+
433
+ it "returns the created plugins 2" do
434
+ test_get_plugin environment, :test, :second, { :test1 => 13 , :test2 => 5}
435
+ end
436
+ end
437
+
438
+ # Remove a plugin instance from the environment
439
+ #
440
+
441
+ describe "#remove_plugin" do
442
+
443
+ it "returns the instance removed from the environment" do
444
+ test_remove_plugin environment, :test, :first, { :test1 => 13, :test2 => 5}
445
+ end
446
+ end
447
+
448
+ # Return active plugins for namespaces, plugin types, providers if specified
449
+ #
450
+
451
+ describe "#active_plugins" do
452
+
453
+ it "returns appropriate return type" do
454
+ environment do |environment|
455
+ plugin_autoload_test_environment(environment)
456
+ environment.create_plugin(:nucleon, :test, :first, { :test1 => 13, :test2 => 5})
457
+ environment.create_plugin(:nucleon, :test, :second, { :test1 => 15 })
458
+ test_type(environment.active_plugins, Hash)
459
+ test_type(environment.active_plugins(:nucleon), Hash)
460
+ test_type(environment.active_plugins(:nucleon, :test), Hash)
461
+ test_type(environment.active_plugins(:nucleon, :test, :first), Hash)
462
+ test_type((environment.active_plugins(:nucleon, :test)[:first_bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f]), Nucleon::Test::First)
463
+ end
464
+
465
+ end
466
+
467
+ it "returns appropriate return value" do
468
+ environment do |environment|
469
+ plugin_autoload_test_environment(environment)
470
+ environment.create_plugin(:nucleon, :test, :first, { :test1 => 13, :test2 => 5})
471
+ environment.create_plugin(:nucleon, :test, :second, { :test1 => 15 })
472
+ test_config((environment.active_plugins[:nucleon][:test][:first_bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f]), {:test1=>13, :test2=>5})
473
+ end
474
+ end
475
+ end
476
+
477
+ #*****************************************************************************
478
+ # Utilities
479
+
480
+ # Return a fully formed class name as a string
481
+ #
482
+
483
+ describe "#class_name" do
484
+
485
+ it "returns a fully formed class name as an array with array of symbols" do
486
+ test_eq environment.class_name([:Nucleon, :Test, :First], '::',true), ["Nucleon", "Test", "First"]
487
+ end
488
+
489
+ it "returns a fully formed class name as string seperated by :: with array of symbols" do
490
+ test_eq environment.class_name([:Nucleon, :Test, :First], '::',false), "Nucleon::Test::First"
491
+ end
492
+
493
+ it "returns a fully formed class name as an array with array of strings" do
494
+ test_eq environment.class_name(["Nucleon", "Test", "First"], '::',true), ["Nucleon", "Test", "First"]
495
+ end
496
+
497
+ it "returns a fully formed class name as string seperated by .. with array of strings" do
498
+ test_eq environment.class_name(["Nucleon", "Test", "First"], '..',false), "Nucleon..Test..First"
499
+ end
500
+ end
501
+
502
+
503
+ # Return a fully formed class name as a machine usable constant
504
+ #
505
+
506
+ describe "#class_const" do
507
+
508
+ it "returns a fully formed class name for array of symbols" do
509
+ test_eq environment.class_const([:Nucleon,:Test,:First], '::'), Nucleon::Test::First
510
+ end
511
+
512
+ it "returns a fully formed class name for array of strings" do
513
+ test_eq environment.class_const(["Nucleon", "Test", "First"], '::'), Nucleon::Test::First
514
+ end
515
+ end
516
+
517
+ # Return a class constant representing a base plugin class generated from namespace and plugin_type.
518
+ #
519
+
520
+ describe "#plugin_class" do
521
+
522
+ it "returns a class constant representing a base plugin class given symbols" do
523
+ test_eq environment.plugin_class(:nucleon, :action), Nucleon::Plugin::Action
524
+ end
525
+
526
+ it "returns a class constant representing a base plugin class given strings" do
527
+ test_eq environment.plugin_class("nucleon", "translator"), Nucleon::Plugin::Translator
528
+ end
529
+ end
530
+ end
148
531
  end
@@ -131,16 +131,7 @@ RSpec.shared_context "nucleon_plugin" do
131
131
  :file => File.join(action_project_directory, 'update.rb'),
132
132
  :provider => :project_update,
133
133
  :directory => action_project_directory,
134
- :class_components => [ "Nucleon", "Action", "Project", "Update" ],
135
- :description => {
136
- :namespace => :nucleon,
137
- :weight => 900,
138
- :group => :project,
139
- :action => :update,
140
- :description => "Update this project from a remote",
141
- :help => "translation missing: en.nucleon.action.project.update.help"
142
- },
143
- :_weight => 900
134
+ :class_components => [ "Nucleon", "Action", "Project", "Update" ]
144
135
  },
145
136
  :project_create => {
146
137
  :namespace => :nucleon,
@@ -149,16 +140,7 @@ RSpec.shared_context "nucleon_plugin" do
149
140
  :file => File.join(action_project_directory, 'create.rb'),
150
141
  :provider => :project_create,
151
142
  :directory => action_project_directory,
152
- :class_components => [ "Nucleon", "Action", "Project", "Create" ],
153
- :description => {
154
- :namespace => :nucleon,
155
- :weight => 1000,
156
- :group => :project,
157
- :action => :create,
158
- :description => "Create a new project",
159
- :help => "translation missing: en.nucleon.action.project.create.help"
160
- },
161
- :_weight => 1000
143
+ :class_components => [ "Nucleon", "Action", "Project", "Create" ]
162
144
  },
163
145
  :project_save => {
164
146
  :namespace => :nucleon,
@@ -167,16 +149,7 @@ RSpec.shared_context "nucleon_plugin" do
167
149
  :file => File.join(action_project_directory, 'save.rb'),
168
150
  :provider => :project_save,
169
151
  :directory => action_project_directory,
170
- :class_components => [ "Nucleon", "Action", "Project", "Save" ],
171
- :description => {
172
- :namespace => :nucleon,
173
- :weight => 800,
174
- :group => :project,
175
- :action => :save,
176
- :description => "Save changes to files in this project",
177
- :help => "translation missing: en.nucleon.action.project.save.help"
178
- },
179
- :_weight => 800
152
+ :class_components => [ "Nucleon", "Action", "Project", "Save" ]
180
153
  },
181
154
  :project_remove => {
182
155
  :namespace => :nucleon,
@@ -185,16 +158,7 @@ RSpec.shared_context "nucleon_plugin" do
185
158
  :file => File.join(action_project_directory, 'remove.rb'),
186
159
  :provider => :project_remove,
187
160
  :directory => action_project_directory,
188
- :class_components => [ "Nucleon", "Action", "Project", "Remove" ],
189
- :description => {
190
- :namespace => :nucleon,
191
- :weight => 600,
192
- :group => :project,
193
- :action => :remove,
194
- :description => "Remove an existing sub-project from this project",
195
- :help => "translation missing: en.nucleon.action.project.remove.help"
196
- },
197
- :_weight => 600
161
+ :class_components => [ "Nucleon", "Action", "Project", "Remove" ]
198
162
  },
199
163
  :project_add => {
200
164
  :namespace => :nucleon,
@@ -203,16 +167,7 @@ RSpec.shared_context "nucleon_plugin" do
203
167
  :file => File.join(action_project_directory, 'add.rb'),
204
168
  :provider => :project_add,
205
169
  :directory => action_project_directory,
206
- :class_components => [ "Nucleon", "Action", "Project", "Add" ],
207
- :description => {
208
- :namespace => :nucleon,
209
- :weight => 700,
210
- :group => :project,
211
- :action => :add,
212
- :description => "Add a new sub-project to this project",
213
- :help => "translation missing: en.nucleon.action.project.add.help"
214
- },
215
- :_weight => 700
170
+ :class_components => [ "Nucleon", "Action", "Project", "Add" ]
216
171
  },
217
172
  :extract => {
218
173
  :namespace => :nucleon,
@@ -221,16 +176,7 @@ RSpec.shared_context "nucleon_plugin" do
221
176
  :file => File.join(action_directory, 'extract.rb'),
222
177
  :provider => :extract,
223
178
  :directory => action_directory,
224
- :class_components => [ "Nucleon", "Action", "Extract" ],
225
- :description => {
226
- :namespace => :nucleon,
227
- :weight => -50,
228
- :group => nil,
229
- :action => :extract,
230
- :description => "Extract an encoded package into a directory",
231
- :help => "translation missing: en.nucleon.action.extract.help"
232
- },
233
- :_weight => -50
179
+ :class_components => [ "Nucleon", "Action", "Extract" ]
234
180
  }
235
181
  },
236
182
  :template => {
@@ -431,9 +377,4 @@ RSpec.shared_context "nucleon_plugin" do
431
377
  test_config environment, plugin_test_autoload_environment
432
378
  environment
433
379
  end
434
-
435
-
436
- let(:plugin_active_plugins) do
437
-
438
- end
439
380
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nucleon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Webb
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-12-03 00:00:00 Z
12
+ date: 2014-12-27 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: log4r
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  requirements: []
298
298
 
299
299
  rubyforge_project: nucleon
300
- rubygems_version: 2.4.4
300
+ rubygems_version: 2.4.2
301
301
  signing_key:
302
302
  specification_version: 4
303
303
  summary: Easy and minimal framework for building extensible distributed applications