catapult 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,6 +1,4 @@
1
- Copyright (c) 2012 Alex MacCaw
2
-
3
- MIT License
1
+ Copyright (c) 2012 Alex MacCaw (info@eribium.org)
4
2
 
5
3
  Permission is hereby granted, free of charge, to any person obtaining
6
4
  a copy of this software and associated documentation files (the
@@ -19,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
17
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
19
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -12,20 +12,31 @@ Catapult is especially useful alongside MVC frameworks like [Spine](http://spine
12
12
 
13
13
  To generate an app, use:
14
14
 
15
- catapult new myapp
16
- cd myapp
15
+ $ catapult new myapp
16
+
17
+ create myapp
18
+ create myapp/assets/javascripts/app.js
19
+ create myapp/assets/stylesheets/app.css
20
+ create myapp/browser.json
21
+ create myapp/public/index.htm
22
+
23
+ $ cd myapp
24
+
25
+ You'll notice a bunch of files have been created. The convention in Catapult is that any assets under `assets/javascripts` and `assets/stylsheets` will be compiled under the static `public` directory. Your HTML files can reference them there.
17
26
 
18
27
  Now you can start a catapult server:
19
28
 
20
- catapult server
29
+ $ catapult server
30
+
31
+ And open up the app [in your browser](http://localhost:9292).
21
32
 
22
- Or build the files for deployment:
33
+ You can also build the files for deployment:
23
34
 
24
- catapult build
35
+ $ catapult build
25
36
 
26
37
  Or watch the files for changes, and then automatically build:
27
38
 
28
- catapult watch
39
+ $ catapult watch
29
40
 
30
41
  ## Concatenation
31
42
 
data/catapult.gemspec CHANGED
@@ -22,5 +22,5 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency 'stylus', '~> 0.6.2'
23
23
  gem.add_dependency 'coffee-script', '~> 2.2.0'
24
24
  gem.add_dependency 'thor', '~> 0.15.2'
25
- gem.add_dependency 'thin', '~> 1.3.1'
25
+ gem.add_dependency 'thin'
26
26
  end
data/example/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'catapult'
2
+
3
+ namespace :assets do
4
+ desc "Compile all the assets to ./public/assets."
5
+ task :precompile do
6
+ Catapult::CLI.new.build
7
+ end
8
+ end
data/lib/catapult/cli.rb CHANGED
@@ -12,14 +12,16 @@ module Catapult
12
12
  File.expand_path('../../..', __FILE__)
13
13
  end
14
14
 
15
- desc 'build', 'Build project'
15
+ desc 'build [asset1 asset2..]', 'Build project'
16
16
 
17
- def build
18
- target = Pathname('./public/assets')
17
+ method_option :target, :aliases => '-t', :desc => 'Directory to compile assets to'
18
+
19
+ def build(*assets)
20
+ target = Pathname(options[:target] || './public/assets')
19
21
 
20
22
  say "Building: #{Catapult.root}"
21
23
 
22
- Catapult.environment.each_logical_path do |logical_path|
24
+ Catapult.environment.each_logical_path(assets) do |logical_path|
23
25
  if asset = Catapult.environment.find_asset(logical_path)
24
26
  filename = target.join(logical_path)
25
27
  FileUtils.mkpath(filename.dirname)
@@ -40,12 +42,14 @@ module Catapult
40
42
  )
41
43
  end
42
44
 
43
- desc 'watch', 'Build project whenever it changes'
45
+ desc 'watch [asset1 asset2..]', 'Build project whenever it changes'
46
+
47
+ method_option :target, :aliases => '-t', :desc => 'Directory to compile assets to'
44
48
 
45
- def watch
49
+ def watch(*assets)
46
50
  say "Watching: #{Catapult.root}"
47
51
 
48
- build
52
+ build(*assets)
49
53
 
50
54
  paths = Catapult.environment.paths
51
55
  paths = paths.select {|p| File.exists?(p) }
@@ -59,4 +63,4 @@ module Catapult
59
63
  directory('templates/app', name)
60
64
  end
61
65
  end
62
- end
66
+ end
@@ -1,3 +1,3 @@
1
1
  module Catapult
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/lib/catapult.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  require 'pathname'
2
2
  require 'sprockets'
3
3
  require 'sprockets/commonjs'
4
- require 'stylus/tilt'
5
- require 'stylus/import_processor'
4
+ require 'stylus'
6
5
  require 'coffee_script'
7
6
 
8
7
  module Catapult
@@ -25,9 +24,7 @@ module Catapult
25
24
  env.append_path(root.join('vendor', 'assets', 'stylesheets'))
26
25
 
27
26
  env.append_path(root.join('browser_modules'))
28
-
29
- env.register_engine '.styl', Tilt::StylusTemplate
30
- env.register_preprocessor 'text/css', Stylus::ImportProcessor
27
+ Stylus.setup(env)
31
28
 
32
29
  env
33
30
  end
@@ -0,0 +1,8 @@
1
+ require 'catapult'
2
+
3
+ namespace :assets do
4
+ desc "Compile all the assets to ./public/assets."
5
+ task :precompile do
6
+ Catapult::CLI.new.build
7
+ end
8
+ end
@@ -1,8 +1,8 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <link rel="stylesheet" href="/assets/app.css" type="text/css">
5
- <script src="/assets/app.js"></script>
4
+ <link rel="stylesheet" href="assets/app.css" type="text/css">
5
+ <script src="assets/app.js"></script>
6
6
  </head>
7
7
  <body>
8
8
  <p>Hello world!</p>
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.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-04 00:00:00.000000000Z
12
+ date: 2012-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70125153064060 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 1.4.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70125153064060
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.4.1
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: sprockets
27
- requirement: &70125153063440 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,21 +37,31 @@ dependencies:
32
37
  version: 2.4.3
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70125153063440
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.4.3
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: sprockets-commonjs
38
- requirement: &70125153062900 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
- - - =
51
+ - - '='
42
52
  - !ruby/object:Gem::Version
43
53
  version: 0.0.6.pre
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70125153062900
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.6.pre
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: listen
49
- requirement: &70125153062320 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 0.4.2
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70125153062320
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.4.2
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: stylus
60
- requirement: &70125153061740 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: 0.6.2
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *70125153061740
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.6.2
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: coffee-script
71
- requirement: &70125153061200 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ~>
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: 2.2.0
77
102
  type: :runtime
78
103
  prerelease: false
79
- version_requirements: *70125153061200
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 2.2.0
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: thor
82
- requirement: &70125153060620 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ~>
@@ -87,18 +117,28 @@ dependencies:
87
117
  version: 0.15.2
88
118
  type: :runtime
89
119
  prerelease: false
90
- version_requirements: *70125153060620
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 0.15.2
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: thin
93
- requirement: &70125153060040 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
- - - ~>
131
+ - - ! '>='
97
132
  - !ruby/object:Gem::Version
98
- version: 1.3.1
133
+ version: '0'
99
134
  type: :runtime
100
135
  prerelease: false
101
- version_requirements: *70125153060040
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
102
142
  description: A Sprockets/Rack build tool
103
143
  email:
104
144
  - maccman@gmail.com
@@ -114,6 +154,7 @@ files:
114
154
  - Rakefile
115
155
  - bin/catapult
116
156
  - catapult.gemspec
157
+ - example/Rakefile
117
158
  - example/assets/javascripts/app.js
118
159
  - example/assets/stylesheets/app.css
119
160
  - example/browser.json
@@ -122,6 +163,7 @@ files:
122
163
  - lib/catapult/cli.rb
123
164
  - lib/catapult/try_static.rb
124
165
  - lib/catapult/version.rb
166
+ - templates/app/Rakefile
125
167
  - templates/app/assets/javascripts/app.js
126
168
  - templates/app/assets/stylesheets/app.css
127
169
  - templates/app/browser.json
@@ -146,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
188
  version: '0'
147
189
  requirements: []
148
190
  rubyforge_project:
149
- rubygems_version: 1.8.15
191
+ rubygems_version: 1.8.24
150
192
  signing_key:
151
193
  specification_version: 3
152
194
  summary: Easily build JavaScript projects