gearup 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  pkg
2
2
  Gemfile.lock
3
+ target
data/bin/gearup CHANGED
@@ -1,16 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rubygems'
4
- require 'rack'
5
- require 'less'
6
- require 'coffee-script'
7
- require 'sprockets'
8
- require 'haml'
3
+ $LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
9
4
 
5
+ require 'rubygems'
6
+ require 'gearup'
10
7
 
11
- env = Sprockets::Environment.new ARGV[0] || "."
12
- env.register_engine '.haml', Tilt::HamlTemplate
13
- env.append_path "."
8
+ include Gearup
14
9
 
15
- Rack::Handler::WEBrick.run(env, :Port => 3000)
10
+ Server.new(Environment.build(ARGV[0] || "."), 3000).start
16
11
 
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
4
+
5
+ require 'rubygems'
6
+ require 'gearup'
7
+ require 'pathname'
8
+
9
+ include Gearup
10
+
11
+ asset_dir, target_dir, *assets = ARGV
12
+
13
+ env = Environment.build(asset_dir)
14
+
15
+ assets.each do |asset_name|
16
+ asset = env.find_asset(asset_name)
17
+ destination_path = Pathname.new(File.expand_path(asset.digest_path, target_dir))
18
+ destination_path.dirname.mkpath
19
+ File.open(destination_path, 'w') {|f| f.write asset.body }
20
+ end
21
+
@@ -0,0 +1,9 @@
1
+ module Gearup
2
+ module Context
3
+ def asset_url asset
4
+ depend_on_asset asset
5
+ environment.find_asset(asset).digest_path
6
+ end
7
+ end
8
+ end
9
+
@@ -0,0 +1,24 @@
1
+ require 'less'
2
+ require 'coffee-script'
3
+ require 'haml'
4
+ require 'sass'
5
+ require 'sprockets'
6
+ require 'gearup/context'
7
+
8
+ module Gearup
9
+ module Environment
10
+ def self.build root
11
+ env = Sprockets::Environment.new root
12
+ env.register_engine '.haml', Tilt::HamlTemplate
13
+ env.register_engine '.sass', Tilt::SassTemplate
14
+ env.append_path "."
15
+
16
+ env.context_class.class_eval do
17
+ include Gearup::Context
18
+ end
19
+
20
+ env
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,15 @@
1
+ require 'rack'
2
+
3
+ module Gearup
4
+ class Server
5
+ def initialize env, port
6
+ @env = env
7
+ @port = port
8
+ end
9
+
10
+ def start
11
+ Rack::Handler::WEBrick.run(@env, :Port => @port)
12
+ end
13
+ end
14
+ end
15
+
@@ -1,3 +1,3 @@
1
1
  module Gearup
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/gearup.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'gearup/server'
2
+ require 'gearup/context'
3
+ require 'gearup/environment'
data/test/index.html.haml CHANGED
@@ -1,6 +1,7 @@
1
1
  !!!html5
2
2
  %html
3
3
  %head
4
+ %script{:src => asset_url("application.js")}
4
5
  %style
5
6
  :plain
6
7
  body {
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gearup
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrew Kiellor
@@ -116,6 +116,7 @@ email:
116
116
  - akiellor@thoughtworks.com
117
117
  executables:
118
118
  - gearup
119
+ - gearup-package
119
120
  extensions: []
120
121
 
121
122
  extra_rdoc_files: []
@@ -127,7 +128,12 @@ files:
127
128
  - README.md
128
129
  - Rakefile
129
130
  - bin/gearup
131
+ - bin/gearup-package
130
132
  - gearup.gemspec
133
+ - lib/gearup.rb
134
+ - lib/gearup/context.rb
135
+ - lib/gearup/environment.rb
136
+ - lib/gearup/server.rb
131
137
  - lib/gearup/version.rb
132
138
  - test/application.css.less
133
139
  - test/application.js.coffee