collin-lucky7 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/README +65 -0
  2. data/Rakefile.rb +55 -0
  3. data/config/environment.rb +9 -0
  4. data/lib/jabs.rb +9 -0
  5. data/lib/jass.rb +23 -0
  6. data/lib/jsspec/example.html.jass +180 -0
  7. data/lib/jsspec/layout.html.haml +14 -0
  8. data/lib/lucky7.rb +5 -0
  9. data/lib/lucky7/builder.rb +140 -0
  10. data/lib/lucky7/renders.rb +9 -0
  11. data/rspec/fixtures/lucky7/build/app/layout.html +4 -0
  12. data/rspec/fixtures/lucky7/src/app/_category.html.haml +2 -0
  13. data/rspec/fixtures/lucky7/src/app/_header.html.haml +7 -0
  14. data/rspec/fixtures/lucky7/src/app/_page_link.html.haml +2 -0
  15. data/rspec/fixtures/lucky7/src/app/_pagination.html.haml +3 -0
  16. data/rspec/fixtures/lucky7/src/app/_result.html.haml +3 -0
  17. data/rspec/fixtures/lucky7/src/app/_result_set.html.haml +4 -0
  18. data/rspec/fixtures/lucky7/src/app/_side_bar.html.haml +3 -0
  19. data/rspec/fixtures/lucky7/src/app/behavior.css.sass +3 -0
  20. data/rspec/fixtures/lucky7/src/app/controller.js.jabs +3 -0
  21. data/rspec/fixtures/lucky7/src/app/fixture_spec.html.jass +6 -0
  22. data/rspec/fixtures/lucky7/src/app/layout.html.haml +4 -0
  23. data/rspec/fixtures/lucky7/src/app/no_results.html.haml +10 -0
  24. data/rspec/fixtures/lucky7/src/app/results.html.haml +5 -0
  25. data/rspec/jabs/jabs_engine_spec.rb +3 -0
  26. data/rspec/jabs/jabs_precompiler_spec.rb +50 -0
  27. data/rspec/jabs_spec.rb +15 -0
  28. data/rspec/jabs_spec_helper.rb +2 -0
  29. data/rspec/jass/jass_engine_spec.rb +1 -0
  30. data/rspec/jass/jass_precompiler_spec.rb +49 -0
  31. data/rspec/jass_spec.rb +15 -0
  32. data/rspec/lucky7/builder_spec.rb +322 -0
  33. data/rspec/lucky7/renders_spec.rb +13 -0
  34. data/rspec/lucky7_spec.rb +19 -0
  35. data/rspec/lucky7_spec_helper.rb +1 -0
  36. data/rspec/spec_helper.rb +3 -0
  37. data/templates/environment/[environment].rb +1 -0
  38. data/templates/skeleton/[application]/README +1 -0
  39. data/templates/skeleton/[application]/Rakefile.rb +1 -0
  40. data/templates/skeleton/[application]/environment/environment.rb +1 -0
  41. data/vendor/jquery/jquery-1.2.6.js +3549 -0
  42. data/vendor/jquery/jquery-1.2.6.min.js +32 -0
  43. data/vendor/jquery/jquery-1.2.6.pack.js.gz +11 -0
  44. data/vendor/jquery/jquery.simulate.js +152 -0
  45. data/vendor/js_spec/JSSpec.css +224 -0
  46. data/vendor/js_spec/JSSpec.js +1548 -0
  47. data/vendor/js_spec/copying +459 -0
  48. data/vendor/js_spec/demo.html +210 -0
  49. data/vendor/js_spec/diff_match_patch.js +1 -0
  50. data/vendor/js_spec/example.spec.html +198 -0
  51. data/vendor/js_spec/exp/build.properties +1 -0
  52. data/vendor/js_spec/exp/build.xml +9 -0
  53. data/vendor/js_spec/exp/lib/diff_match_patch.js +1 -0
  54. data/vendor/js_spec/exp/lib/js.jar +0 -0
  55. data/vendor/js_spec/exp/src/JSSpec2.js +356 -0
  56. data/vendor/js_spec/exp/src/JSSpec2_spec.js +238 -0
  57. data/vendor/js_spec/sample/datetime/String_Parser.html +22 -0
  58. data/vendor/js_spec/sample/datetime/datetime.js +24 -0
  59. data/vendor/orbited/ez_setup.py +272 -0
  60. data/vendor/orbited/pyevent-0.3/Makefile +18 -0
  61. data/vendor/orbited/pyevent-0.3/build/lib.linux-i686-2.5/event.so +0 -0
  62. data/vendor/orbited/pyevent-0.3/build/temp.linux-i686-2.5/event.o +0 -0
  63. data/vendor/orbited/pyevent-0.3/changes +9 -0
  64. data/vendor/orbited/pyevent-0.3/cvs/Entries +9 -0
  65. data/vendor/orbited/pyevent-0.3/cvs/Repository +1 -0
  66. data/vendor/orbited/pyevent-0.3/cvs/Root +1 -0
  67. data/vendor/orbited/pyevent-0.3/event.c +2516 -0
  68. data/vendor/orbited/pyevent-0.3/event.pyx +280 -0
  69. data/vendor/orbited/pyevent-0.3/license +29 -0
  70. data/vendor/orbited/pyevent-0.3/readme +12 -0
  71. data/vendor/orbited/pyevent-0.3/setup.py +61 -0
  72. data/vendor/orbited/pyevent-0.3/test.py +73 -0
  73. data/vendor/orbited/ruby-orbited.rb +84 -0
  74. metadata +188 -0
