massimo 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/massimo/cli.rb CHANGED
@@ -5,10 +5,11 @@ module Massimo
5
5
  include Thor::Actions
6
6
 
7
7
  default_task :build
8
- class_option 'config', :desc => 'Path to the config file', :aliases => '-c'
9
- class_option 'source_path', :desc => 'Path to the source dir', :aliases => '-s'
10
- class_option 'output_path', :desc => 'Path to the output dir', :aliases => '-o'
11
- class_option 'production', :desc => 'Sets the Site environment', :aliases => '-p', :type => :boolean
8
+ class_option 'config', :desc => 'Path to the config file', :aliases => '-c'
9
+ class_option 'source_path', :desc => 'Path to the source dir', :aliases => '-s'
10
+ class_option 'output_path', :desc => 'Path to the output dir', :aliases => '-o'
11
+ class_option 'environment', :desc => 'Sets the Site environment', :aliases => '-e'
12
+ class_option 'production', :desc => "Sets the Site environment to 'production'", :aliases => '-p', :type => :boolean
12
13
 
13
14
  desc 'build', 'Builds the site'
14
15
  def build
@@ -76,7 +77,8 @@ module Massimo
76
77
  def site
77
78
  @site ||= begin
78
79
  site = Massimo::Site.new config_file(:yml)
79
- site.config.production = options[:production]
80
+ site.config.environment = 'production' if options[:production]
81
+ site.config.environment = options[:environment] if options[:environment]
80
82
  site.config.source_path = options[:source_path] if options[:source_path]
81
83
  site.config.output_path = options[:output_path] if options[:output_path]
82
84
  if config_rb = config_file(:rb)
@@ -1,4 +1,5 @@
1
1
  require 'active_support/core_ext/hash/keys'
2
+ require 'active_support/string_inquirer'
2
3
  require 'ostruct'
3
4
  require 'yaml'
4
5
 
@@ -7,6 +8,7 @@ module Massimo
7
8
  DEFAULT_OPTIONS = {
8
9
  :source_path => '.',
9
10
  :output_path => 'public',
11
+ :environment => 'development',
10
12
  :resources_path => '.',
11
13
  :base_url => '/',
12
14
  :resources_url => '/',
@@ -35,6 +37,12 @@ module Massimo
35
37
  File.expand_path super
36
38
  end
37
39
 
40
+ # Return the enviornment option wrapped by a StringInquirer, so you can
41
+ # query the environment like this: `config.environment.production?`
42
+ def environment
43
+ ActiveSupport::StringInquirer.new(super)
44
+ end
45
+
38
46
  # Get a full, expanded path for the given resource name. This is either set
39
47
  # in the configuration or determined dynamically based on the name.
40
48
  def path_for(resource_name)
@@ -61,11 +69,5 @@ module Massimo
61
69
  def options_for(lib_name)
62
70
  send(lib_name) || {}
63
71
  end
64
-
65
- # Wether or not the Site's environment is in production mode. Usually you would
66
- # want to set this to compress and concat assets.
67
- def production?
68
- !!self.production
69
- end
70
72
  end
71
73
  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 = '0.6.3'
15
+ VERSION = '0.6.4'
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
- - 3
9
- version: 0.6.3
8
+ - 4
9
+ version: 0.6.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pete Browne
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-03 00:00:00 -05:00
17
+ date: 2010-05-04 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency