troy 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 136e02f77e72b005c3d642ec37ff5dff5f859d11
4
- data.tar.gz: ea97f87db3e5bb3044c4ccd993f8f9e7a7004a0e
3
+ metadata.gz: b0cb33c1466fb12e1d2b975874e90bb3fc560117
4
+ data.tar.gz: 007c87ea56467b6347ee07975cea08474f64ae1d
5
5
  SHA512:
6
- metadata.gz: 758605c69fd298e59f09ea79f81b5c1aaf7e1cea25c9bec8665ff240b2ca61075fd743367cfe6d2e0b3b2a832c0c002e91d11d7b9adfdd7702dc8b1cf0814396
7
- data.tar.gz: bebcae06861166c675ded1d4a57ab8c2bfa18cb2901eb0101380ab6b77f855a6a2e72da60a9c91a48a3fa580765a65ee4438c4b459d53b4e0ed3560667635740
6
+ metadata.gz: 5a867d4b860d83bc956c1fbc210a02dede63d58e555e640f8857e512efb63d61871d2d50b41a8b2f47e5a3fbde29adb9603227f44495137ea14f0956ba0b7baa
7
+ data.tar.gz: 5330ce2340108a55a648f388235121c6fbc8b23789e711c741aa2db697349910939d2726b0866e904f347fcce07ed4e9e1d9e3f2a7363f93b7dfa29d40ee25c2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- troy (0.0.20)
4
+ troy (0.0.21)
5
5
  builder
6
6
  html_press
7
7
  i18n
@@ -21,7 +21,7 @@ GEM
21
21
  json
22
22
  csspool-st (3.1.2)
23
23
  diff-lcs (1.2.4)
24
- execjs (2.0.1)
24
+ execjs (2.0.2)
25
25
  hike (1.2.3)
26
26
  html_press (0.8.2)
27
27
  htmlentities
@@ -34,7 +34,7 @@ GEM
34
34
  css_press
35
35
  multi_js (0.1.0)
36
36
  uglifier (~> 2)
37
- multi_json (1.8.0)
37
+ multi_json (1.8.1)
38
38
  rack (1.5.2)
39
39
  redcarpet (3.0.0)
40
40
  rspec (2.13.0)
@@ -45,7 +45,7 @@ GEM
45
45
  rspec-expectations (2.13.0)
46
46
  diff-lcs (>= 1.1.3, < 2.0)
47
47
  rspec-mocks (2.13.1)
48
- sass (3.2.10)
48
+ sass (3.2.12)
49
49
  sprockets (2.10.0)
50
50
  hike (~> 1.2)
51
51
  multi_json (~> 1.0)
data/lib/troy/cli.rb CHANGED
@@ -19,6 +19,7 @@ module Troy
19
19
  def export
20
20
  if options[:assets]
21
21
  site.export_assets
22
+ site.export_files
22
23
  elsif options[:file]
23
24
  site.export_pages(options[:file])
24
25
  else
@@ -9,7 +9,12 @@ module Troy
9
9
 
10
10
  class Configuration < OpenStruct
11
11
  def assets
12
- @assets ||= Configuration.new
12
+ @assets ||= Configuration.new({
13
+ compress_html: true,
14
+ compress_css: true,
15
+ compress_js: true,
16
+ precompile: []
17
+ })
13
18
  end
14
19
 
15
20
  def i18n
data/lib/troy/page.rb CHANGED
@@ -63,7 +63,7 @@ module Troy
63
63
  #
64
64
  #
65
65
  def compress(content)
66
- content = HtmlPress.press(content) if Troy.configuration.compress_html
66
+ content = HtmlPress.press(content) if config.assets.compress_html
67
67
  content
68
68
  end
69
69
 
@@ -135,5 +135,11 @@ module Troy
135
135
  FileUtils.mkdir_p(File.dirname(output_file))
136
136
  save_to(output_file)
137
137
  end
