massimo 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/massimo CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'massimo'
4
-
5
4
  Massimo::CLI.start
@@ -19,45 +19,47 @@ module Massimo
19
19
  def initialize(options = nil)
20
20
  hash = DEFAULT_OPTIONS.dup
21
21
 
22
- options = YAML.load_file(options) if options.is_a?(String)
23
- hash.merge!(options.symbolize_keys) if options.is_a?(Hash)
22
+ options = YAML.load_file(options) if options.is_a? String
23
+ hash.merge!(options.symbolize_keys) if options.is_a? Hash
24
24
 
25
25
  super hash
26
26
  end
27
27
 
28
28
  # The full, expanded path to the source path.
29
29
  def source_path
30
- File.expand_path(super)
30
+ File.expand_path super
31
31
  end
32
32
 
33
33
  # The full, expanded path to the output path.
34
34
  def output_path
35
- File.expand_path(super)
35
+ File.expand_path super
36
36
  end
37
37
 
38
38
  # Get a full, expanded path for the given resource name. This is either set
39
39
  # in the configuration or determined dynamically based on the name.
40
40
  def path_for(resource_name)
41
- path_method = "#{resource_name}_path"
42
- if resource_path = (respond_to?(path_method) and send(path_method))
43
- File.expand_path(resource_path)
41
+ if resource_path = send("#{resource_name}_path")
42
+ File.expand_path resource_path
44
43
  else
45
- File.join(source_path, resource_name.to_s)
44
+ File.join source_path, resource_name.to_s
46
45
  end
47
46
  end
48
47
 
49
48
  # Get the configured URL for th given resource name.
50
49
  def url_for(resource_name)
51
- url_method = "#{resource_name}_url"
52
- resource_url = respond_to?(url_method) && send(url_method)
53
- resource_url = resources_url unless resource_url
54
- File.join(base_url, resource_url)
50
+ File.join base_url, send("#{resource_name}_url") || resources_url
55
51
  end
56
52
 
57
53
  # Get an array of all the file paths found in the given resource name's path,
58
54
  # restricted to the given extension.
59
55
  def files_in(resource_name, extension = '*')
60
- Dir.glob(File.join(path_for(resource_name), "**/*.#{extension}"))
56
+ Dir.glob File.join(path_for(resource_name), "**/*.#{extension}")
57
+ end
58
+
59
+ # Convience method for getting options for a given library name. For instance,
60
+ # this is how we get the options set for Haml or Sass during processing.
61
+ def options_for(lib_name)
62
+ send(lib_name) || {}
61
63
  end
62
64
  end
63
65
  end
@@ -4,13 +4,14 @@ module Massimo
4
4
  case source_path.extname.to_s
5
5
  when '.coffee'
6
6
  require 'coffee-script' unless defined?(CoffeeScript)
7
- CoffeeScript.compile(content)
7
+ CoffeeScript.compile(content, Massimo.config.options_for(:coffee_script))
8
8
  else
9
9
  require 'sprockets' unless defined?(Sprockets)
