big_band 0.2.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/LICENSE +1 -1
  2. data/README.md +82 -0
  3. data/Rakefile +50 -170
  4. data/TODO.md +50 -0
  5. data/lib/big_band.rb +13 -258
  6. data/lib/sinatra/big_band.rb +65 -1
  7. data/spec/sinatra/big_band_spec.rb +32 -0
  8. data/spec/spec_helper.rb +2 -4
  9. data/subproject.rb +42 -0
  10. data/tasks/doc.task +9 -0
  11. data/tasks/gem.task +10 -0
  12. data/tasks/git.task +41 -0
  13. data/tasks/setup.task +34 -0
  14. data/tasks/spec.task +24 -0
  15. metadata +200 -140
  16. data/README.rdoc +0 -346
  17. data/README.rdoc.erb +0 -39
  18. data/big_band.gemspec +0 -25
  19. data/dependencies.rb +0 -12
  20. data/depgen/README.rdoc +0 -7
  21. data/depgen/Rakefile +0 -23
  22. data/depgen/depgen.rb +0 -123
  23. data/depgen/depgen.task +0 -42
  24. data/depgen/depgen_spec.rb +0 -127
  25. data/deps.rip +0 -8
  26. data/example/example.rb +0 -13
  27. data/example/views/index.haml +0 -8
  28. data/example/views/layout.haml +0 -2
  29. data/example/views/stylesheets/_base.sass +0 -1
  30. data/example/views/stylesheets/screen.sass +0 -12
  31. data/lib/big_band/advanced_routes.rb +0 -188
  32. data/lib/big_band/basic_extensions.rb +0 -176
  33. data/lib/big_band/compass.rb +0 -94
  34. data/lib/big_band/compass/big_band.rb +0 -4
  35. data/lib/big_band/compass/stylesheets/_big_band.sass +0 -1
  36. data/lib/big_band/compass/stylesheets/big_band/_blueprint.sass +0 -1
  37. data/lib/big_band/compass/stylesheets/big_band/_utilities.sass +0 -6
  38. data/lib/big_band/compass/stylesheets/big_band/blueprint/_html5.sass +0 -4
  39. data/lib/big_band/compass/stylesheets/big_band/layouts/_inspector.sass +0 -103
  40. data/lib/big_band/compass/stylesheets/big_band/utilities/_border_radius.sass +0 -27
  41. data/lib/big_band/compass/stylesheets/big_band/utilities/_css3_prefix.sass +0 -14
  42. data/lib/big_band/compass/stylesheets/big_band/utilities/_fancy_buttons.sass +0 -62
  43. data/lib/big_band/compass/stylesheets/big_band/utilities/_html5.sass +0 -3
  44. data/lib/big_band/config_file.rb +0 -48
  45. data/lib/big_band/files/overlay-button.png +0 -0
  46. data/lib/big_band/integration.rb +0 -39
  47. data/lib/big_band/integration/bacon.rb +0 -10
  48. data/lib/big_band/integration/monk.rb +0 -26
  49. data/lib/big_band/integration/rake.rb +0 -80
  50. data/lib/big_band/integration/rspec.rb +0 -11
  51. data/lib/big_band/integration/test.rb +0 -42
  52. data/lib/big_band/integration/test/spec.rb +0 -2
  53. data/lib/big_band/integration/test/unit.rb +0 -2
  54. data/lib/big_band/integration/test_spec.rb +0 -8
  55. data/lib/big_band/integration/test_unit.rb +0 -10
  56. data/lib/big_band/integration/yard.rb +0 -104
  57. data/lib/big_band/more_helpers.rb +0 -50
  58. data/lib/big_band/more_server.rb +0 -14
  59. data/lib/big_band/more_server/rainbows.rb +0 -13
  60. data/lib/big_band/more_server/unicorn.rb +0 -27
  61. data/lib/big_band/reloader.rb +0 -113
  62. data/lib/big_band/sass.rb +0 -28
  63. data/lib/big_band/version.rb +0 -3
  64. data/lib/big_band/web_inspector.rb +0 -178
  65. data/lib/big_bang.rb +0 -6
  66. data/lib/sinatra/big_band/advanced_routes.rb +0 -2
  67. data/lib/sinatra/big_band/basic_extensions.rb +0 -2
  68. data/lib/sinatra/big_band/compass.rb +0 -2
  69. data/lib/sinatra/big_band/compass/big_band.rb +0 -2
  70. data/lib/sinatra/big_band/config_file.rb +0 -2
  71. data/lib/sinatra/big_band/integration.rb +0 -2
  72. data/lib/sinatra/big_band/integration/bacon.rb +0 -2
  73. data/lib/sinatra/big_band/integration/monk.rb +0 -2
  74. data/lib/sinatra/big_band/integration/rake.rb +0 -2
  75. data/lib/sinatra/big_band/integration/rspec.rb +0 -2
  76. data/lib/sinatra/big_band/integration/test.rb +0 -2
  77. data/lib/sinatra/big_band/integration/test/spec.rb +0 -2
  78. data/lib/sinatra/big_band/integration/test/unit.rb +0 -2
  79. data/lib/sinatra/big_band/integration/test_spec.rb +0 -2
  80. data/lib/sinatra/big_band/integration/test_unit.rb +0 -2
  81. data/lib/sinatra/big_band/integration/yard.rb +0 -2
  82. data/lib/sinatra/big_band/more_helpers.rb +0 -2
  83. data/lib/sinatra/big_band/more_server.rb +0 -2
  84. data/lib/sinatra/big_band/more_server/rainbows.rb +0 -2
  85. data/lib/sinatra/big_band/more_server/unicorn.rb +0 -2
  86. data/lib/sinatra/big_band/reloader.rb +0 -2
  87. data/lib/sinatra/big_band/sass.rb +0 -2
  88. data/lib/sinatra/big_band/version.rb +0 -2
  89. data/lib/sinatra/big_band/web_inspector.rb +0 -2
  90. data/lib/yard-sinatra.rb +0 -2
  91. data/spec/big_band/advanced_routes_spec.rb +0 -70
  92. data/spec/big_band/basic_extensions_spec.rb +0 -39
  93. data/spec/big_band/more_server_spec.rb +0 -7
  94. data/spec/big_band/sass_spec.rb +0 -21
  95. data/spec/spec.opts +0 -5
  96. data/yard-sinatra.gemspec +0 -24
