nucleon 0.2.9 → 0.2.10

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: 4f37db6374efb2285de5bd242cce45eb5817e2d5
4
- data.tar.gz: d5fd9959abf368f329756ea44c24d844a0dc5ea3
3
+ metadata.gz: e2a05325532059ef176a3aa70f8b9cd37379821b
4
+ data.tar.gz: 00042b162c3c7793f8b1f631a96eddbd516322d6
5
5
  SHA512:
6
- metadata.gz: eb017436c867b27eb087ef11e1de3cde238f65777a49fb3eaa0120e0dac595ccee944c60a67ec1de90a98b33edf8ef7bad02d98d36fa95de283413846a9aa7e4
7
- data.tar.gz: 23db6461c2f61e51d6497ff6329d6588c66e01c34edece43a1356cd4e138a724f0f85b471c5ac5ba51883bcbbfce8e34c5ef55cd30d4d9c336a2705244507f03
6
+ metadata.gz: f3e768ca2276d0e30090b0a8f92aaea30943a47d009139bc8e90de6df58b7355151c72600515c01a14533c8b960476d69306731a3e0428ad962b81ba7d0c483d
7
+ data.tar.gz: b1887ddeaa81bd46acdf6bb5dc7b1bdac3ce0dce2d9520884c1f83637427ab93d1640925198764ea0f5f0547ddcbc6e6cfa7f72ab640d327c4d1eacd8b6c9cfe
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.2.10
@@ -580,13 +580,26 @@ class Action < Nucleon.plugin_class(:nucleon, :base)
580
580
 
581
581
  search_action = lambda do |components|
582
582
  unless components.empty?
583
+ index = action_index
583
584
  action_id = components.is_a?(Array) ? components.flatten.join('::') : components
584
585
  action_id_pattern = action_id.gsub('::', ':.*:')
585
586
 