10
- secretary = Sprockets::Secretary.new(
10
+ options = Massimo.config.options_for(:sprockets).merge(
11
11
  :assert_root => Massimo.config.output_path,
12
12
  :source_files => [ source_path.to_s ]
13
13
  )
14
+ secretary = Sprockets::Secretary.new(options)
14
15
  secretary.install_assets
15
16
  secretary.concatenation.to_s
16
17
  end
data/lib/massimo/page.rb CHANGED
@@ -10,9 +10,10 @@ module Massimo
10
10
  output = content
11
11
 
12
12
  if template_type = Tilt[filename]
13
- template = template_type.new(source_path.to_s, @line || 1) { output }
14
- meta_data = @meta_data.merge(self.class.resource_name.singularize.to_sym => self)
15
- output = template.render(Massimo.site.template_scope, meta_data)
13
+ options = Massimo.config.options_for(source_path.extname[1..-1])
14
+ template = template_type.new(source_path.to_s, @line, options) { output }
15
+ meta_data = @meta_data.merge self.class.resource_name.singularize.to_sym => self
16
+ output = template.render Massimo.site.template_scope, meta_data
16
17
  end
17
18
 
18
19
  if found_layout = Massimo::View.find("layouts/#{layout}")
@@ -23,7 +24,7 @@ module Massimo
23
24
  end
24
25
 
25
26
  def title
26
- @meta_data[:title] ||= filename.chomp(source_path.extname.to_s).titleize
27
+ @meta_data[:title] ||= filename.chomp(source_path.extname).titleize
27
28
  end
28
29
 
29
30
  def extension
@@ -75,7 +76,6 @@ module Massimo
75
76
 
76
77
  def method_missing(method, *args, &block)
77
78
  if args.length == 0
78
- read_source
79
79
  method_name = method.to_s
80
80
  if method_name.chomp! '?'
81
81
  !!@meta_data[method_name.to_sym]
@@ -4,10 +4,11 @@ module Massimo
4
4
  case source_path.extname.to_s
5
5
  when '.sass', '.scss'
6
6
  require 'sass' unless defined?(Sass)
7
- Sass::Files.tree_for(source_path.to_s, :css_filename => output_path).render
7
+ options = Massimo.config.options_for(:sass).merge(:css_filename => output_path)
8
+ Sass::Files.tree_for(source_path.to_s, options).render
8
9
  when '.less'
9
10
  require 'less' unless defined?(Less)
10
- Less::Engine.new(content).to_css
11
+ Less::Engine.new(content, Massimo.config.options_for(:less)).to_css
11
12
  else
12
13
  super
13
14
  end
data/lib/massimo/view.rb CHANGED
@@ -5,7 +5,8 @@ module Massimo
5
5
  unprocessable
6
6
 
7
7
  def render(locals = {}, &block)
8
- template = Tilt.new(source_path.to_s) { content }
8
+ options = Massimo.config.options_for(source_path.extname[1..-1])
9
+ template = Tilt.new(source_path.to_s, 1, options) { content }
9
10
  template.render(Massimo.site.template_scope, locals, &block)
10
11
  end
11
12
  end
data/lib/massimo.rb CHANGED
@@ -12,7 +12,7 @@ module Massimo
12
12
  autoload :View, 'massimo/view'
13
13
  autoload :Watcher, 'massimo/watcher'
14
14
 
15
- VERSION = File.read File.expand_path('../../VERSION', __FILE__)
15
+ VERSION = '0.6.1'
16
16
 
17
17
  class << self
18
18
  def site
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 0
9
- version: 0.6.0
8
+ - 1
9
+ version: 0.6.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pete Browne
@@ -88,24 +88,10 @@ dependencies:
88
88
  version: 0.9.0
89
89
  type: :runtime
90
90
  version_requirements: *id005
91
- - !ruby/object:Gem::Dependency
92
- name: version
93
- prerelease: false
94
- requirement: &id006 !ruby/object:Gem::Requirement
95
- requirements:
96
- - - ~>
97
- - !ruby/object:Gem::Version
98
- segments:
99
- - 0
100
- - 9
101
- - 0
102
- version: 0.9.0
103
- type: :development
104
- version_requirements: *id006
105
91
  - !ruby/object:Gem::Dependency
106
92
  name: rspec
107
93
  prerelease: false
108
- requirement: &id007 !ruby/object:Gem::Requirement
94
+ requirement: &id006 !ruby/object:Gem::Requirement
109
95
  requirements:
110
96
  - - ~>
111
97
  - !ruby/object:Gem::Version
@@ -115,11 +101,11 @@ dependencies:
115
101
  - 0
116
102
  version: 1.3.0
117
103
  type: :development
118
- version_requirements: *id007
104
+ version_requirements: *id006
119
105
  - !ruby/object:Gem::Dependency
120
106
  name: test-construct
121
107
  prerelease: false
122
- requirement: &id008 !ruby/object:Gem::Requirement
108
+ requirement: &id007 !ruby/object:Gem::Requirement
123
109
  requirements:
124
110
  - - ~>
125
111
  - !ruby/object:Gem::Version
@@ -129,11 +115,11 @@ dependencies:
129
115
  - 0
130
116
  version: 1.2.0
131
117
  type: :development
132
- version_requirements: *id008
118
+ version_requirements: *id007
133
119
  - !ruby/object:Gem::Dependency
134
120
  name: rack-test
135
121
  prerelease: false
136
- requirement: &id009 !ruby/object:Gem::Requirement
122
+ requirement: &id008 !ruby/object:Gem::Requirement
137
123
  requirements:
138
124
  - - ~>
139
125
  - !ruby/object:Gem::Version
@@ -143,11 +129,11 @@ dependencies:
143
129
  - 0
144
130
  version: 0.5.0
145
131
  type: :development
146
- version_requirements: *id009
132
+ version_requirements: *id008
147
133
  - !ruby/object:Gem::Dependency
148
134
  name: rr
149
135
  prerelease: false
150
- requirement: &id010 !ruby/object:Gem::Requirement
136
+ requirement: &id009 !ruby/object:Gem::Requirement
151
137
  requirements:
152
138
  - - ~>
153
139
  - !ruby/object:Gem::Version
@@ -157,11 +143,11 @@ dependencies:
157
143
  - 0
158
144
  version: 0.10.0
159
145
  type: :development
160
- version_requirements: *id010
146
+ version_requirements: *id009
161
147
  - !ruby/object:Gem::Dependency
162
148
  name: haml
163
149
  prerelease: false
164
- requirement: &id011 !ruby/object:Gem::Requirement
150
+ requirement: &id010 !ruby/object:Gem::Requirement
165
151
  requirements:
166
152
  - - ">="
167
153
  - !ruby/object:Gem::Version
@@ -172,11 +158,11 @@ dependencies:
172
158
  - beta
173
159
  version: 3.0.0.beta
174
160
  type: :development
175
- version_requirements: *id011
161
+ version_requirements: *id010
176
162
  - !ruby/object:Gem::Dependency
177
163
  name: less
178
164
  prerelease: false
179
- requirement: &id012 !ruby/object:Gem::Requirement
165
+ requirement: &id011 !ruby/object:Gem::Requirement
180
166
  requirements:
181
167
  - - ~>
182
168
  - !ruby/object:Gem::Version
@@ -186,11 +172,11 @@ dependencies:
186
172
  - 0
187
173
  version: 1.2.0
188
174
  type: :development
189
- version_requirements: *id012
175
+ version_requirements: *id011
190
176
  - !ruby/object:Gem::Dependency
191
177
  name: coffee-script
192
178
  prerelease: false
193
- requirement: &id013 !ruby/object:Gem::Requirement
179
+ requirement: &id012 !ruby/object:Gem::Requirement
194
180
  requirements:
195
181
  - - ~>
196
182
  - !ruby/object:Gem::Version
@@ -200,11 +186,11 @@ dependencies:
200
186
  - 0
201
187
  version: 0.3.0
202
188
  type: :development
203
- version_requirements: *id013
189
+ version_requirements: *id012
204
190
  - !ruby/object:Gem::Dependency
205
191
  name: sprockets
206
192
  prerelease: false
207
- requirement: &id014 !ruby/object:Gem::Requirement
193
+ requirement: &id013 !ruby/object:Gem::Requirement
208
194
  requirements:
209
195
  - - ~>
210
196
  - !ruby/object:Gem::Version
@@ -214,11 +200,11 @@ dependencies:
214
200
  - 0
215
201
  version: 1.0.0
216
202
  type: :development
217
- version_requirements: *id014
203
+ version_requirements: *id013
218
204
  - !ruby/object:Gem::Dependency
219
205
  name: unindent
220
206
  prerelease: false
221
- requirement: &id015 !ruby/object:Gem::Requirement
207
+ requirement: &id014 !ruby/object:Gem::Requirement
222
208
  requirements:
223
209
  - - ~>
224
210
  - !ruby/object:Gem::Version
@@ -228,11 +214,11 @@ dependencies:
228
214
  - 0
229
215
  version: 0.9.0
230
216
  type: :development
231
- version_requirements: *id015
217
+ version_requirements: *id014
232
218
  - !ruby/object:Gem::Dependency
233
219
  name: growl
234
220
  prerelease: false
235
- requirement: &id016 !ruby/object:Gem::Requirement
221
+ requirement: &id015 !ruby/object:Gem::Requirement
236
222
  requirements:
237
223
  - - ~>
238
224
  - !ruby/object:Gem::Version
@@ -242,7 +228,7 @@ dependencies:
242
228
  - 0
243
229
  version: 1.0.0
244
230
  type: :development
245
- version_requirements: *id016
231
+ version_requirements: *id015
246
232
  description: Massimo builds HTML, Javascript, and CSS Files from your source.
247
233
  email: me@petebrowne.com
248
234
  executables:
@@ -253,22 +239,21 @@ extra_rdoc_files: []
253
239
 
254
240
  files:
255
241
  - bin/massimo
256
- - lib/massimo/cli.rb
257
- - lib/massimo/config.rb
258
- - lib/massimo/helpers.rb
259
- - lib/massimo/javascript.rb
242
+ - lib/massimo/stylesheet.rb
243
+ - lib/massimo/server.rb
244
+ - lib/massimo/view.rb
260
245
  - lib/massimo/page.rb
261
246
  - lib/massimo/resource.rb
262
- - lib/massimo/server.rb
263
- - lib/massimo/site.rb
264
- - lib/massimo/stylesheet.rb
247
+ - lib/massimo/cli.rb
248
+ - lib/massimo/config.rb
265
249
  - lib/massimo/ui.rb
266
- - lib/massimo/view.rb
267
250
  - lib/massimo/watcher.rb
251
+ - lib/massimo/site.rb
252
+ - lib/massimo/javascript.rb
253
+ - lib/massimo/helpers.rb
268
254
  - lib/massimo.rb
269
255
  - LICENSE
270
256
  - README.md
271
- - VERSION
272
257
  has_rdoc: true
273
258
  homepage: http://petebrowne.github.com/massimo/
274
259
  licenses: []
@@ -294,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
279
  version: "0"
295
280
  requirements: []
296
281
 
297
- rubyforge_project:
282
+ rubyforge_project: massimo
298
283
  rubygems_version: 1.3.6
299
284
  signing_key:
300
285
  specification_version: 3
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.6.0