sadie 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -1
- data/README +13 -0
- data/Rakefile +34 -4
- data/TODO +21 -0
- data/lib/sadie/version.rb +1 -4
- data/lib/sadie.rb +12 -74
- data/sadie.gemspec +1 -1
- metadata +51 -74
data/CHANGELOG
CHANGED
@@ -3,4 +3,5 @@
|
|
3
3
|
[0.0.8] abstracted primer types such that sadie can now use plugins. with two working plugins, IniFile and Resource, it is functionaly equivalent to v0.0.7. More to come.
|
4
4
|
[0.0.9] primer logic bugfix, added sql and db connection primer types
|
5
5
|
[0.0.10] sql plugin handler became sql2ar to better reflect what's going on
|
6
|
-
[0.0.11] updated documentation
|
6
|
+
[0.0.11] updated documentation
|
7
|
+
[0.0.12] updated documentation, Rakefile, code cleanups
|
data/README
CHANGED
@@ -17,3 +17,16 @@ It's very simple to add new primer types, so it would be simple to create primer
|
|
17
17
|
At Landmetrics, we use a predecessor to Sadie to power perimetercomps[http://perimetercomps.com], producing each 50+ page report with charts, graphs and tables with only 12 queries to the database.
|
18
18
|
|
19
19
|
Sadie can be downloaded via its rubygems page[https://rubygems.org/gems/sadie] or from github[https://github.com/FredAtLandMetrics/sadie].
|
20
|
+
|
21
|
+
USE CASES
|
22
|
+
|
23
|
+
[templating] As noted above, perimetercomps[http://perimetercomps.com] is an example of how one might
|
24
|
+
use sadie to to create a templating engine wherein many pieces of related information
|
25
|
+
from many different sources are made into charts, graphs, tables and text before being
|
26
|
+
assembled into a single deliverable document. We used LaTeX, but html, xml, css, txt, etc.
|
27
|
+
would be just as easy.
|
28
|
+
|
29
|
+
[data import] Tasks involving grabbing data from different places in different formats and
|
30
|
+
massaging the data into a consistent and useful format. A few simple primer plugins
|
31
|
+
would make this very easy.
|
32
|
+
|
data/Rakefile
CHANGED
@@ -10,13 +10,43 @@ task :test do
|
|
10
10
|
ruby "test/tc_sadie_twodeep.rb"
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
task :deploy => 'inc_version' do
|
14
|
+
version = current_sadie_version
|
15
|
+
sh "git push"
|
16
|
+
sh "gem build sadie.gemspec"
|
17
|
+
sh "gem push sadie-#{version}.gem"
|
18
|
+
end
|
19
|
+
|
20
|
+
task :inc_version do
|
21
|
+
version = current_sadie_version
|
22
|
+
if (matches = version.match(/^(\d+\.\d+\.)(\d+)$/))
|
23
|
+
pre = matches[1]
|
24
|
+
post = Integer(matches[2]) + 1
|
25
|
+
version = "#{pre}#{post}"
|
26
|
+
end
|
27
|
+
fh = File.open("lib/sadie/version.rb","w")
|
28
|
+
fh.puts "class Sadie"
|
29
|
+
fh.puts ' VERSION = "' + version + '"'
|
30
|
+
fh.puts "end"
|
31
|
+
fh.close
|
32
|
+
puts "incremented sadie version to #{version}"
|
33
|
+
end
|
34
|
+
|
16
35
|
Rake::RDocTask.new do |rdoc|
|
17
36
|
rdoc.title = 'Sadie'
|
18
37
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
19
|
-
rdoc.rdoc_files.include('README')
|
38
|
+
rdoc.rdoc_files.include('README','TODO','CHANGELOG')
|
20
39
|
rdoc.main = 'README'
|
21
40
|
rdoc.rdoc_dir = 'rdoc'
|
22
41
|
end
|
42
|
+
|
43
|
+
def current_sadie_version
|
44
|
+
version = "0.0.0"
|
45
|
+
File.open("lib/sadie/version.rb","r").each do |line|
|
46
|
+
if matches = line.match(/version\s*\=\s*\"([^\"]+)\"/i)
|
47
|
+
version = matches[1]
|
48
|
+
break
|
49
|
+
end
|
50
|
+
end
|
51
|
+
version
|
52
|
+
end
|
data/TODO
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
[setDestroyTimer] this will accept either a quantity of time or a specific date and
|
2
|
+
will destroy the data at that time, causing a "reprime" event
|
3
|
+
|
4
|
+
[threadedness] split getSadieInstance(sessionid] into getSadieInstanceSlave[sessionid]
|
5
|
+
where getSadieInstance will continute to bring up a normal Sadie
|
6
|
+
instance and getSadieInstanceSlave will perform reads in its own thread
|
7
|
+
but will prime in sync with the main instance thread (such that two
|
8
|
+
primers for the same key would never execute at the same time, rather,
|
9
|
+
the second one would simply block until the first completed). This
|
10
|
+
would allow for some concurrency within a session without. Rather than
|
11
|
+
calling getSadieInstanceSlave directly, a prgram could simple call a
|
12
|
+
new method, consider( key ) which would fire off a get in an instance
|
13
|
+
slave to allow for some background processing
|
14
|
+
|
15
|
+
[keyregexpmatch] instead of requiring that all keys must be known either as having been set
|
16
|
+
or having a known primer, a key could be matched against a regex.
|
17
|
+
This would make it possible to encode some useful priming information
|
18
|
+
in the key itself, enough that the primer could use it and divine the
|
19
|
+
desired result. So, where Sadie::prime takes an arg of containing
|
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.
|
data/lib/sadie/version.rb
CHANGED
data/lib/sadie.rb
CHANGED
@@ -162,20 +162,6 @@ class Sadie
|
|
162
162
|
set( "sadie.session_id", _generateNewSessionId )
|
163
163
|
end
|
164
164
|
|
165
|
-
# if defined? options["sadie.session_filepath"] \
|
166
|
-
# && options["sadie.session_filepath"].match(/^[^\s]+$/)
|
167
|
-
# set( "sadie.session_filepath", options["sadie.session_filepath"] )
|
168
|
-
# _initializeWithSessionFilePath( get("sadie.session_filepath") )
|
169
|
-
# return
|
170
|
-
# end
|
171
|
-
#
|
172
|
-
# # determine session id, init from session if provided as arg
|
173
|
-
# if defined?options["sadie.session_id"] && options["sadie.session_id"].match(/^[^\s]+$/)
|
174
|
-
# set( "sadie.session_id", options["sadie.session_id"] )
|
175
|
-
# _initializeWithSessionId( get( "sadie.session_id" ) )
|
176
|
-
# else
|
177
|
-
# set( "sadie.session_id", _generateNewSessionId )
|
178
|
-
# end
|
179
165
|
|
180
166
|
end
|
181
167
|
|
@@ -236,62 +222,11 @@ class Sadie
|
|
236
222
|
# a primer or actually priming
|
237
223
|
else
|
238
224
|
yield( self, getCurrentPrimerKeyPrefix, @@current_primer_filepath ) \
|
239
|
-
# unless midPrimerInit?
|
240
|
-
# if registering the prime mode, skips block exec
|
241
|
-
#
|
242
|
-
# if currentPrimerPluginAcceptsBlock?
|
243
|
-
#
|
244
|
-
# # call with block only if accepts block
|
245
|
-
# yield( self, getCurrentPrimerKeyPrefix, @@current_primer_filepath, &block )
|
246
|
-
#
|
247
|
-
# else
|
248
|
-
|
249
|
-
# yield( self, getCurrentPrimerKeyPrefix, @@current_primer_filepath ) \
|
250
|
-
# if prime_on_init or
|
251
|
-
|
252
|
-
# end
|
253
|
-
|
254
|
-
# prime_on_init \
|
255
|
-
# or unsetMidPrimerInit
|
256
|
-
|
257
225
|
end
|
258
226
|
end
|
259
227
|
|
260
228
|
|
261
229
|
|
262
|
-
# # ==method: pathToKey
|
263
|
-
# #
|
264
|
-
# # returns a dot-separated version of the filepath such that
|
265
|
-
# # with parentify=1 returns dot path to directory file is in,
|
266
|
-
# # with parentify=2 returns dot path to directory above directory file is in, etc.
|
267
|
-
# def pathToKey( filepath, parentify=0 )
|
268
|
-
#
|
269
|
-
# # separate path into basename,dirname
|
270
|
-
# path_basename = File.basename( filepath )
|
271
|
-
# path_dirname = File.dirname( filepath )
|
272
|
-
#
|
273
|
-
# # create stack of dir components
|
274
|
-
# path_stack = Array.new
|
275
|
-
# temp_path_stack = path_dirname.split(/\//)
|
276
|
-
# temp_path_stack.each do |item|
|
277
|
-
# next if item.match(/^\s*$/)
|
278
|
-
# path_stack.push item
|
279
|
-
# end
|
280
|
-
#
|
281
|
-
# # lose the suffix on the basename
|
282
|
-
# root_path_basename = path_basename.gsub( /\.[^\.]*$/, "" )
|
283
|
-
# path_stack.push( root_path_basename )
|
284
|
-
# if parentify > 1
|
285
|
-
# parentify.times do |i|
|
286
|
-
# path_stack.pop
|
287
|
-
# end
|
288
|
-
# end
|
289
|
-
#
|
290
|
-
# path_stack.join( "," )
|
291
|
-
#
|
292
|
-
# end
|
293
|
-
|
294
|
-
|
295
230
|
# ==method: get
|
296
231
|
#
|
297
232
|
# a standard getter which primes the unprimed and recalls "expensive" facts from files
|
@@ -355,11 +290,12 @@ class Sadie
|
|
355
290
|
#
|
356
291
|
# returns true if the destructOnGet flag is set for the key
|
357
292
|
def destroyOnGet?( key )
|
358
|
-
@flag_destroyonget.has_key?( key )
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
293
|
+
( @flag_destroyonget.has_key?( key ) && @flag_destroyonget["#{key}"] )
|
294
|
+
# @flag_destroyonget.has_key?( key ) \
|
295
|
+
# or return _newline( false )
|
296
|
+
# @flag_destroyonget["#{key}"] \
|
297
|
+
# and return _newline( true )
|
298
|
+
# return _newline(false)
|
363
299
|
end
|
364
300
|
|
365
301
|
# ==method: set
|
@@ -648,8 +584,6 @@ class Sadie
|
|
648
584
|
|
649
585
|
if regexp.match( filename )
|
650
586
|
|
651
|
-
# currentPrimerPluginAcceptsBlock( accepts_block )
|
652
|
-
# currentPrimerPluginPrimeOnInit( prime_on_init )
|
653
587
|
setCurrentPrimerPluginFilepath( plugin_filepath )
|
654
588
|
prime_on_init \
|
655
589
|
or setMidPrimerInit( filepath )
|
@@ -691,7 +625,13 @@ class Sadie
|
|
691
625
|
@@current_primer_filepath
|
692
626
|
end
|
693
627
|
|
628
|
+
def setCurrentPrimerRequestingKey( key )
|
629
|
+
@@current_primer_requesting_key = key
|
630
|
+
end
|
694
631
|
|
632
|
+
def getCurrentPrimerRequestingKey
|
633
|
+
@@current_primer_requesting_key
|
634
|
+
end
|
695
635
|
|
696
636
|
# ==memorizePrimerLocation
|
697
637
|
#
|
@@ -772,7 +712,6 @@ class Sadie
|
|
772
712
|
|
773
713
|
|
774
714
|
def _newline( rval=true )
|
775
|
-
#puts
|
776
715
|
return rval
|
777
716
|
end
|
778
717
|
|
@@ -907,7 +846,6 @@ class Sadie
|
|
907
846
|
if ! defined? @@mid_primer_initialization
|
908
847
|
@@mid_primer_initialization = false
|
909
848
|
@@mid_primer_filepath = nil
|
910
|
-
# @@mid_primer_toplevel_primer_dirpath = nil
|
911
849
|
end
|
912
850
|
|
913
851
|
end
|
data/sadie.gemspec
CHANGED
metadata
CHANGED
@@ -1,74 +1,60 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sadie
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 11
|
10
|
-
version: 0.0.11
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Fred McDavid
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-01-26 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: dbi
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &9930400 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: mysql
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: *9930400
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: mysql
|
27
|
+
requirement: &9929980 !ruby/object:Gem::Requirement
|
38
28
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
46
33
|
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: dbd-mysql
|
50
34
|
prerelease: false
|
51
|
-
|
35
|
+
version_requirements: *9929980
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: dbd-mysql
|
38
|
+
requirement: &9929560 !ruby/object:Gem::Requirement
|
52
39
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
60
44
|
type: :runtime
|
61
|
-
|
62
|
-
|
63
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *9929560
|
47
|
+
description: Sadie is a data framework intended to ease the pain of managing related
|
48
|
+
data.
|
49
|
+
email:
|
64
50
|
- fred@landmetrics.com
|
65
51
|
executables: []
|
66
|
-
|
67
52
|
extensions: []
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
53
|
+
extra_rdoc_files:
|
54
|
+
- README
|
55
|
+
- CHANGELOG
|
56
|
+
- TODO
|
57
|
+
files:
|
72
58
|
- .gitignore
|
73
59
|
- CHANGELOG
|
74
60
|
- Gemfile
|
@@ -76,6 +62,7 @@ files:
|
|
76
62
|
- LICENSE
|
77
63
|
- README
|
78
64
|
- Rakefile
|
65
|
+
- TODO
|
79
66
|
- lib/.gitignore
|
80
67
|
- lib/sadie.rb
|
81
68
|
- lib/sadie/defaults.rb
|
@@ -114,36 +101,26 @@ files:
|
|
114
101
|
- test/test_primers/two/deep/two_results.res
|
115
102
|
homepage: http://www.landmetrics.com/Sadie
|
116
103
|
licenses: []
|
117
|
-
|
118
104
|
post_install_message:
|
119
105
|
rdoc_options: []
|
120
|
-
|
121
|
-
require_paths:
|
106
|
+
require_paths:
|
122
107
|
- lib
|
123
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
109
|
none: false
|
125
|
-
requirements:
|
126
|
-
- -
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
|
129
|
-
|
130
|
-
- 0
|
131
|
-
version: "0"
|
132
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
115
|
none: false
|
134
|
-
requirements:
|
135
|
-
- -
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
|
138
|
-
segments:
|
139
|
-
- 0
|
140
|
-
version: "0"
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
141
120
|
requirements: []
|
142
|
-
|
143
121
|
rubyforge_project: sadie
|
144
|
-
rubygems_version: 1.
|
122
|
+
rubygems_version: 1.8.15
|
145
123
|
signing_key:
|
146
124
|
specification_version: 3
|
147
125
|
summary: A gem that provides sadie, a data access framework
|
148
126
|
test_files: []
|
149
|
-
|