@@ -0,0 +1,9 @@
1
+ module Lucky7
2
+ module Renders
3
+ class << self
4
+ def render template, object="__context"
5
+ "={\"#{template}\":#{object}}"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ ={"side_bar":__context}
2
+ ={"header":__context}
3
+ <hr />
4
+ yield
@@ -0,0 +1,2 @@
1
+ %li
2
+ %a{:href=>"#"} #{name} (#{count})
@@ -0,0 +1,7 @@
1
+ %p
2
+ Found
3
+ %strong #{totalResults}
4
+ results for
5
+ %strong "#{query}"
6
+ in
7
+ %strong "#{category}"
@@ -0,0 +1,2 @@
1
+ %li{:class=>'#{class}'}
2
+ =#{name}
@@ -0,0 +1,3 @@
1
+ %ol.pagination
2
+ Page:
3
+ = render :page_link, :pages
@@ -0,0 +1,3 @@
1
+ %div
2
+ = render :category
3
+ = render :page_link, :using => :links
@@ -0,0 +1,4 @@
1
+ %div
2
+ = render :category
3
+ %ul
4
+ = render :result, :links
@@ -0,0 +1,3 @@
1
+ %ul
2
+ %p Show Results In:
3
+ = render :category, :categories
@@ -0,0 +1,3 @@
1
+ #beans
2
+ :color pink
3
+
@@ -0,0 +1,3 @@
1
+ /**
2
+ * @author cmiller
3
+ */
@@ -0,0 +1,6 @@
1
+ describe Magic Machine
2
+ it casts a spell
3
+ expect(MagicMagine).should_have('spellCasting');
4
+
5
+ it has moving parts
6
+ expect(MagicMachine).should_have('movingParts');
@@ -0,0 +1,4 @@
1
+ = render :side_bar
2
+ = render :header
3
+ %hr/
4
+ yield
@@ -0,0 +1,10 @@
1
+ %p Sorry, your search did not return any results. Please revise your search or follow some of these suggestions to find what you're looking for.
2
+ %ul
3
+ %li Check the spelling of your keywords
4
+ %li Try other keywords
5
+ %li Try more general keywords and use the category and sort features to narrow your results
6
+ %hr/
7
+ %p.try-again Search again?
8
+ %input{:type=>:text}
9
+ %input{:type=>:submit, :value=>'Search'}
10
+
@@ -0,0 +1,5 @@
1
+ = render :header
2
+ %hr/
3
+ = render :pagination
4
+ = render :result_set, :using => :categories
5
+
@@ -0,0 +1,3 @@
1
+ require 'rspec/jabs_spec_helper'
2
+
3
+
@@ -0,0 +1,50 @@
1
+ require 'rspec/jabs_spec_helper'
2
+
3
+ describe Jabs::Precompiler, ".defined_folds" do
4
+ it "defines Line" do
5
+ Jabs::Precompiler.defined_folds.should include(Jabs::Precompiler::Line)
6
+ end
7
+
8
+ it "defines Action" do
9
+ Jabs::Precompiler.defined_folds.should include(Jabs::Precompiler::Action)
10
+ end
11
+
12
+ it "defines Selector" do
13
+ Jabs::Precompiler.defined_folds.should include(Jabs::Precompiler::Selector)
14
+ end
15
+ end
16
+
17
+ describe Jabs::Precompiler, ".produce" do
18
+ before(:each) {@it= Jabs::Precompiler.new}
19
+
20
+ it "produces Lines" do
21
+ @it.produce('LINE').is_a?(Jabs::Precompiler::Line).should == true
22
+ end
23
+
24
+ it "produces Actions" do
25
+ @it.produce('!LINE').is_a?(Jabs::Precompiler::Action).should == true
26
+ end
27
+
28
+ it "produces Selectors" do
29
+ @it.produce('?LINE').is_a?(Jabs::Precompiler::Selector).should == true
30
+ end
31
+ end
32
+
33
+ describe Jabs::Precompiler::Line::Regex do
34
+ it "should match anything" do
35
+ Jabs::Precompiler::Line::Regex.should match('anything')
36
+ end
37
+ end
38
+
39
+ describe Jabs::Precompiler::Action::Regex do
40
+ it "should match !actions" do
41
+ Jabs::Precompiler::Action::Regex.should match("!actions")
42
+ end
43
+ end
44
+
45
+ describe Jabs::Precompiler::Selector::Regex do
46
+ it "should match ?selectors" do
47
+ Jabs::Precompiler::Selector::Regex.should match("?selectors")
48
+ end
49
+ end
50
+
@@ -0,0 +1,15 @@
1
+ require 'rspec/jabs_spec_helper'
2
+
3
+ describe Jabs do
4
+ it "inherits Module" do
5
+ Jabs.class.should == Module
6
+ end
7
+
8
+ it "has an Engine Class" do
9
+ Jabs.constants.should include("Engine")
10
+ end
11
+
12
+ it "has a precompiler class" do
13
+ Jabs.constants.should include("Precompiler")
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ require 'rspec/spec_helper'
2
+
@@ -0,0 +1 @@
1
+ require 'rspec/spec_helper'
@@ -0,0 +1,49 @@
1
+ require 'rspec/spec_helper'
2
+
3
+ describe Jass::Precompiler, ".defined_folds" do
4
+ it "defines Line" do
5
+ Jass::Precompiler.defined_folds.should include(Jass::Precompiler::Line)
6
+ end
7
+
8
+ it "defines Action" do
9
+ Jass::Precompiler.defined_folds.should include(Jass::Precompiler::ExampleGroup)
10
+ end
11
+
12
+ it "defines Selector" do
13
+ Jass::Precompiler.defined_folds.should include(Jass::Precompiler::Example)
14
+ end
15
+ end
16
+
17
+ describe Jass::Precompiler, ".produce" do
18
+ before(:each) {@it= Jass::Precompiler.new}
19
+
20
+ it "produces Lines" do
21
+ @it.produce('LINE').is_a?(Jass::Precompiler::Line).should == true
22
+ end
23
+
24
+ it "produces ExampleGroups" do
25
+ @it.produce('describe LINE').is_a?(Jass::Precompiler::ExampleGroup).should == true
26
+ end
27
+
28
+ it "produces Examples" do
29
+ @it.produce('it LINE').is_a?(Jass::Precompiler::Example).should == true
30
+ end
31
+ end
32
+
33
+ describe Jass::Precompiler::Line::Regex do
34
+ it "should match anything" do
35
+ Jass::Precompiler::Line::Regex.should match('anything')
36
+ end
37
+ end
38
+
39
+ describe Jass::Precompiler::ExampleGroup::Regex do
40
+ it "should match example groups" do
41
+ Jass::Precompiler::ExampleGroup::Regex.should match("describe Something!")
42
+ end
43
+ end
44
+
45
+ describe Jass::Precompiler::Example::Regex do
46
+ it "should match examples" do
47
+ Jass::Precompiler::Example::Regex.should match("it behaves thusly")
48
+ end
49
+ end
@@ -0,0 +1,15 @@
1
+ require 'rspec/spec_helper'
2
+
3
+ describe Jass do
4
+ it "inherits Module" do
5
+ Jass.class.should == Module
6
+ end
7
+
8
+ it "has an Engine Class" do
9
+ Jass.constants.should include("Engine")
10
+ end
11
+
12
+ it "has a precompiler class" do
13
+ Jass.constants.should include("Precompiler")
14
+ end
15
+ end
@@ -0,0 +1,322 @@
1
+ require 'rspec/lucky7_spec_helper'
2
+
3
+ include Lucky7
4
+ include Builder
5
+
6
+ Builder.const_set :Lucky7Root, FixtureRoot
7
+
8
+ HamlRegex= /html\.haml/
9
+ SassRegex= /css\.sass/
10
+ JabsRegex= /\.js/
11
+ SpecRegex= /html\.jass/
12
+ FixtureRegex= /fixtures/
13
+
14
+ def modify_file! file="#{Builder::Lucky7Root}/src/app/layout.html.haml"
15
+ stamp = File.mtime(file) + 5000
16
+ command = File.utime(stamp, stamp, file)
17
+ end
18
+
19
+ describe modify_file! do
20
+ it "sends a file into the future" do
21
+ file = "#{Builder::Lucky7Root}/src/app/layout.html.haml"
22
+ past = File.mtime(file)
23
+ File.stat(file).mtime.should >= past
24
+ end
25
+ end
26
+
27
+
28
+ describe Builder do
29
+ it "inherits Module" do
30
+ Builder.class.should == Module
31
+ end
32
+
33
+ describe Lucky7Root do
34
+ it "is a fixture" do
35
+ Builder::Lucky7Root.match(FixtureRegex).should_not == nil
36
+ end
37
+ end
38
+
39
+ describe ".build" do
40
+ before(:each) do
41
+ Builder.cache_mtimes!
42
+ end
43
+
44
+ it "builds spec files" do
45
+ Builder.should_receive(:build_spec).once
46
+ Builder.build
47
+ end
48
+
49
+ it "builds haml files" do
50
+ Builder.should_receive(:build_haml).once
51
+ Builder.build
52
+ end
53
+
54
+ it "builds sass files" do
55
+ Builder.should_receive(:build_sass).once
56
+ Builder.build
57
+ end
58
+
59
+ it "builds jabs files" do
60
+ Builder.should_receive(:build_jabs).once
61
+ Builder.build
62
+ end
63
+
64
+ it "packs" do
65
+ Builder.should_receive(:pack).once
66
+ Builder.build
67
+ end
68
+ end
69
+
70
+ describe ".build_path_for" do
71
+ it "constructs a build path" do
72
+ Builder.build_path_for(:extension, "#{Lucky7Root}/src/some_file.extension_.processor").should == "#{Lucky7Root}/build/some_file.extension"
73
+ end
74
+
75
+ it "maintains path depth" do
76
+ Builder.build_path_for(:extension, "#{Lucky7Root}/src/place/some_file.extension_.processor").should == "#{Lucky7Root}/build/place/some_file.extension"
77
+ end
78
+
79
+ it "builds multi dot files" do
80
+ Builder.build_path_for("spec.html", "#{Lucky7Root}/src/place/some_file.extension.processor").should == "#{Lucky7Root}/build/place/some_file.spec.html"
81
+ end
82
+ end
83
+
84
+ describe ".files" do
85
+ it "contains haml files" do
86
+ Builder.files[:haml].should_not be_empty
87
+ end
88
+
89
+ it "contains jabs files" do
90
+ Builder.files[:jabs].should_not be_empty
91
+ end
92
+
93
+ it "contains sass files" do
94
+ Builder.files[:sass].should_not be_empty
95
+ end
96
+
97
+ it "contains spec files" do
98
+ Builder.files[:spec].should_not be_empty
99
+ end
100
+ end
101
+
102
+ describe ".files_flattened" do
103
+ it "returns an array" do
104
+ Builder.files_flattened.class.should == Array
105
+ end
106
+
107
+ it "is flat" do
108
+ files = Builder.files_flattened
109
+ files.should == files.flatten
110
+ end
111
+ end
112
+
113
+ describe ".mtimes" do
114
+ it "returns a hash" do
115
+ Builder.mtimes.class.should == Hash
116
+ end
117
+
118
+ it "keys are filenames" do
119
+ Builder.mtimes.reject{|key, value| File.exists? key}.should be_empty
120
+ end
121
+
122
+ it "values are Times" do
123
+ Builder.mtimes.reject{|key, value| value.is_a? Time}.should be_empty
124
+ end
125
+ end
126
+
127
+ describe ".build_haml" do
128
+ before(:each) do
129
+ @src= Dir.glob "#{Builder::Lucky7Root}/src/app/*.html.haml"
130
+ @build_glob= "#{Builder::Lucky7Root}/build/app/*.html"
131
+ build= Dir.glob @build_glob
132
+ FileUtils.rm build, :force => true
133
+ end
134
+
135
+ it "renders html documents" do
136
+ Builder.build_haml(@src)
137
+ Dir.glob(@build_glob).length.should == @src.length
138
+ end
139
+ end
140
+
141
+ describe ".build_sass" do
142
+ before(:each) do
143
+ @src= Dir.glob "#{Builder::Lucky7Root}/src/app/*.css.sass"
144
+ @build_glob= "#{Builder::Lucky7Root}/build/app/*.css"
145
+ build= Dir.glob @build_glob
146
+ FileUtils.rm build, :force => true
147
+ end
148
+
149
+ it "renders css files" do
150
+ Builder.build_sass(@src)
151
+ Dir.glob(@build_glob).length.should == @src.length
152
+ end
153
+ end
154
+
155
+ describe ".build_spec" do
156
+ before(:each) do
157
+ @src= Dir.glob "#{Builder::Lucky7Root}/src/app/*.spec.yaml"
158
+ @build_glob= "#{Builder::Lucky7Root}/build/app/*.spec.html"
159
+ build= Dir.glob @build_glob
160
+ FileUtils.rm build, :force => true
161
+ end
162
+
163
+ it "renders jsspec files" do
164
+ Builder.build_spec(@src)
165
+ Dir.glob(@build_glob).length.should == @src.length
166
+ end
167
+ end
168
+
169
+ describe ".haml_render_context" do
170
+ it "is Lucky7::Renders" do
171
+ Builder.haml_render_context.should == Lucky7::Renders
172
+ end
173
+ end
174
+
175
+ describe ".modified_files" do
176
+ before(:each) do
177
+ Builder.cache_mtimes!
178
+ end
179
+
180
+ it "returns a Hash" do
181
+ Builder.modified_files.class.should == Hash
182
+ end
183
+
184
+ it "contains modified files names" do
185
+ modify_file!
186
+ Builder.modified_files[:haml].should_not be_empty
187
+ end
188
+
189
+ it "ignores unmodified files" do
190
+ Builder.modified_files[:haml].should be_empty
191
+ end
192
+
193
+ it "contains new files" do
194
+ file = "#{Builder::Lucky7Root}/src/app/touche.js.jabs"
195
+ FileUtils.touch(file)
196
+ Builder.modified_files[:jabs].should include(file)
197
+ FileUtils.rm(file)
198
+ end
199
+ end
200
+
201
+ describe ".cache_mtimes!" do
202
+ it "caches_mtimes" do
203
+ Builder.cache_mtimes!
204
+ Builder.instance_variable_get(:@cached_mtimes).should == Builder.mtimes
205
+ end
206
+ end
207
+
208
+ describe ".cached_mtimes" do
209
+ before(:each) do
210
+ Builder.cache_mtimes!
211
+ end
212
+
213
+ it "returns a hash" do
214
+ Builder.cached_mtimes.class.should == Hash
215
+ end
216
+
217
+ it "same as mtimes if no change" do
218
+ Builder.cached_mtimes.should == Builder.mtimes
219
+ end
220
+
221
+ it "holds old mtimes" do
222
+ modify_file!
223
+ Builder.cached_mtimes.should_not == Builder.mtimes
224
+ end
225
+ end
226
+
227
+ describe ".ensure_build_path!" do
228
+ it "makes all parent dirs" do
229
+ Builder.ensure_build_path! "#{Builder::Lucky7Root}/build/app/layout.html.haml"
230
+ File.exists?("#{Builder::Lucky7Root}/build/app/").should == true
231
+ FileUtils.rm_rf "#{Builder::Lucky7Root}/build/app"
232
+ end
233
+ end
234
+
235
+ describe ".build_continuously" do
236
+ it "caches mtimes" do
237
+ Builder.should_receive(:cache_mtimes!).once
238
+ Builder.build_continuously false
239
+ end
240
+
241
+ it "builds" do
242
+ Builder.should_receive(:build).once
243
+ Builder.build_continuously false
244
+ end
245
+ end
246
+
247
+ describe ".haml_glob" do
248
+ it "globs haml files" do
249
+ Dir.glob(Builder.haml_glob).should_not be_empty
250
+ end
251
+
252
+ it "globs only haml files" do
253
+ Dir.glob(Builder.haml_glob).reject{|file| file.match HamlRegex}.should be_empty
254
+ end
255
+ end
256
+
257
+ describe ".sass_glob" do
258
+ it "globs sass files" do
259
+ Dir.glob(Builder.sass_glob).should_not be_empty
260
+ end
261
+
262
+ it "globs only sass files" do
263
+ Dir.glob(Builder.sass_glob).reject{|file| file.match SassRegex}.should be_empty
264
+ end
265
+ end
266
+
267
+ describe "jabs_glob" do
268
+ it "globs jabs files" do
269
+ Dir.glob(Builder.jabs_glob).should_not be_empty
270
+ end
271
+
272
+ it "globs only jabs files" do
273
+ Dir.glob(Builder.jabs_glob).reject{|file| file.match JabsRegex}.should be_empty
274
+ end
275
+ end
276
+
277
+ describe "spec_glob" do
278
+ it "globs spec files" do
279
+ Dir.glob(Builder.spec_glob).should_not be_empty
280
+ end
281
+
282
+ it "globs only spec files" do
283
+ Dir.glob(Builder.spec_glob).reject{|file| file.match SpecRegex}.should be_empty
284
+ end
285
+ end
286
+ end
287
+
288
+ describe HamlRegex do
289
+ it "matches haml file names" do
290
+ HamlRegex.match("template.html.haml").should_not == nil
291
+ end
292
+ end
293
+
294
+ describe SassRegex do
295
+ it "matches sass file names" do
296
+ SassRegex.match("stylesheet.css.sass").should_not == nil
297
+ end
298
+ end
299
+
300
+ describe JabsRegex do
301
+ it "matches jabs file names" do
302
+ JabsRegex.match("demandlet.js.jabs").should_not == nil
303
+ end
304
+ end
305
+
306
+ describe SpecRegex do
307
+ it "matches spec file names" do
308
+ SpecRegex.match("demandlet.html.jass").should_not == nil
309
+ end
310
+ end
311
+
312
+ describe SrcRegex do
313
+ it "matches 'src'" do
314
+ SrcRegex.match("string-with-src-in-it").should_not == nil
315
+ end
316
+ end
317
+
318
+ describe BuildDirectory do
319
+ it "is 'build'" do
320
+ BuildDirectory.should == 'build'
321
+ end
322
+ end