sadie 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -1
- data/TODO +11 -1
- data/lib/sadie/defaults.rb +2 -1
- data/lib/sadie/version.rb +1 -1
- data/lib/sadie.rb +43 -13
- metadata +8 -8
data/Rakefile
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
|
3
3
|
require 'rake'
|
4
|
-
require '
|
4
|
+
require 'rdoc/task'
|
5
5
|
|
6
6
|
task :default => [:test]
|
7
7
|
|
8
|
+
# run sadie tests
|
8
9
|
task :test do
|
9
10
|
ruby "test/tc_sadie_toplevel.rb"
|
10
11
|
ruby "test/tc_sadie_twodeep.rb"
|
11
12
|
end
|
12
13
|
|
14
|
+
# increment version
|
13
15
|
task :deploy => 'inc_version' do
|
14
16
|
version = current_sadie_version
|
15
17
|
sh "git push"
|
@@ -17,6 +19,7 @@ task :deploy => 'inc_version' do
|
|
17
19
|
sh "gem push sadie-#{version}.gem"
|
18
20
|
end
|
19
21
|
|
22
|
+
# increment version
|
20
23
|
task :inc_version do
|
21
24
|
version = current_sadie_version
|
22
25
|
if (matches = version.match(/^(\d+\.\d+\.)(\d+)$/))
|
data/TODO
CHANGED
@@ -18,4 +18,14 @@
|
|
18
18
|
in the key itself, enough that the primer could use it and divine the
|
19
19
|
desired result. So, where Sadie::prime takes an arg of containing
|
20
20
|
a list of keys that this primer "provides", it will alternatively take an
|
21
|
-
arg of "key-match" which will fire off the primer when the key matches.
|
21
|
+
arg of "key-match" which will fire off the primer when the key matches.
|
22
|
+
|
23
|
+
[sampleapps] make a few simple apps with primer directories
|
24
|
+
|
25
|
+
[primer_path] currently defined via a path to a single directory, the toplevel primer
|
26
|
+
directory idea should be made into a collection of directories as spec'ed
|
27
|
+
in a colon-separated list, and it should check the environment, if
|
28
|
+
otherwise undefined. would make it easy to have multiple primer
|
29
|
+
repositories.
|
30
|
+
|
31
|
+
|
data/lib/sadie/defaults.rb
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
class Sadie
|
6
6
|
DEFAULTS = {
|
7
7
|
"sadie.primers_dirpath" => File.expand_path("primers","/var/sadie"),
|
8
|
-
"sadie.sessions_dirpath" => File.expand_path("sessions","/var/sadie")
|
8
|
+
"sadie.sessions_dirpath" => File.expand_path("sessions","/var/sadie"),
|
9
|
+
"sadie.primer_plugins_dirpath" => "lib/sadie/primer_plugins"
|
9
10
|
}
|
10
11
|
end
|
data/lib/sadie/version.rb
CHANGED
data/lib/sadie.rb
CHANGED
@@ -69,7 +69,7 @@ class Sadie
|
|
69
69
|
|
70
70
|
# ==method: Sadie::iniFileToHash
|
71
71
|
#
|
72
|
-
# utility class method. accepts a filepath. digests
|
72
|
+
# utility class method. accepts a filepath. digests ini file and returns hash of hashes.
|
73
73
|
#
|
74
74
|
def self.iniFileToHash ( filepath )
|
75
75
|
section = nil
|
@@ -130,7 +130,11 @@ class Sadie
|
|
130
130
|
|
131
131
|
# internalize defaults to shortterm
|
132
132
|
DEFAULTS.each do |key, value|
|
133
|
-
|
133
|
+
if key.eql? "sadie.primer_plugins_dirpath"
|
134
|
+
addPrimerPluginsDirPath value
|
135
|
+
else
|
136
|
+
_set( key, value )
|
137
|
+
end
|
134
138
|
end
|
135
139
|
|
136
140
|
# internalize supplied defaults, postponing a set of sadie.primers_dirpath
|
@@ -165,7 +169,24 @@ class Sadie
|
|
165
169
|
|
166
170
|
end
|
167
171
|
|
168
|
-
def
|
172
|
+
def addPrimerPluginsDirPath( path )
|
173
|
+
|
174
|
+
exppath = File.expand_path(path)
|
175
|
+
|
176
|
+
# add the path to the system load path
|
177
|
+
$LOAD_PATH.include?(exppath) \
|
178
|
+
or $LOAD_PATH.unshift(exppath)
|
179
|
+
|
180
|
+
# add the path to the pluginsdir array
|
181
|
+
defined? @plugins_dir_paths \
|
182
|
+
or @plugins_dir_paths = Array.new
|
183
|
+
@plugins_dir_paths.include?(exppath) \
|
184
|
+
or @plugins_dir_paths.unshift(exppath)
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
def prime( primer_definition, &block )
|
169
190
|
# validate params
|
170
191
|
defined? primer_definition \
|
171
192
|
or raise "Prime called without parameters"
|
@@ -256,6 +277,13 @@ class Sadie
|
|
256
277
|
|
257
278
|
end
|
258
279
|
|
280
|
+
# ==method: output
|
281
|
+
#
|
282
|
+
# an alias for get. intended for use with primers that produce an output beyond their return value
|
283
|
+
def output( k )
|
284
|
+
return get( k )
|
285
|
+
end
|
286
|
+
|
259
287
|
# ==method: isset?
|
260
288
|
#
|
261
289
|
# returns true if sadie has a value for the key
|
@@ -479,16 +507,18 @@ class Sadie
|
|
479
507
|
puts "Initializing primer plugins..."
|
480
508
|
|
481
509
|
# load the plugins
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
510
|
+
@plugins_dir_paths.each do | dirpath |
|
511
|
+
Dir.foreach( dirpath ) do |filename|
|
512
|
+
next if ! filename.match( /\.plugin\.rb$/ )
|
513
|
+
|
514
|
+
filepath = File.expand_path( filename, dirpath )
|
515
|
+
|
516
|
+
puts "initializing primer plugin with file: #{filename}"
|
517
|
+
|
518
|
+
setMidPluginInit( filepath )
|
519
|
+
load( filename )
|
520
|
+
unsetMidPluginInit
|
521
|
+
end
|
492
522
|
end
|
493
523
|
puts "...finished initializing primer plugins"
|
494
524
|
@@primer_plugins_initialized = true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sadie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-16 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dbi
|
16
|
-
requirement: &
|
16
|
+
requirement: &21570800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *21570800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mysql
|
27
|
-
requirement: &
|
27
|
+
requirement: &21570380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *21570380
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dbd-mysql
|
38
|
-
requirement: &
|
38
|
+
requirement: &21569960 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *21569960
|
47
47
|
description: Sadie is a data framework intended to ease the pain of managing related
|
48
48
|
data.
|
49
49
|
email:
|