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.
- data/LICENSE +1 -1
- data/README.md +82 -0
- data/Rakefile +50 -170
- data/TODO.md +50 -0
- data/lib/big_band.rb +13 -258
- data/lib/sinatra/big_band.rb +65 -1
- data/spec/sinatra/big_band_spec.rb +32 -0
- data/spec/spec_helper.rb +2 -4
- data/subproject.rb +42 -0
- data/tasks/doc.task +9 -0
- data/tasks/gem.task +10 -0
- data/tasks/git.task +41 -0
- data/tasks/setup.task +34 -0
- data/tasks/spec.task +24 -0
- metadata +200 -140
- data/README.rdoc +0 -346
- data/README.rdoc.erb +0 -39
- data/big_band.gemspec +0 -25
- data/dependencies.rb +0 -12
- data/depgen/README.rdoc +0 -7
- data/depgen/Rakefile +0 -23
- data/depgen/depgen.rb +0 -123
- data/depgen/depgen.task +0 -42
- data/depgen/depgen_spec.rb +0 -127
- data/deps.rip +0 -8
- data/example/example.rb +0 -13
- data/example/views/index.haml +0 -8
- data/example/views/layout.haml +0 -2
- data/example/views/stylesheets/_base.sass +0 -1
- data/example/views/stylesheets/screen.sass +0 -12
- data/lib/big_band/advanced_routes.rb +0 -188
- data/lib/big_band/basic_extensions.rb +0 -176
- data/lib/big_band/compass.rb +0 -94
- data/lib/big_band/compass/big_band.rb +0 -4
- data/lib/big_band/compass/stylesheets/_big_band.sass +0 -1
- data/lib/big_band/compass/stylesheets/big_band/_blueprint.sass +0 -1
- data/lib/big_band/compass/stylesheets/big_band/_utilities.sass +0 -6
- data/lib/big_band/compass/stylesheets/big_band/blueprint/_html5.sass +0 -4
- data/lib/big_band/compass/stylesheets/big_band/layouts/_inspector.sass +0 -103
- data/lib/big_band/compass/stylesheets/big_band/utilities/_border_radius.sass +0 -27
- data/lib/big_band/compass/stylesheets/big_band/utilities/_css3_prefix.sass +0 -14
- data/lib/big_band/compass/stylesheets/big_band/utilities/_fancy_buttons.sass +0 -62
- data/lib/big_band/compass/stylesheets/big_band/utilities/_html5.sass +0 -3
- data/lib/big_band/config_file.rb +0 -48
- data/lib/big_band/files/overlay-button.png +0 -0
- data/lib/big_band/integration.rb +0 -39
- data/lib/big_band/integration/bacon.rb +0 -10
- data/lib/big_band/integration/monk.rb +0 -26
- data/lib/big_band/integration/rake.rb +0 -80
- data/lib/big_band/integration/rspec.rb +0 -11
- data/lib/big_band/integration/test.rb +0 -42
- data/lib/big_band/integration/test/spec.rb +0 -2
- data/lib/big_band/integration/test/unit.rb +0 -2
- data/lib/big_band/integration/test_spec.rb +0 -8
- data/lib/big_band/integration/test_unit.rb +0 -10
- data/lib/big_band/integration/yard.rb +0 -104
- data/lib/big_band/more_helpers.rb +0 -50
- data/lib/big_band/more_server.rb +0 -14
- data/lib/big_band/more_server/rainbows.rb +0 -13
- data/lib/big_band/more_server/unicorn.rb +0 -27
- data/lib/big_band/reloader.rb +0 -113
- data/lib/big_band/sass.rb +0 -28
- data/lib/big_band/version.rb +0 -3
- data/lib/big_band/web_inspector.rb +0 -178
- data/lib/big_bang.rb +0 -6
- data/lib/sinatra/big_band/advanced_routes.rb +0 -2
- data/lib/sinatra/big_band/basic_extensions.rb +0 -2
- data/lib/sinatra/big_band/compass.rb +0 -2
- data/lib/sinatra/big_band/compass/big_band.rb +0 -2
- data/lib/sinatra/big_band/config_file.rb +0 -2
- data/lib/sinatra/big_band/integration.rb +0 -2
- data/lib/sinatra/big_band/integration/bacon.rb +0 -2
- data/lib/sinatra/big_band/integration/monk.rb +0 -2
- data/lib/sinatra/big_band/integration/rake.rb +0 -2
- data/lib/sinatra/big_band/integration/rspec.rb +0 -2
- data/lib/sinatra/big_band/integration/test.rb +0 -2
- data/lib/sinatra/big_band/integration/test/spec.rb +0 -2
- data/lib/sinatra/big_band/integration/test/unit.rb +0 -2
- data/lib/sinatra/big_band/integration/test_spec.rb +0 -2
- data/lib/sinatra/big_band/integration/test_unit.rb +0 -2
- data/lib/sinatra/big_band/integration/yard.rb +0 -2
- data/lib/sinatra/big_band/more_helpers.rb +0 -2
- data/lib/sinatra/big_band/more_server.rb +0 -2
- data/lib/sinatra/big_band/more_server/rainbows.rb +0 -2
- data/lib/sinatra/big_band/more_server/unicorn.rb +0 -2
- data/lib/sinatra/big_band/reloader.rb +0 -2
- data/lib/sinatra/big_band/sass.rb +0 -2
- data/lib/sinatra/big_band/version.rb +0 -2
- data/lib/sinatra/big_band/web_inspector.rb +0 -2
- data/lib/yard-sinatra.rb +0 -2
- data/spec/big_band/advanced_routes_spec.rb +0 -70
- data/spec/big_band/basic_extensions_spec.rb +0 -39
- data/spec/big_band/more_server_spec.rb +0 -7
- data/spec/big_band/sass_spec.rb +0 -21
- data/spec/spec.opts +0 -5
- data/yard-sinatra.gemspec +0 -24
@@ -1,62 +0,0 @@
|
|
1
|
-
@import border_radius.sass
|
2
|
-
@import css3_prefix.sass
|
3
|
-
|
4
|
-
!fancy_button_color = #222
|
5
|
-
!fancy_button_height = 30px
|
6
|
-
!fancy_button_width = "auto"
|
7
|
-
!fancy_button_radius = "auto"
|
8
|
-
!fancy_button_darkening = 0.3
|
9
|
-
|
10
|
-
=fancy-button(!color = !fancy_button_color, !height = !fancy_button_height, !width = !fancy_button_width, !radius = !fancy_button_radius)
|
11
|
-
@if !radius == "auto"
|
12
|
-
!radius = !height
|
13
|
-
@if !height < !radius * 2
|
14
|
-
!radius = !height / 2
|
15
|
-
+border-radius(!radius)
|
16
|
-
+box-shadow(0 1px 10px rgba(0, 0, 0, 0.6))
|
17
|
-
text-shadow = 0 -1px (!height * 0.1) rgba(0,0,0,0.7)
|
18
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.25)
|
19
|
-
background:
|
20
|
-
color = !color
|
21
|
-
image: url(/__big_band__/overlay-button.png)
|
22
|
-
repeat: repeat-x
|
23
|
-
attachment: scroll
|
24
|
-
position:
|
25
|
-
top: 0
|
26
|
-
left: 0
|
27
|
-
display: inline-block
|
28
|
-
padding = (!height * 0.1 - 1px) (!height * 0.5)
|
29
|
-
color: #fff !important
|
30
|
-
text:
|
31
|
-
decoration: none
|
32
|
-
align: center
|
33
|
-
-moz-background:
|
34
|
-
clip: border
|
35
|
-
inline-policy: continuous
|
36
|
-
font:
|
37
|
-
family: Arial,Helvetica,Helvetica Neue,Verdana,sans-serif
|
38
|
-
weight: bold
|
39
|
-
size = !height * 0.8
|
40
|
-
height = !height !important
|
41
|
-
width = !width
|
42
|
-
line-height: 1.2
|
43
|
-
|
44
|
-
=fancy-button-link(!color = !fancy_button_color, !height = !fancy_button_height, !width = !fancy_button_width, !radius = !fancy_button_radius, !darkening = !fancy_button_darkening)
|
45
|
-
!offset = !height * 0.1 + 3px
|
46
|
-
+fancy-button(!color, !height, !width, !radius)
|
47
|
-
+prefixed("transition-property", "background, left, top, box-shadow, -moz-box-shadow, -webkit-box-shadow")
|
48
|
-
+prefixed("transition-duration", "0.5s")
|
49
|
-
position: relative
|
50
|
-
top: 0
|
51
|
-
left: 0
|
52
|
-
cursor: pointer
|
53
|
-
margin = !offset
|
54
|
-
&:hover
|
55
|
-
+fancy-button(!color * !darkening, !height, !width, !radius)
|
56
|
-
+box-shadow(!offset !offset + 1px !offset + 10px rgba(0, 0, 0, 0.5))
|
57
|
-
left = -!offset
|
58
|
-
top = -!offset
|
59
|
-
&:visited, &:hover
|
60
|
-
color = !color
|
61
|
-
text-decoration: none
|
62
|
-
|
data/lib/big_band/config_file.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
require "sinatra/base"
|
2
|
-
require "yaml"
|
3
|
-
|
4
|
-
class BigBand < Sinatra::Base
|
5
|
-
# Using YAML config files. Config files are expected to represent hashes.
|
6
|
-
# When parsing such a config file it will use set to store that value, ignoring
|
7
|
-
# those directly defined in the app (not those defined by the class it inherits
|
8
|
-
# from, i.e. Sinatra::Base or BigBand).
|
9
|
-
#
|
10
|
-
# Example:
|
11
|
-
#
|
12
|
-
# class MyApp << BigBand
|
13
|
-
# set :foo, "bar"
|
14
|
-
# config_file "settings.yml" # general settings
|
15
|
-
# config_file "#{environment}.settings.yml" # environment specific settings
|
16
|
-
# foo # => "bar"
|
17
|
-
# end
|
18
|
-
#
|
19
|
-
# Now you could write in your settings.yml:
|
20
|
-
#
|
21
|
-
# ---
|
22
|
-
# server: [thin, webrick] # use only thin or webrick for #run!
|
23
|
-
# public: /var/www # load public files from /var/www
|
24
|
-
# port: 8080 # run on port 8080
|
25
|
-
# foo: baz
|
26
|
-
# database:
|
27
|
-
# adapter: sqlite
|
28
|
-
#
|
29
|
-
# In you development.settings.yml:
|
30
|
-
#
|
31
|
-
# database:
|
32
|
-
# db_file: development.db
|
33
|
-
module ConfigFile
|
34
|
-
|
35
|
-
def self.registered(klass)
|
36
|
-
klass.register BasicExtensions
|
37
|
-
end
|
38
|
-
|
39
|
-
def config_file(*paths)
|
40
|
-
paths.each do |pattern|
|
41
|
-
files = root_glob(pattern.to_s)
|
42
|
-
files.each { |f| YAML.load_file(f).each_pair { |k,v| set k, v unless methods(false).any? { |m| m.to_s = k.to_s } } }
|
43
|
-
warn "WARNING: could not load config file #{pattern}" if files.empty?
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
Binary file
|
data/lib/big_band/integration.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
unless defined? Sinatra::Base
|
2
|
-
module Sinatra # :nodoc:
|
3
|
-
class Base # :nodoc:
|
4
|
-
end
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
class BigBand < Sinatra::Base
|
9
|
-
module Integration
|
10
|
-
GLOBBER = "{lib/**,app/**,routes/**,models/**,views/**,controllers/**,.}/*.rb"
|
11
|
-
|
12
|
-
def self.routes_for(source)
|
13
|
-
case source
|
14
|
-
when Class
|
15
|
-
source.routes
|
16
|
-
when String
|
17
|
-
require "big_band/advanced_routes"
|
18
|
-
require "big_band/integration/yard"
|
19
|
-
::YARD::Registry.load(Dir[source], true)
|
20
|
-
YARD::Handlers::Sinatra::AbstractRouteHandler.routes.inject({}) do |routes, r|
|
21
|
-
(routes[r.http_verb] ||= []) << AdvancedRoutes::Route.new(r.http_verb, :path => r.http_path, :docstring => r.docstring, :file => r.file)
|
22
|
-
routes
|
23
|
-
end
|
24
|
-
else
|
25
|
-
raise ArgumentError, "cannot retrieve routes for #{source.inspect}"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.each_route(source)
|
30
|
-
routes_for(source).each do |verb, routes|
|
31
|
-
routes.each do |route|
|
32
|
-
#route.path ||= route.pattern
|
33
|
-
yield(verb, route)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "monk"
|
2
|
-
require "big_band/integration"
|
3
|
-
|
4
|
-
module BigBand::Integration
|
5
|
-
# In your Thorfile, place:
|
6
|
-
#
|
7
|
-
# require "big_band/integration/monk"
|
8
|
-
# class Monk < Thor
|
9
|
-
# routes_task :list_routes
|
10
|
-
# end
|
11
|
-
#
|
12
|
-
# Now, running 'monk list_routes' in you project directory should
|
13
|
-
# give you a list of all your routes.
|
14
|
-
module Monk
|
15
|
-
def routes_task(name = :routes)
|
16
|
-
desc "#{routes} [FILES=#{GLOBBER.inspect}]", "lists all routes"
|
17
|
-
define_method :routes do |files|
|
18
|
-
BigBand::Integration.each_route(files || GLOBBER) { |v,r| say_status v, r.path }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class Monk < Thor
|
25
|
-
extend BigBand::Integration::Monk
|
26
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "big_band/integration"
|
4
|
-
require "rake"
|
5
|
-
require "rake/tasklib"
|
6
|
-
|
7
|
-
module BigBand::Integration
|
8
|
-
# In your Rakefile, do the following:
|
9
|
-
#
|
10
|
-
# require "big_band/integration/rake"
|
11
|
-
# include BigBand::Integration::Rake
|
12
|
-
#
|
13
|
-
# RoutesTask.new
|
14
|
-
#
|
15
|
-
# then you can run 'rake routes' from your
|
16
|
-
# project directory and it will list all routes
|
17
|
-
# of your app. Per default it will scan for routes
|
18
|
-
# defined in ruby files in the directories lib, app,
|
19
|
-
# routes, models, views, and controllers (ignoring
|
20
|
-
# non-existant directories, of course). You can change
|
21
|
-
# that behavior by setting +source+ to another pattern:
|
22
|
-
#
|
23
|
-
# RoutesTask.new { |t| t.source = "**/*.rb" }
|
24
|
-
#
|
25
|
-
# However, you may also just pass in a Sinatra app, so it
|
26
|
-
# will not have to scan through the source files:
|
27
|
-
#
|
28
|
-
# require "my_app"
|
29
|
-
# RoutesTask.new { |t| t.source = MyApp }
|
30
|
-
#
|
31
|
-
# Keep in mind that a broken my_app in this case would also make
|
32
|
-
# your Rakefile unusable.
|
33
|
-
#
|
34
|
-
# Also, you may set another name for the task either by setting
|
35
|
-
# the first argument or calling #name=:
|
36
|
-
#
|
37
|
-
# RoutesTask.new(:some_routes) { |t| t.source = SomeApp }
|
38
|
-
# RoutesTask.new do |t|
|
39
|
-
# t.source = AnotherApp
|
40
|
-
# t.name = :other_routes
|
41
|
-
# end
|
42
|
-
module Rake
|
43
|
-
class RoutesTask < ::Rake::TaskLib
|
44
|
-
attr_accessor :source, :name
|
45
|
-
|
46
|
-
def initialize(name = :routes)
|
47
|
-
@name = name
|
48
|
-
@source = BigBand::Integration::GLOBBER
|
49
|
-
yield self if block_given?
|
50
|
-
define
|
51
|
-
end
|
52
|
-
|
53
|
-
def define
|
54
|
-
desc "Lists routes defined in #{source}"
|
55
|
-
task(name) do
|
56
|
-
list = []
|
57
|
-
width = 0
|
58
|
-
BigBand::Integration.each_route(source) do |verb, route|
|
59
|
-
docstring = ""
|
60
|
-
docstring << route.file if route.file?
|
61
|
-
docstring << ":" << route.line if route.line
|
62
|
-
if route.docstring
|
63
|
-
docstring << " " unless docstring.empty?
|
64
|
-
docstring << route.docstring
|
65
|
-
end
|
66
|
-
signature = "#{verb.downcase}(#{route.path.inspect})"
|
67
|
-
list << [signature, docstring]
|
68
|
-
width = [signature.size, width].max
|
69
|
-
end
|
70
|
-
list.each do |signature, docstring|
|
71
|
-
line = "#{signature.ljust width} # #{docstring}"
|
72
|
-
line = line[0..99] + "…" if line.size > 100
|
73
|
-
puts line
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require "big_band/integration/test"
|
2
|
-
require "spec"
|
3
|
-
|
4
|
-
module BigBand::Integration
|
5
|
-
# Some RSpec example and description goes here.
|
6
|
-
module RSpec
|
7
|
-
include BigBand::Integration::Test
|
8
|
-
::Spec::Runner.configure { |c| c.include self }
|
9
|
-
end
|
10
|
-
Rspec = RSpec
|
11
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require "sinatra"
|
2
|
-
Sinatra::Base.set :environment, :test
|
3
|
-
|
4
|
-
require "big_band"
|
5
|
-
require "big_band/integration"
|
6
|
-
|
7
|
-
require "rack/test"
|
8
|
-
#require "webrat"
|
9
|
-
#Webrat.configure { |config| config.mode = :sinatra }
|
10
|
-
|
11
|
-
module BigBand::Integration
|
12
|
-
# This encapsulates general test helpers. See Bacon, RSpec, Test::Spec and Test::Unit for examples.
|
13
|
-
module Test
|
14
|
-
|
15
|
-
#include Webrat::Methods
|
16
|
-
include Rack::Test::Methods
|
17
|
-
|
18
|
-
attr_writer :app
|
19
|
-
def app(*options, &block)
|
20
|
-
unless block.nil? and options.empty?
|
21
|
-
superclass = options.first if options.size == 1 and options.first.is_a? Class
|
22
|
-
superclass ||= BigBand(*options)
|
23
|
-
@app = Class.new(superclass, &block)
|
24
|
-
inspection = "app"
|
25
|
-
inspection << "(" << options.map { |o| o.inspect }.join(", ") << ")" unless options.empty?
|
26
|
-
inspection << " { ... }" if block
|
27
|
-
@app.class_eval "def self.inspect; #{inspection.inspect}; end"
|
28
|
-
end
|
29
|
-
@app || BigBand.applications.last || Sinatra::Application
|
30
|
-
end
|
31
|
-
|
32
|
-
def define_route(verb, *args, &block)
|
33
|
-
app.send(verb, *args, &block)
|
34
|
-
end
|
35
|
-
|
36
|
-
def browse_route(verb, *args, &block)
|
37
|
-
send(verb, *args, &block)
|
38
|
-
last_response
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
require "big_band/integration"
|
2
|
-
require "yard"
|
3
|
-
|
4
|
-
module BigBand::Integration
|
5
|
-
# Some YARD example and description goes here.
|
6
|
-
module YARD
|
7
|
-
|
8
|
-
module CodeObjects
|
9
|
-
class RouteObject < ::YARD::CodeObjects::MethodObject
|
10
|
-
|
11
|
-
ISEP = ::YARD::CodeObjects::ISEP
|
12
|
-
|
13
|
-
attr_accessor :http_verb, :http_path, :real_name
|
14
|
-
def name(prefix = false)
|
15
|
-
return super unless show_real_name?
|
16
|
-
prefix ? (sep == ISEP ? "#{sep}#{real_name}" : real_name.to_s) : real_name.to_sym
|
17
|
-
end
|
18
|
-
|
19
|
-
def show_real_name?
|
20
|
-
real_name and caller[1] =~ /`signature'/
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module Handlers
|
27
|
-
|
28
|
-
# Displays Sinatra routes in YARD documentation.
|
29
|
-
# Can also be used to parse routes from files without executing those files.
|
30
|
-
module Sinatra
|
31
|
-
|
32
|
-
# Logic both handlers have in common.
|
33
|
-
module AbstractRouteHandler
|
34
|
-
|
35
|
-
def self.routes
|
36
|
-
@routes ||= []
|
37
|
-
end
|
38
|
-
|
39
|
-
def process
|
40
|
-
path = http_path
|
41
|
-
path = $1 if path =~ /^"(.*)"$/
|
42
|
-
register_route(http_verb, path)
|
43
|
-
register_route('HEAD', path) if http_verb == 'GET'
|
44
|
-
end
|
45
|
-
|
46
|
-
def register_route(verb, path, doc = nil)
|
47
|
-
# HACK: Removing some illegal letters.
|
48
|
-
method_name = "" << verb << "_" << path.gsub(/[^\w_]/, "_")
|
49
|
-
real_name = "" << verb << " " << path
|
50
|
-
route = register CodeObjects::RouteObject.new(namespace, method_name, :instance) do |o|
|
51
|
-
o.visibility = "public"
|
52
|
-
o.source = statement.source
|
53
|
-
o.signature = real_name
|
54
|
-
o.explicit = true
|
55
|
-
o.scope = scope
|
56
|
-
o.docstring = statement.comments
|
57
|
-
o.http_verb = verb
|
58
|
-
o.http_path = path
|
59
|
-
o.real_name = real_name
|
60
|
-
o.add_file(parser.file, statement.line)
|
61
|
-
end
|
62
|
-
AbstractRouteHandler.routes << route
|
63
|
-
yield(route) if block_given?
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
# Route handler for YARD's source parser.
|
69
|
-
class RouteHandler < ::YARD::Handlers::Ruby::Base
|
70
|
-
include AbstractRouteHandler
|
71
|
-
handles method_call(:get)
|
72
|
-
handles method_call(:post)
|
73
|
-
handles method_call(:put)
|
74
|
-
handles method_call(:delete)
|
75
|
-
handles method_call(:head)
|
76
|
-
def http_verb
|
77
|
-
statement.method_name(true).to_s.upcase
|
78
|
-
end
|
79
|
-
def http_path
|
80
|
-
statement.parameters.first.source
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# Route handler for YARD's legacy parser.
|
85
|
-
module Legacy
|
86
|
-
class RouteHandler < ::YARD::Handlers::Ruby::Legacy::Base
|
87
|
-
include AbstractRouteHandler
|
88
|
-
handles /\A(get|post|put|delete|head)[\s\(].*/m
|
89
|
-
def http_verb
|
90
|
-
statement.tokens.first.text.upcase
|
91
|
-
end
|
92
|
-
def http_path
|
93
|
-
statement.tokens[2].text
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
Yard = YARD
|
103
|
-
|
104
|
-
end
|