catapult 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -1
- data/example/assets/javascripts/app.js +5 -1
- data/example/assets/stylesheets/app.css +6 -1
- data/lib/catapult.rb +1 -0
- data/lib/catapult/cli.rb +7 -1
- data/lib/catapult/compressor.rb +18 -0
- data/lib/catapult/version.rb +1 -1
- metadata +3 -3
- data/templates/app/browser.json +0 -7
data/Gemfile
CHANGED
data/lib/catapult.rb
CHANGED
data/lib/catapult/cli.rb
CHANGED
|
@@ -15,10 +15,16 @@ module Catapult
|
|
|
15
15
|
desc 'build [asset1 asset2..]', 'Build project'
|
|
16
16
|
|
|
17
17
|
method_option :target, :aliases => '-t', :desc => 'Directory to compile assets to'
|
|
18
|
+
method_option :compile, :type => :boolean, :aliases => '-c', :desc => 'Compile and minify assets'
|
|
18
19
|
|
|
19
20
|
def build(*assets)
|
|
20
21
|
target = Pathname(options[:target] || './public/assets')
|
|
21
22
|
|
|
23
|
+
if options[:compile]
|
|
24
|
+
Catapult.environment.js_compressor = Compressor::JS.new
|
|
25
|
+
Catapult.environment.css_compressor = Compressor::CSS.new
|
|
26
|
+
end
|
|
27
|
+
|
|
22
28
|
say "Building: #{Catapult.root}"
|
|
23
29
|
|
|
24
30
|
Catapult.environment.each_logical_path(assets) do |logical_path|
|
|
@@ -63,4 +69,4 @@ module Catapult
|
|
|
63
69
|
directory('templates/app', name)
|
|
64
70
|
end
|
|
65
71
|
end
|
|
66
|
-
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Catapult
|
|
2
|
+
module Compressor
|
|
3
|
+
class JS
|
|
4
|
+
def compress(source, options = {})
|
|
5
|
+
require 'uglifier'
|
|
6
|
+
Uglifier.compile(source, options)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class CSS
|
|
11
|
+
def compress(source, options = {})
|
|
12
|
+
require 'yui/compressor'
|
|
13
|
+
compressor = YUI::CssCompressor.new(options)
|
|
14
|
+
compressor.compress(source)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/catapult/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: catapult
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-08-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rack
|
|
@@ -161,12 +161,12 @@ files:
|
|
|
161
161
|
- example/public/index.html
|
|
162
162
|
- lib/catapult.rb
|
|
163
163
|
- lib/catapult/cli.rb
|
|
164
|
+
- lib/catapult/compressor.rb
|
|
164
165
|
- lib/catapult/try_static.rb
|
|
165
166
|
- lib/catapult/version.rb
|
|
166
167
|
- templates/app/Rakefile
|
|
167
168
|
- templates/app/assets/javascripts/app.js
|
|
168
169
|
- templates/app/assets/stylesheets/app.css
|
|
169
|
-
- templates/app/browser.json
|
|
170
170
|
- templates/app/public/index.html
|
|
171
171
|
homepage: ''
|
|
172
172
|
licenses: []
|