586
- action_index.each do |loaded_action_id, loaded_action_info|
587
- if loaded_action_id.match(/(^|\:)#{action_id_pattern.gsub(/\-/, '\-')}(\:|$)/)
587
+ # Check for exact matches
588
+ index.each do |loaded_action_id, loaded_action_info|
589
+ if loaded_action_id.match(/^[^\:]+\:\:#{action_id.gsub(/\-/, '\-')}$/)
588
590
  loaded_action_info[:action_id] = loaded_action_id
589
591
  actions_found << loaded_action_info
592
+ break
593
+ end
594
+ end
595
+
596
+ if actions_found.empty?
597
+ # Check for similarly named actions
598
+ index.each do |loaded_action_id, loaded_action_info|
599
+ if loaded_action_id.match(/(^|\:)#{action_id_pattern.gsub(/\-/, '\-')}(\:|$)/)
600
+ loaded_action_info[:action_id] = loaded_action_id
601
+ actions_found << loaded_action_info
602
+ end
590
603
  end
591
604
  end
592
605
  end
@@ -2,74 +2,74 @@
2
2
  module Nucleon
3
3
  module Util
4
4
  class Cache < Core
5
-
5
+
6
6
  @@cache_lock = Mutex.new
7
-
7
+
8
8
  #-----------------------------------------------------------------------------
9
-
9
+
10
10
  # This class already inherits much of what we need from the core config class.
11
11
  # Right now we just have to worry about persistence
12
-
12
+
13
13
  #-----------------------------------------------------------------------------
14
14
  # Constructor / Destructor
15
-
15
+
16
16
  def initialize(root_path, id, cache_dir = '.cache', force = true)
17
17
  super({}, {}, force)
18
-
19
- @cache_dir = cache_dir
20
- @cache_root = File.join(root_path, cache_dir)
18
+
19
+ @cache_dir = cache_dir
20
+ @cache_root = File.join(root_path, cache_dir)
21
21
  FileUtils.mkdir_p(base_path) unless File.directory?(base_path)
22
-
22
+
23
23
  @cache_id = id.to_sym
24
24
  @cache_translator = Nucleon.type_default(:nucleon, :translator)
25
25
  @cache_filename = "#{id}.#{translator}"
26
26
  @cache_path = File.join(@cache_root, @cache_filename)
27
-
27
+
28
28
  load
29
29
  end
30
-
30
+
31
31
  #-----------------------------------------------------------------------------
32
32
  # Property accessors / modifiers
33
-
33
+
34
34
  def status
35
35
  @status
36
36
  end
37
-
37
+
38
38
  #---
39
-
39
+
40
40
  def base_path
41
41
  @cache_root
42
42
  end
43
-
43
+
44
44
  #---
45
-
45
+
46
46
  def directory_name
47
47
  @cache_dir
48
48
  end
49
-
49
+
50
50
  #---
51
-
51
+
52
52
  def id
53
53
  @cache_id
54
54
  end
55
-
55
+
56
56
  #---
57
-
57
+
58
58
  def translator
59
59
  @cache_translator
60
60
  end
61
-
61
+
62
62
  #---
63
-
63
+
64
64
  def file
65
65
  @cache_path
66
66
  end
67
-
67
+
68
68
  #---
69
-
69
+
70
70
  def get(keys, default = nil, format = false)
71
71
  result = super(keys, nil)
72
-
72
+
73
73
  if result.nil?
74
74
  load
75
75
  result = super(keys, nil)
@@ -79,88 +79,86 @@ class Cache < Core
79
79
  end
80
80
 
81
81
  #---
82
-
82
+
83
83
  def set(keys, value, delete_nil = false)
84
84
  result = super
85
85
  save if initialized?
86
86
  result
87
87
  end
88
-
88
+
89
89
  #---
90
-
90
+
91
91
  def delete(keys, default = nil)
92
92
  result = super
93
93
  save if initialized?
94
94
  result
95
95
  end
96
-
96
+
97
97
  #---
98
-
98
+
99
99
  def clear
100
100
  result = super
101
101
  save if initialized?
102
102
  result
103
103
  end
104
-
104
+
105
105
  #-----------------------------------------------------------------------------
106
106
  # Operations
107
-
107
+
108
108
  def import_base(properties, options = {})
109
109
  config = Config.ensure(options)
110
-
110
+
111
111
  result = super
112
112
  save if initialized? && ! config.get(:no_save, false)
113
113
  result
114
114
  end
115
-
115
+
116
116
  #---
117
-
117
+
118
118
  def load
119
119
  success = false
120
120
  @status = 255
121
-
122
- @@cache_lock.synchronize do
121
+
122
+ @@cache_lock.synchronize do
123
123
  logger.info("Loading #{translator} translated cache from #{file}")
124
-
124
+
125
125
  parser = CORL.translator({}, translator)
126
- raw = Disk.read(file)
127
-
126
+ raw = Disk.read(file)
127
+
128
128
  if parser && raw && ! raw.empty?
129
- logger.debug("Cache file contents: #{raw}")
129
+ logger.debug("Cache file contents: #{raw}")
130
130
  parse_properties = Data.hash(parser.parse(raw))
131
-
131
+
132
132
  Nucleon.remove_plugin(parser)
133
-
133
+
134
134
  import(parse_properties, { :no_save => true }) unless parse_properties.empty?
135
135
  success = true
136
136
  @status = Nucleon.code.success
137
137
  end
138
- end
139
- success
138
+ end
139
+ success
140
140
  end
141
- protected :load
142
-
141
+
143
142
  #---
144
-
143
+
145
144
  def save
146
145
  success = false
147
146
  @status = 255
148
-
147
+
149
148
  @@cache_lock.synchronize do
150
149
  if renderer = CORL.translator({}, translator)
151
150
  rendering = renderer.generate(export)
152
-
151
+
153
152
  Nucleon.remove_plugin(renderer)
154
-
153
+
155
154
  if Disk.write(file, rendering)
156
155
  success = true
157
156
  @status = Nucleon.code.success
158
157
  end
159
158
  end
160
159
  end
161
- success
160
+ success
162
161
  end
163
- protected :save
164
162
  end
165
163
  end
166
164
  end
@@ -452,6 +452,10 @@ end
452
452
  #
453
453
  require 'rubygems'
454
454
  #
455
+ # Extra time functions
456
+ #
457
+ require 'time'
458
+ #
455
459
  # Basic CLI option parsing
456
460
  #
457
461
  require 'optparse'
@@ -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.9 ruby lib
5
+ # stub: nucleon 0.2.10 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "nucleon"
9
- s.version = "0.2.9"
9
+ s.version = "0.2.10"
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 = "2015-02-19"
14
+ s.date = "2015-02-26"
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"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nucleon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Webb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: log4r