138
+
139
+ #
140
+ #
141
+ def config
142
+ Troy.configuration
143
+ end
138
144
  end
139
145
  end
data/lib/troy/site.rb CHANGED
@@ -21,8 +21,8 @@ module Troy
21
21
  #
22
22
  #
23
23
  def set_locale
24
- I18n.load_path += Troy.configuration.i18n.load_path
25
- I18n.locale = Troy.configuration.i18n.locale
24
+ I18n.load_path += config.i18n.load_path
25
+ I18n.locale = config.i18n.locale
26
26
  end
27
27
 
28
28
  #
@@ -74,11 +74,11 @@ module Troy
74
74
  sprockets = Sprockets::Environment.new
75
75
  sprockets.append_path root.join("assets/javascripts")
76
76
  sprockets.append_path root.join("assets/stylesheets")
77
- sprockets.css_compressor = Sprockets::SassCompressor
78
- sprockets.js_compressor = Uglifier.new(:copyright => false)
77
+ sprockets.css_compressor = Sprockets::SassCompressor if config.assets.compress_css
78
+ sprockets.js_compressor = Uglifier.new(copyright: false) if config.assets.compress_js
79
79
  sprockets.default_external_encoding = Encoding::UTF_8
80
80
 
81
- Troy.configuration.assets.precompile.each do |asset_name|
81
+ config.assets.precompile.each do |asset_name|
82
82
  asset = sprockets[asset_name]
83
83
  output_file = asset.pathname.to_s
84
84
  .gsub(root.join("assets").to_s, "")
@@ -101,5 +101,10 @@ module Troy
101
101
  def pages
102
102
  @pages ||= source.map {|path| Page.new(self, path) }
103
103
  end
104
+
105
+ # A shortcut to the configuration.
106
+ def config
107
+ Troy.configuration
108
+ end
104
109
  end
105
110
  end
data/lib/troy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Troy
2
- VERSION = "0.0.20"
2
+ VERSION = "0.0.21"
3
3
  end
data/templates/troy.rb CHANGED
@@ -12,5 +12,11 @@ Troy.configure do |config|
12
12
  config.assets.precompile = %w[style.css script.js]
13
13
 
14
14
  # Compress HTML, removing whitespaces.
15
- config.compress_html = true
15
+ config.assets.compress_html = true
16
+
17
+ # Compress JavaScript.
18
+ config.assets.compress_js = true
19
+
20
+ # Compress CSS.
21
+ config.assets.compress_css = true
16
22
  end
data/troy.gemspec CHANGED
@@ -15,6 +15,14 @@ Gem::Specification.new do |gem|
15
15
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
16
  gem.require_paths = ["lib"]
17
17
 
18
+ gem.post_install_message = <<-TEXT
19
+
20
+ => Troy's configuration file has been updated.
21
+ => Please update it according to the new template.
22
+ => http://fnando.me/ny
23
+
24
+ TEXT
25
+
18
26
  gem.add_dependency "i18n"
19
27
  gem.add_dependency "thor"
20
28
  gem.add_dependency "redcarpet"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: troy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-29 00:00:00.000000000 Z
11
+ date: 2013-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -198,7 +198,12 @@ files:
198
198
  homepage: http://github.com/fnando/troy
199
199
  licenses: []
200
200
  metadata: {}
201
- post_install_message:
201
+ post_install_message: |2+
202
+
203
+ => Troy's configuration file has been updated.
204
+ => Please update it according to the new template.
205
+ => http://fnando.me/ny
206
+
202
207
  rdoc_options: []
203
208
  require_paths:
204
209
  - lib
@@ -214,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
219
  version: '0'
215
220
  requirements: []
216
221
  rubyforge_project:
217
- rubygems_version: 2.1.0
222
+ rubygems_version: 2.0.3
218
223
  signing_key:
219
224
  specification_version: 4
220
225
  summary: A static site generator