blossom 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/blossom +2 -19
- data/lib/blossom.rb +16 -50
- metadata +11 -28
- data/lib/blossom/version.rb +0 -3
data/bin/blossom
CHANGED
@@ -37,8 +37,6 @@ if ARGV.empty?
|
|
37
37
|
puts usage
|
38
38
|
elsif ARGV[0].start_with? "-"
|
39
39
|
case ARGV[0]
|
40
|
-
when "--version", "-v"
|
41
|
-
puts Blossom::VERSION
|
42
40
|
when "--help", "-h", "-?"
|
43
41
|
puts usage
|
44
42
|
else
|
@@ -93,12 +91,7 @@ run Blossom __FILE__
|
|
93
91
|
make_file "Gemfile", <<"^D"
|
94
92
|
source :rubygems
|
95
93
|
|
96
|
-
gem "blossom"
|
97
|
-
|
98
|
-
# Uncomment the following if you want to use CoffeeScript.
|
99
|
-
# (See further instructions in #{name}.js.)
|
100
|
-
#
|
101
|
-
# gem "rack-coffee"
|
94
|
+
gem "blossom"
|
102
95
|
^D
|
103
96
|
|
104
97
|
mkdir "public"
|
@@ -144,17 +137,7 @@ h1
|
|
144
137
|
# end
|
145
138
|
^D
|
146
139
|
|
147
|
-
make_file "#{name}.js",
|
148
|
-
// If you do not want to use CoffeeScript, you can delete this comment.
|
149
|
-
// If you do, first install the CoffeeScript compiler and Rack::Coffee:
|
150
|
-
//
|
151
|
-
// $ npm install -g coffee-script
|
152
|
-
// $ sudo gem install rack-coffee
|
153
|
-
// $ echo 'gem "rack-coffee"' >> Gemfile
|
154
|
-
// $ bundle
|
155
|
-
//
|
156
|
-
// Then simply delete this file and create #{name}.coffee instead.
|
157
|
-
^D
|
140
|
+
make_file "#{name}.js", ''
|
158
141
|
|
159
142
|
run "bundle --local"
|
160
143
|
run "git init"
|
data/lib/blossom.rb
CHANGED
@@ -1,19 +1,11 @@
|
|
1
|
-
require "blossom/version"
|
2
|
-
|
3
1
|
require "sass"
|
4
2
|
require "compass"
|
5
3
|
|
6
4
|
require "haml"
|
7
5
|
require "rack"
|
8
|
-
require "rack/normalize-domain"
|
9
6
|
require "sinatra/base"
|
10
7
|
require "yaml"
|
11
8
|
|
12
|
-
begin
|
13
|
-
require "rack/coffee"
|
14
|
-
rescue LoadError
|
15
|
-
end
|
16
|
-
|
17
9
|
module Blossom
|
18
10
|
def self.fail(message)
|
19
11
|
info "Error: #{message}"
|
@@ -54,18 +46,8 @@ class Blossom::Application < Rack::Builder
|
|
54
46
|
:sass_dir => ""
|
55
47
|
end
|
56
48
|
|
57
|
-
def coffee_options
|
58
|
-
return \
|
59
|
-
:cache => @config.cache_content?,
|
60
|
-
:static => false,
|
61
|
-
:ttl => @config.content_max_age,
|
62
|
-
:urls => "/"
|
63
|
-
end
|
64
|
-
|
65
49
|
def haml_options
|
66
|
-
return
|
67
|
-
:format => :html5,
|
68
|
-
:attr_wrapper => '"'
|
50
|
+
return :format => :html5, :attr_wrapper => '"'
|
69
51
|
end
|
70
52
|
|
71
53
|
def sass_options
|
@@ -125,29 +107,9 @@ class Blossom::Application < Rack::Builder
|
|
125
107
|
end
|
126
108
|
|
127
109
|
def build_rack!
|
128
|
-
use_rack_normalize_domain!
|
129
|
-
use_rack_coffee!
|
130
110
|
run sinatra_app
|
131
111
|
end
|
132
112
|
|
133
|
-
def use_rack_normalize_domain!
|
134
|
-
if @config.strip_www?
|
135
|
-
use Rack::NormalizeDomain
|
136
|
-
Blossom.info "Normalizing domains by removing initial www."
|
137
|
-
else
|
138
|
-
Blossom.info "Not normalizing domains."
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def use_rack_coffee!
|
143
|
-
if defined? Rack::Coffee
|
144
|
-
use Rack::Coffee, coffee_options
|
145
|
-
Blossom.info "Using CoffeeScript."
|
146
|
-
else
|
147
|
-
Blossom.info "Not using CoffeeScript."
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
113
|
def sinatra_app
|
152
114
|
app = Sinatra.new
|
153
115
|
app.set :blossom, self
|
@@ -160,6 +122,7 @@ class Blossom::Application < Rack::Builder
|
|
160
122
|
|
161
123
|
app.set :haml, haml_options
|
162
124
|
app.set :sass, sass_options
|
125
|
+
app.set :scss, sass_options
|
163
126
|
|
164
127
|
if custom_sinatra_code
|
165
128
|
app.class_eval(custom_sinatra_code)
|
@@ -171,20 +134,18 @@ class Blossom::Application < Rack::Builder
|
|
171
134
|
|
172
135
|
app.register do
|
173
136
|
def path_exists? suffix
|
174
|
-
condition
|
137
|
+
condition {
|
175
138
|
basename = File.basename(request.path_info)
|
176
139
|
File.exist? File.join(settings.root, "#{basename}.#{suffix}")
|
177
|
-
|
140
|
+
}
|
178
141
|
end
|
179
142
|
|
180
|
-
def file_exists?
|
181
|
-
condition
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
}
|
187
|
-
end
|
143
|
+
def file_exists? suffix
|
144
|
+
condition {
|
145
|
+
basename = File.basename(request.path_info)
|
146
|
+
barename = basename.sub(/\.[^.]*$/, '')
|
147
|
+
File.exist? File.join(settings.root, "#{barename}.#{suffix}")
|
148
|
+
}
|
188
149
|
end
|
189
150
|
end
|
190
151
|
|
@@ -194,7 +155,12 @@ class Blossom::Application < Rack::Builder
|
|
194
155
|
end
|
195
156
|
end
|
196
157
|
|
197
|
-
app.get "/:name.css", :file_exists? =>
|
158
|
+
app.get "/:name.css", :file_exists? => :scss do
|
159
|
+
content_type :css
|
160
|
+
scss params[:name].to_sym
|
161
|
+
end
|
162
|
+
|
163
|
+
app.get "/:name.css", :file_exists? => :sass do
|
198
164
|
content_type :css
|
199
165
|
sass params[:name].to_sym
|
200
166
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blossom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '1.
|
21
|
+
version: '1.3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,23 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1.
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: sass
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 3.1.1
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 3.1.1
|
29
|
+
version: '1.3'
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: haml
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +34,7 @@ dependencies:
|
|
50
34
|
requirements:
|
51
35
|
- - ~>
|
52
36
|
- !ruby/object:Gem::Version
|
53
|
-
version: 3.1
|
37
|
+
version: '3.1'
|
54
38
|
type: :runtime
|
55
39
|
prerelease: false
|
56
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,15 +42,15 @@ dependencies:
|
|
58
42
|
requirements:
|
59
43
|
- - ~>
|
60
44
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.1
|
45
|
+
version: '3.1'
|
62
46
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
47
|
+
name: sass
|
64
48
|
requirement: !ruby/object:Gem::Requirement
|
65
49
|
none: false
|
66
50
|
requirements:
|
67
51
|
- - ~>
|
68
52
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
53
|
+
version: '3.2'
|
70
54
|
type: :runtime
|
71
55
|
prerelease: false
|
72
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,15 +58,15 @@ dependencies:
|
|
74
58
|
requirements:
|
75
59
|
- - ~>
|
76
60
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
61
|
+
version: '3.2'
|
78
62
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
63
|
+
name: compass
|
80
64
|
requirement: !ruby/object:Gem::Requirement
|
81
65
|
none: false
|
82
66
|
requirements:
|
83
67
|
- - ~>
|
84
68
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.
|
69
|
+
version: '0.12'
|
86
70
|
type: :runtime
|
87
71
|
prerelease: false
|
88
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +74,7 @@ dependencies:
|
|
90
74
|
requirements:
|
91
75
|
- - ~>
|
92
76
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.
|
77
|
+
version: '0.12'
|
94
78
|
description:
|
95
79
|
email: daniel@gointeractive.se
|
96
80
|
executables:
|
@@ -100,7 +84,6 @@ extra_rdoc_files: []
|
|
100
84
|
files:
|
101
85
|
- bin/blossom
|
102
86
|
- lib/blossom.rb
|
103
|
-
- lib/blossom/version.rb
|
104
87
|
homepage: http://github.com/dbrock/blossom
|
105
88
|
licenses: []
|
106
89
|
post_install_message:
|
data/lib/blossom/version.rb
DELETED