data/README.rdoc DELETED
@@ -1,346 +0,0 @@
1
- = BigBand 0.2.5
2
- BigBand is a collection of Sinatra extensions and offers better sinatra integration for common tools.
3
- It is pluggable and each extension can be used in stand alone mode.
4
-
5
- The main features are:
6
- * Routes as first class objects
7
- * Better handling of #set: Merges hashes, more hooks
8
- * Better compass integration
9
- * YAML config files mapping to set (overwriting present values/methods is prevented)
10
- * Rails-like helpers, like content_for
11
- * Unicorn and Rainbows integration
12
- * Smart code reloader only reloading changed files and getting rid of old routes
13
- * Sass extensions
14
- * Routes for inspection in development mode
15
- * Helpers and configuration for Bacon, RSpec, Test::Spec and Test::Unit
16
- * Tasks listing all routes for Monk and Rake.
17
- * YARD: Add Sinatra routes to generated documentation
18
-
19
- Planned features:
20
- * More template helpers
21
- * ORM integration
22
- * MSpec integration
23
-
24
- == Usage
25
-
26
- Using all BigBand features:
27
-
28
- require "sinatra/big_band"
29
- class Example < Sinatra::BigBand
30
- # Yay, BigBand!
31
- end
32
-
33
- Or you may use the extension style:
34
-
35
- class AnotherExample < Sinatra::Base
36
- register Sinatra::BigBand
37
- end
38
-
39
- Or for the lazy folks (if you use classic style):
40
-
41
- require "sinatra"
42
- require "sinatra/big_band"
43
- # Yay, BigBand!
44
-
45
- Sinatra::BigBand is just an alias for BigBand. It was introduced manly to (in my opinion) have prettier
46
- class signatures. First "class Example < Sinatra::BigBand" looks like Sinatra "class Example < BigBand", lets
47
- give some credit to our beloved framework. Also, Sinatra::BigBand seems more akin to Sinatra::Base, Sinatra::Application
48
- and Sinatra::Default, than just BigBand. Other than that I do not plan to move BigBand completely into Sinatra simply
49
- to avoid more nesting. Last, but no least, the Sinatra docs sugest placing extensions inside Sinatra.
50
-
51
- Using just your favorite BigBand features:
52
-
53
- require "big_band"
54
- class Example < Sinatra::Base
55
- register BigBand::SomeFeature
56
- # Yay, SomeFeature!
57
- end
58
-
59
- Or, if you like a more handy syntax:
60
-
61
- require "sinatra/big_band"
62
- class Example < Sinatra::BigBand :SomeFeature, MyStuff::Extension, :development => :DevelopmentOnlyFeature
63
- # Yay, BigBand::SomeFeature!
64
- # Yay, MyStuff::Extension!
65
- # Yay, BigBand::DevelopmentOnlyFeature, if this is development mode!
66
- end
67
-
68
- Loading all but one feature:
69
-
70
- require "sinatra/big_band"
71
- class Example < Sinatra::BigBand :except => :SomeFeature
72
- # Yay, all but BigBand::SomeFeature!
73
- end
74
-
75
- Or just your favorite feature without you subclassing Sinatra::Base manually:
76
-
77
- require "sinatra"
78
- require "big_band/some_feature"
79
- Sinatra::Application.register BigBand::SomeFeature
80
- # Yay, BigBand::SomeFeature!
81
-
82
- == Extensions
83
-
84
- === AdvancedRoutes
85
-
86
- AdvancedRoutes makes routes first class objects in Sinatra:
87
-
88
- require "sinatra"
89
- require "big_band"
90
-
91
- admin_route = get "/admin" do
92
- administrate_stuff
93
- end
94
-
95
- before do
96
- # Let's deactivate the route if we have no password file.
97
- if File.exists? "admin_password"
98
- admin_route.activate
99
- else
100
- admin_route.deactivate
101
- end
102
- end
103
-
104
- first_route = get "/:name" do
105
- # stuff
106
- end
107
-
108
- other_route = get "/foo_:name" do
109
- # other stuff
110
- end
111
-
112
- # Unfortunatly first_route will catch all the requests other_route would
113
- # have gotten, since it has been defined first. But wait, we can fix this!
114
- other_route.promote
115
-
116
- === BasicExtensions
117
-
118
- Basic Sinatra extension (mainly extending Sinatra's standard methods, like set or register).
119
- Also it features a more advanced path guessing than Sinatra::Base.
120
- Normally you do not have to register this module manually, as the other extensions will do so
121
- if necessary.
122
-
123
- === Compass
124
-
125
- Integrates the Compass stylesheet framework with Sinatra.
126
-
127
- Usage without doing something:
128
-
129
- require "big_band"
130
- class Foo < BigBand; end
131
-
132
- If you create a directory called views/stylesheets and place your
133
- sass files in there, there you go. Just call stylesheet(name) form
134
- your view to get the correct stylesheet tag. The URL for your
135
- stylesheets will be /stylesheets/:name.css.
136
-
137
- Of course you can use any other setup. Say, you want to store your
138
- stylesheets in views/css and want the URL to be /css/:name.css:
139
-
140
- class Foo < BigBand
141
- get_compass("css")
142
- end
143
-
144
- But what about more complex setups?
145
-
146
- class Foo < BigBand
147
- set :compass, :sass_dir => "/foo/bar/blah"
148
- get_compass("/foo/:name.css") do
149
- compass :one_stylesheet
150
- end
151
- end
152
-
153
- Note that already generated routes will be deactivated by calling
154
- get_compass again.
155
-
156
- === ConfigFile
157
-
158
- Using YAML config files. Config files are expected to represent hashes.
159
- When parsing such a config file it will use set to store that value, ignoring
160
- those directly defined in the app (not those defined by the class it inherits
161
- from, i.e. Sinatra::Base or BigBand).
162
-
163
- Example:
164
-
165
- class MyApp << BigBand
166
- set :foo, "bar"
167
- config_file "settings.yml" # general settings
168
- config_file "#{environment}.settings.yml" # environment specific settings
169
- foo # => "bar"
170
- end
171
-
172
- Now you could write in your settings.yml:
173
-
174
- ---
175
- server: [thin, webrick] # use only thin or webrick for #run!
176
- public: /var/www # load public files from /var/www
177
- port: 8080 # run on port 8080
178
- foo: baz
179
- database:
180
- adapter: sqlite
181
-
182
- In you development.settings.yml:
183
-
184
- database:
185
- db_file: development.db
186
-
187
- === MoreHelpers
188
-
189
- Adds more helper methods (more docs coming soon).
190
-
191
- === MoreServer
192
-
193
- Adds more servers to Sinatra::Base#run! (currently unicorn and rainbows).
194
-
195
- === Reloader
196
-
197
- Advanced reloader for sinatra. Reloads only files that have changed and automatically
198
- detects orphaned routes that have to be removed. Files defining routes will be added
199
- to the reload list per default. Avoid reloading with dont_reload. Add other files to
200
- the reload list with also_reload.
201
-
202
- Usage:
203
-
204
- require "big_band"
205
- class Foo < Sinatra::Base
206
- configure(:development) do
207
- register BigBand::Reloader
208
- also_reload "app/models/*.rb"
209
- dont_reload "lib/**/*.rb"
210
- end
211
- end
212
-
213
- Per default this will only be acitvated in development mode.
214
-
215
- === Sass
216
-
217
- BigBand::Sass extends SassScript with more functions like min or max.
218
-
219
- Example:
220
- .someClass
221
- width = max(!default_width - 10px, 200px)
222
-
223
- This can be used without BigBand or even Sinatra.
224
-
225
- === WebInspector
226
-
227
- The WebInspector allowes you to inspect a running Sinatra app.
228
- Just browse http://localhost:4567/\_\_inspect\_\_
229
-
230
- Per default this will only be activated in development mode.
231
-
232
-
233
- == Tool Integration
234
-
235
- === Bacon
236
-
237
- Some Bacon example and description goes here.
238
-
239
- === Monk
240
-
241
- In your Thorfile, place:
242
-
243
- require "big_band/integration/monk"
244
- class Monk < Thor
245
- routes_task :list_routes
246
- end
247
-
248
- Now, running 'monk list_routes' in you project directory should
249
- give you a list of all your routes.
250
-
251
- === Rake
252
-
253
- In your Rakefile, do the following:
254
-
255
- require "big_band/integration/rake"
256
- include BigBand::Integration::Rake
257
-
258
- RoutesTask.new
259
-
260
- then you can run 'rake routes' from your
261
- project directory and it will list all routes
262
- of your app. Per default it will scan for routes
263
- defined in ruby files in the directories lib, app,
264
- routes, models, views, and controllers (ignoring
265
- non-existant directories, of course). You can change
266
- that behavior by setting +source+ to another pattern:
267
-
268
- RoutesTask.new { |t| t.source = "**/*.rb" }
269
-
270
- However, you may also just pass in a Sinatra app, so it
271
- will not have to scan through the source files:
272
-
273
- require "my_app"
274
- RoutesTask.new { |t| t.source = MyApp }
275
-
276
- Keep in mind that a broken my_app in this case would also make
277
- your Rakefile unusable.
278
-
279
- Also, you may set another name for the task either by setting
280
- the first argument or calling #name=:
281
-
282
- RoutesTask.new(:some_routes) { |t| t.source = SomeApp }
283
- RoutesTask.new do |t|
284
- t.source = AnotherApp
285
- t.name = :other_routes
286
- end
287
-
288
- === RSpec
289
-
290
- Some RSpec example and description goes here.
291
-
292
- === Test::Spec
293
-
294
- Some TestSpec example and description goes here.
295
-
296
- === Test::Unit
297
-
298
- Some TestUnit example and description goes here.
299
-
300
- === YARD
301
-
302
- Some YARD example and description goes here.
303
-
304
- == Running specs
305
-
306
- rake spec
307
-
308
- == Generating documentation
309
-
310
- rake doc
311
-
312
- == Known Issues
313
- * Reloader: Needs some more love, but it should not cause any harm.
314
- * YARD integration: Routes don't show up in list of all methods. Would prefer a routes list, anyway. Some YARD digging ahead.
315
-
316
- == LICENSE
317
- (MIT/BSD-style license, compatible with Ruby license and GPL)
318
-
319
- copyright (c) 2009 Konstantin Haase. All rights reserved.
320
-
321
- Developed by: Konstantin Haase
322
- http://github.com/rkh/big_band
323
-
324
- Permission is hereby granted, free of charge, to any person obtaining a copy
325
- of this software and associated documentation files (the "Software"), to
326
- deal with the Software without restriction, including without limitation the
327
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
328
- sell copies of the Software, and to permit persons to whom the Software is
329
- furnished to do so, subject to the following conditions:
330
- 1. Redistributions of source code must retain the above copyright notice,
331
- this list of conditions and the following disclaimers.
332
- 2. Redistributions in binary form must reproduce the above copyright
333
- notice, this list of conditions and the following disclaimers in the
334
- documentation and/or other materials provided with the distribution.
335
- 3. Neither the name of Konstantin Haase, nor the names of other contributors
336
- may be used to endorse or promote products derived from this Software without
337
- specific prior written permission.
338
-
339
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
340
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
341
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
342
- CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
343
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
344
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
345
- WITH THE SOFTWARE.
346
-
data/README.rdoc.erb DELETED
@@ -1,39 +0,0 @@
1
- = BigBand <%= version %>
2
- <%= docstring %>
3
-
4
-
5
- == Extensions
6
- <% extensions.each do |extension| %>
7
-
8
- === <%= extension.name %>
9
-
10
- <%= extension.docstring %>
11
-
12
- <% end %>
13
-
14
-
15
- == Tool Integration
16
- <% integration.each do |tool| %>
17
-
18
- === <%= tool.name %>
19
-
20
- <%= tool.docstring %>
21
-
22
- <% end %>
23
-
24
- == Running specs
25
-
26
- rake spec
27
-
28
- == Generating documentation
29
-
30
- rake doc
31
-
32
- == Known Issues
33
- * Reloader: Needs some more love, but it should not cause any harm.
34
- * YARD integration: Routes don't show up in list of all methods. Would prefer a routes list, anyway. Some YARD digging ahead.
35
-
36
- == LICENSE
37
- (MIT/BSD-style license, compatible with Ruby license and GPL)
38
-
39
- <%= File.read("LICENSE").gsub(/\n/, "\n ") %>
data/big_band.gemspec DELETED
@@ -1,25 +0,0 @@
1
- $LOAD_PATH.unshift "lib", "."
2
- require "lib/big_band/version"
3
- require "dependencies"
4
-
5
- SPEC = Gem::Specification.new do |s|
6
-
7
- s.name = "big_band"
8
- s.version = BigBand::VERSION
9
- s.date = BigBand::DATE
10
- s.author = "Konstantin Haase"
11
- s.email = "konstantin.mailinglists@googlemail.com"
12
- s.homepage = "http://github.com/rkh/big_band"
13
- s.platform = Gem::Platform::RUBY
14
- s.summary = "Collection of Sinatra extensions and sinatra integration for common tools like Rake, YARD and Monk."
15
- s.files = Dir.glob("**/*").reject { |f| File.basename(f)[0] == ?. }
16
- s.require_paths = ['lib']
17
- s.has_rdoc = true
18
- s.description = s.summary + " See README.rdoc for more infos."
19
- s.rdoc_options = %w[-a -S -N -m README.rdoc -q -w 2 -t BigBand -c UTF-8]
20
-
21
- Dependencies.setup_gem(s)
22
- s.specification_version = 2 if s.respond_to? :specification_version=
23
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
24
-
25
- end
data/dependencies.rb DELETED
@@ -1,12 +0,0 @@
1
- require "depgen/depgen"
2
-
3
- class Dependencies < Depgen
4
- add "compass", :git => "git://github.com/chriseppstein/compass.git", :version => "0.8.17", :git_ref => "v%s"
5
- add "haml", :git => "git://github.com/nex3/haml.git", :version => "2.2.17", :only => :rip
6
- add "monkey-lib", :git => "git://github.com/rkh/monkey-lib.git", :version => "0.3.5", :git_ref => "v%s"
7
- add "rack", :git => "git://github.com/rack/rack.git", :version => "1.0.1", :only => :rip
8
- add "rack-test", :git => "git://github.com/brynary/rack-test.git", :version => "0.5.3", :git_ref => "v%s"
9
- add "rspec", :git => "git://github.com/dchelimsky/rspec.git", :version => "1.3.0"
10
- add "sinatra", :git => "git://github.com/sinatra/sinatra.git", :version => "0.9.4"
11
- add "yard", :git => "git://github.com/lsegal/yard.git", :version => "0.5.2"
12
- end
data/depgen/README.rdoc DELETED
@@ -1,7 +0,0 @@
1
- = Depgen
2
- This code has been extracted from BigBand.
3
-
4
- TODO: Describe what it does.
5
-
6
- == Why is there no lib folder?
7
- Cause this is not meant to live in your $LOAD_PATH.
data/depgen/Rakefile DELETED
@@ -1,23 +0,0 @@
1
- require 'rake'
2
- require 'spec/rake/spectask'
3
-
4
- task :default => :rspec
5
-
6
- spec_def = lambda do |t|
7
- t.spec_files = ["depgen_spec.rb"]
8
- t.rcov_opts = %w[--exclude spec,rcov]
9
- t.spec_opts = %w[-c --format progress --loadby mtime --reverse]
10
- t.libs = [File.expand_path(File.dirname(__FILE__))]
11
- end
12
-
13
- desc "Run all examples with RSpec"
14
- Spec::Rake::SpecTask.new('rspec', &spec_def)
15
-
16
- desc "Run all examples with RCov"
17
- Spec::Rake::SpecTask.new('rcov') do |t|
18
- spec_def[t]
19
- t.rcov = true
20
- end
21
-
22
- desc "Run all examples with MSpec"
23
- task(:mspec) { sh "mspec-run depgen_spec.rb" }