sadie 0.0.39 → 0.0.40
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
@@ -12,5 +12,6 @@
|
|
12
12
|
[0.0.17] bugfixes, updated tests
|
13
13
|
[0.0.18...0.0.34] bugfixes, working on more natural integration with olsen
|
14
14
|
[0.0.35] initializePrimers is no longer called by constructor...must now call manually before using get method
|
15
|
-
[0.0.
|
16
|
-
enhancement that offers a huge optimization path with very low developer resources
|
15
|
+
[0.0.39] added lots of debugging that's going to need to come out, but also added eachers, a VERY cool
|
16
|
+
enhancement that offers a huge optimization path with very low developer resources
|
17
|
+
[0.0.40] removed over-debugging
|
@@ -4,9 +4,7 @@ Sadie::registerPrimerPlugin( { "match" => /\.sql2ar$/,
|
|
4
4
|
primer_file_basename = File.basename( primer_file_filepath )
|
5
5
|
sadie_key = key_prefix + '.' + primer_file_basename
|
6
6
|
sadie_key = sadie_key.gsub(/^\./,"")
|
7
|
-
puts "DEFINING sql2ar primer for: #{sadie_key}"
|
8
7
|
Sadie::prime( { "provides" => [ sadie_key ] }) do |sadie|
|
9
|
-
puts "priming via sql2ar for: #{sadie_key}"
|
10
8
|
if ( matches = primer_file_basename.match( /^(.*)\.([^\.]+)\.sql2ar$/ ) )
|
11
9
|
dbi_sadie_key = key_prefix + '.' + matches[2] + ".dbi.conx"
|
12
10
|
dbconx = sadie.get( dbi_sadie_key )
|
@@ -16,12 +14,9 @@ Sadie::registerPrimerPlugin( { "match" => /\.sql2ar$/,
|
|
16
14
|
sth = dbconx.prepare(sql_query)
|
17
15
|
sth.execute
|
18
16
|
|
19
|
-
|
20
|
-
puts "looping thru db query results"
|
21
17
|
result = Array.new
|
22
18
|
while row = sth.fetch
|
23
19
|
row_as_array = row.to_a
|
24
|
-
puts "calling eacherFrame each for sadiekey: #{sadie_key}"
|
25
20
|
Sadie::eacherFrame sadie_key, Sadie::EACH, row_as_array
|
26
21
|
result.push row_as_array
|
27
22
|
end
|
data/lib/sadie/version.rb
CHANGED
data/lib/sadie.rb
CHANGED
@@ -67,10 +67,8 @@ class Sadie
|
|
67
67
|
# store the file path
|
68
68
|
defined? @eacher_filepaths or @eacher_filepaths = Hash.new
|
69
69
|
if ! @eacher_filepaths.has_key? sadiekey
|
70
|
-
puts "memorizing eacher filepath #{filepath} for sadiekey: #{sadiekey}"
|
71
70
|
@eacher_filepaths[sadiekey] = [filepath]
|
72
71
|
elsif ! @eacher_filepaths[sadiekey].include? filepath
|
73
|
-
puts "memorizing eacher filepath #{filepath} for sadiekey: #{sadiekey}"
|
74
72
|
@eacher_filepaths[sadiekey].push filepath
|
75
73
|
end
|
76
74
|
end
|
@@ -95,37 +93,11 @@ class Sadie
|
|
95
93
|
@eacher_init = nil
|
96
94
|
end
|
97
95
|
|
98
|
-
# ==method: Sadie::eacher
|
99
|
-
#
|
100
|
-
# called by eacher files to hook into priming operations
|
101
|
-
# def self.eacher( eacher_params, &block )
|
102
|
-
# puts "HERE!!!"
|
103
|
-
# current_sadie_instance = Sadie::getCurrentSadieInstance
|
104
|
-
# filepath = current_sadie_instance.getCurrentPrimerFilepath
|
105
|
-
# key_prefix = current_sadie_instance.getCurrentPrimerKeyPrefix
|
106
|
-
#
|
107
|
-
# occur_at = eacher_params[:when]
|
108
|
-
# puts "eacher, occur_at: #{occur_at}"
|
109
|
-
#
|
110
|
-
# # gen sadie key
|
111
|
-
# basefilename = filepath.gsub(/^.*\//,"")
|
112
|
-
# sadiekey = key_prefix + "." + basefilename.gsub(/\.each(?:\..*)$/,"")
|
113
|
-
# if eacher_params.has_key? "sadiekey"
|
114
|
-
# sadiekey = eacher_params["sadiekey"]
|
115
|
-
# end
|
116
|
-
#
|
117
|
-
# if current_sadie_instance.midEacherInit?
|
118
|
-
# memorizeEacherFileLocation( sadiekey, filepath )
|
119
|
-
# elsif current_sadie_instance.whichEacherFrame == occur_at
|
120
|
-
# current_sadie_instance.eacher( eacher_params, &block )
|
121
|
-
# end
|
122
|
-
# end
|
123
96
|
|
124
97
|
def eacher( params, &block )
|
125
98
|
filepath = getCurrentPrimerFilepath
|
126
99
|
key_prefix = getCurrentPrimerKeyPrefix
|
127
100
|
occur_at = params[:when]
|
128
|
-
# puts "eacher, occur_at: #{occur_at}"
|
129
101
|
|
130
102
|
# gen sadie key
|
131
103
|
basefilename = filepath.gsub(/^.*\//,"")
|
@@ -158,7 +130,6 @@ class Sadie
|
|
158
130
|
end
|
159
131
|
|
160
132
|
def setEachersProvidedByPrimer( sadiekey, providers )
|
161
|
-
puts "setting eachers to be provided by #{sadiekey} primer to #{providers}"
|
162
133
|
|
163
134
|
# record reverse map for use by eacherFrame
|
164
135
|
defined? @eacher_frame_redirect \
|
@@ -188,13 +159,14 @@ class Sadie
|
|
188
159
|
end
|
189
160
|
|
190
161
|
def getEachersProvidedByPrimer( sadiekey )
|
191
|
-
puts "looking for eachers provided by: #{sadiekey}"
|
192
162
|
defined? @eachers_provided or return nil
|
193
163
|
@eachers_provided.has_key? sadiekey or return nil
|
194
|
-
puts "found eachers for #{sadiekey}"
|
195
164
|
@eachers_provided[sadiekey]
|
196
165
|
end
|
197
166
|
|
167
|
+
# ==method: Sadie::eacher
|
168
|
+
#
|
169
|
+
# called by eacher files to hook into priming operations
|
198
170
|
def self.eacher( eacher_params, &block )
|
199
171
|
current_sadie_instance = Sadie::getCurrentSadieInstance
|
200
172
|
current_sadie_instance.eacher( eacher_params, &block )
|
@@ -215,11 +187,9 @@ class Sadie
|
|
215
187
|
end
|
216
188
|
end
|
217
189
|
|
218
|
-
puts "eacherFrame (#{key},#{occur_at})"
|
219
190
|
setEacherFrame( occur_at )
|
220
191
|
defined? param and setEacherParam( param )
|
221
192
|
if filepaths = eacherFilepaths( key )
|
222
|
-
# puts "found each file paths for key: #{key}, filepaths: #{filepaths}"
|
223
193
|
filepaths.each do |filepath|
|
224
194
|
load filepath
|
225
195
|
end
|
@@ -251,6 +221,7 @@ class Sadie
|
|
251
221
|
def getEacherParam
|
252
222
|
@eacher_param
|
253
223
|
end
|
224
|
+
|
254
225
|
# == initialize eachers
|
255
226
|
#
|
256
227
|
# register all the eachers
|
@@ -434,8 +405,6 @@ class Sadie
|
|
434
405
|
return self
|
435
406
|
end
|
436
407
|
|
437
|
-
|
438
|
-
|
439
408
|
def prime( primer_definition, &block )
|
440
409
|
# validate params
|
441
410
|
defined? primer_definition \
|
@@ -907,19 +876,6 @@ class Sadie
|
|
907
876
|
primer_provides.each do | key |
|
908
877
|
setPrimerProvider( key, filepath, plugin_filepath, getCurrentPrimerKeyPrefix )
|
909
878
|
|
910
|
-
# # handle eachers
|
911
|
-
# if eachers_provided = getEachersProvidedByPrimer( key )
|
912
|
-
# eachers_provided.each do |eacherkey|
|
913
|
-
#
|
914
|
-
# # Sadie::prime( { "provides" => [ eacherkey ] }) do |sadie|
|
915
|
-
# # puts "calling sadie.get(#{key} to produce #{eacherkey}"
|
916
|
-
# # sadie.get key
|
917
|
-
# # end
|
918
|
-
#
|
919
|
-
# # puts "setting eacher #{eacherkey} to be provided by file: #{filepath}"
|
920
|
-
# # setPrimerProvider( eacherkey, filepath, plugin_filepath, getCurrentPrimerKeyPrefix )
|
921
|
-
# end
|
922
|
-
# end
|
923
879
|
end
|
924
880
|
|
925
881
|
end
|
@@ -969,7 +925,6 @@ class Sadie
|
|
969
925
|
end
|
970
926
|
|
971
927
|
def _prime ( k )
|
972
|
-
puts ">>>priming: #{k}"
|
973
928
|
|
974
929
|
if isEacherKey? k
|
975
930
|
get( getEacherDependency( k ) )
|
@@ -977,7 +932,6 @@ class Sadie
|
|
977
932
|
|
978
933
|
Sadie::eacherFrame( k, BEFORE )
|
979
934
|
if provider = getPrimerProvider( k )
|
980
|
-
puts "got provider for sadiekey: #{k}"
|
981
935
|
primer_filepath, plugin_filepath, key_prefix = provider
|
982
936
|
|
983
937
|
setCurrentPrimerFilepath(primer_filepath)
|
data/test/tc_sadie_twodeep.rb
CHANGED
@@ -27,24 +27,18 @@ class TestSadieTwoDeep < Test::Unit::TestCase
|
|
27
27
|
assert_not_nil( dbconx )
|
28
28
|
|
29
29
|
# test eacher
|
30
|
-
puts "!!!"
|
31
|
-
puts "!!!"
|
32
30
|
eachertest = sadie.get("simple.eacher.test")
|
33
|
-
|
31
|
+
assert_equal( eachertest, "start12end")
|
34
32
|
|
35
33
|
# test sqlTo2DArray
|
36
34
|
tablearray = sadie.get( "two.deep.testquery.test.sql2ar" )
|
37
|
-
puts "!!!"
|
38
|
-
puts "!!!"
|
39
35
|
assert_not_nil( tablearray )
|
40
|
-
puts "tablearray: #{tablearray}"
|
41
36
|
assert_equal( tablearray[0][0], 1 )
|
42
37
|
assert_equal( tablearray[1][1], "testing456" )
|
43
38
|
|
44
39
|
# test templating
|
45
40
|
template_text = sadie.get( "two.deep.test_template.txt.tmpl" )
|
46
41
|
template_text = template_text.gsub(/\s+/," ").gsub(/^\s*/,"").gsub(/\s*$/,"")
|
47
|
-
puts "template text\n#{template_text}"
|
48
42
|
assert( (template_text.match(/later\s+gator/)), "incorrect match on template text" )
|
49
43
|
assert( (template_text.match(/test\/test\_primers/)), "incorrect match on template text" )
|
50
44
|
end
|
@@ -2,18 +2,15 @@ require 'sadie'
|
|
2
2
|
|
3
3
|
Sadie::eacher( :when => Sadie::BEFORE ) do |sadie|
|
4
4
|
@testeach = "start"
|
5
|
-
puts "testeach[start]: #{@testeach}"
|
6
5
|
end
|
7
6
|
|
8
7
|
Sadie::eacher( :when => Sadie::EACH, :sadiekey => "two.deep.testquery.test.sql2ar" ) do |sadie,param|
|
9
8
|
@testeach = "#{@testeach}#{param[0]}"
|
10
|
-
puts "testeach[each]: #{@testeach}"
|
11
9
|
end
|
12
10
|
|
13
11
|
Sadie::eacher( :when => Sadie::AFTER, :provides => ["simple.eacher.test"] ) do |sadie|
|
14
12
|
@testeach = "#{@testeach}end"
|
15
13
|
sadie.set "simple.eacher.test", @testeach
|
16
|
-
puts "testeach[end]: #{@testeach}"
|
17
14
|
end
|
18
15
|
|
19
16
|
#def dsl_correct?; ( bitch_to_wrap_head_around? ) && ( rewritten_atleast_three_times? ) && ( seems_easy_now_that_its_done? ) && ( have_less_hair_now? ); end
|
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.40
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-04-20 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dbi
|
16
|
-
requirement: &
|
16
|
+
requirement: &23113620 !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: *23113620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mysql
|
27
|
-
requirement: &
|
27
|
+
requirement: &23113200 !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: *23113200
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dbd-mysql
|
38
|
-
requirement: &
|
38
|
+
requirement: &23162880 !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: *23162880
|
47
47
|
description: Sadie is a data framework intended to ease the pain of managing related
|
48
48
|
data.
|
49
49
|
email:
|