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 CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in catapult.gemspec
4
- gemspec
4
+ gemspec
@@ -1 +1,5 @@
1
- //= require_tree .
1
+ //= require_tree .
2
+
3
+ var init = function(){
4
+ alert('init 2!');
5
+ };
@@ -1 +1,6 @@
1
- /*= require_tree .*/
1
+ /*= require_tree .*/
2
+
3
+ body {
4
+ color: #000;
5
+ background: #FFF;
6
+ }
data/lib/catapult.rb CHANGED
@@ -6,6 +6,7 @@ require 'coffee_script'
6
6
 
7
7
  module Catapult
8
8
  autoload :CLI, 'catapult/cli'
9
+ autoload :Compressor, 'catapult/compressor'
9
10
  autoload :TryStatic, 'catapult/try_static'
10
11
 
11
12
  def self.root
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
@@ -1,3 +1,3 @@
1
1
  module Catapult
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
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.3
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-07-26 00:00:00.000000000 Z
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: []
@@ -1,7 +0,0 @@
1
- {
2
- "name": "app",
3
- "version": "1.0.0",
4
- "dependencies": {
5
- "jquery": "latest"
6
- }
7
- }