rapper_lite 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,13 +1,14 @@
1
1
  source "http://rubygems.org"
2
2
 
3
+ gem "yui-compressor", "~> 0.9.6"
4
+ gem "fssm", "~> 0.2.7"
5
+ gem "rb-fsevent"
6
+ gem "coffee-script", "~> 2.2.0"
7
+
3
8
  group :development do
4
- gem "rake", "~> 0.9.2"
9
+ gem "rake", "= 0.9.2"
5
10
  gem "rspec", "~> 1.3.2"
6
11
  gem "yard"
7
12
  gem "rdiscount", "~> 1.6.8"
8
13
  gem "jeweler", "~> 1.6.4"
9
- gem "yui-compressor", "~> 0.9.6"
10
- gem "fssm", "~> 0.2.7"
11
- gem "rb-fsevent"
12
- gem "coffee-script", "~> 2.2.0"
13
14
  end
@@ -18,12 +18,12 @@ GEM
18
18
  git (>= 1.2.5)
19
19
  rake
20
20
  multi_json (1.0.3)
21
- open4 (1.0.1)
21
+ open4 (1.2.0)
22
22
  rake (0.9.2)
23
23
  rb-fsevent (0.4.3.1)
24
24
  rdiscount (1.6.8)
25
25
  rspec (1.3.2)
26
- yard (0.6.4)
26
+ yard (0.7.2)
27
27
  yui-compressor (0.9.6)
28
28
  POpen4 (>= 0.1.4)
29
29
 
@@ -35,7 +35,7 @@ DEPENDENCIES
35
35
  coffee-script (~> 2.2.0)
36
36
  fssm (~> 0.2.7)
37
37
  jeweler (~> 1.6.4)
38
- rake (~> 0.9.2)
38
+ rake (= 0.9.2)
39
39
  rb-fsevent
40
40
  rdiscount (~> 1.6.8)
41
41
  rspec (~> 1.3.2)
@@ -1,59 +1,102 @@
1
- # rapper_lite #
2
-
3
- Bare-bones static asset packager and compressor. Currently supports CSS, JavaScript, and CoffeeScript. Uses MD5 versioning to avoid re-compressing packages that don't need to be re-compressed. Uses a simple config file so that you don't have to wrangle wacky comment DSLs in your source code just to join and compress a few files.
4
-
5
- ## Packaging assets without wanting to claw your eyes out
6
-
7
- 1. Create a config file:
8
-
9
- --- !omap
10
- - root: public/javascripts/
11
- - destination: public/assets/
12
- - compress: true
13
- - css: !omap
14
- - base: !omap
15
- - files:
16
- - reset
17
- - layout
18
- - typography
19
- - colores
20
- - version: 683e
21
- - js: !omap
22
- - mootools: !omap
23
- - files:
24
- - mootools-core
25
- - mootools-more
26
- - version: f3d9
27
- - base_combined: !omap
28
- - files:
29
- - preloader
30
- - +mootools
31
- - widgets
32
- - version: ccfc
33
-
34
- 2. Run rapper lite:
35
-
36
- $ rapper_lite config/static_assets.yml
37
-
38
- Watch for changes:
39
-
40
- $ rapper_lite --watch config/static_assets.yml
41
-
42
- If no config file is passed in, RapperLite will search for the config file:
1
+ # RapperLite #
2
+
3
+ RapperLite is a bare-bones static asset packager and compressor. It currently supports CSS, JavaScript, and CoffeeScript. It uses MD5 versioning to avoid re-compressing packages that don't need to be re-compressed. RapperLite can be set up with a single config file so that you don't have to wrangle wacky comment DSLs in your source code just to join and compress a few files.
4
+
5
+ ## Configuring ##
6
+
7
+ Create a YAML file (say, "rapper.yml") that defines your static asset packages like so:
8
+
9
+ --- !omap
10
+ - root: public/src/
11
+ - destination: public/assets/
12
+ - compress: true
13
+ - css: !omap
14
+ - base: !omap
15
+ - files:
16
+ - reset
17
+ - layout
18
+ - typography
19
+ - colores
20
+ - version: 683e
21
+ - js: !omap
22
+ - mootools: !omap
23
+ - files:
24
+ - mootools-core
25
+ - mootools-more
26
+ - version: f3d9
27
+ - base_combined: !omap
28
+ - files:
29
+ - preloader
30
+ - +mootools
31
+ - widgets
32
+ - version: ccfc
33
+
34
+ (Why the excessive use of `omap`? I'm doing this to ensure that the line order is maintained when I write updated version strings to the file. Why maintain order? Two words: merge conflicts.)
35
+
36
+ The above configuration will create the following compressed asset packages when RapperLite is run:
37
+
38
+ * `public/assets/base.css`
39
+ * `public/assets/mootools.js`
40
+ * `public/assets/base_combined.js`
41
+
42
+ Component files can be nested in subfolders:
43
+
44
+ ...
45
+ - base: !omap
46
+ - files:
47
+ - mootools-core
48
+ - extras/mootools-more
49
+ - extras/crazybox
50
+ - version: f3d9
51
+ ...
52
+
53
+ The "css" and "js" nodes of the config can override the "root" and "destination" config variables:
54
+
55
+ --- !omap
56
+ - destination: public/assets/
57
+ - compress: true
58
+ - css: !omap
59
+ - root: public/stylesheets/
60
+ - base: !omap
61
+ ...
62
+ - js: !omap
63
+ - root: public/javascripts/
64
+ - base: !omap
65
+ ...
66
+
67
+ ## Packaging assets ##
68
+
69
+ You can run RapperLite from the command line:
70
+
71
+ $ rapper_lite path/to/config.yml
72
+ or:
73
+ $ rapper_lite --watch path/to/config.yml
74
+
75
+ If no config file is passed in, RapperLite will search for the config file at:
43
76
 
44
77
  ./rapper.yml
45
78
  ./assets.yml
46
79
  ./config/rapper.yml
47
80
  ./config/assets.yml
48
81
 
49
- 3. That's it.
82
+ You can also run RapperLite from Ruby:
83
+
84
+ require "rapper_lite"
85
+ RapperLite::Engine.new( "config/rapper.yml" ).package
86
+
87
+ Or use the included Rake tasks by adding this to your `Rakefile`:
88
+
89
+ Rapper::Tasks.new do |config|
90
+ config[:path] = "config/assets.yml"
91
+ end
92
+
93
+ You can specify a custom namespace, if you want:
50
94
 
51
- Alternatively, you can run Rapper from Ruby:
95
+ Rapper::Tasks.new( :assets ) do |config| ...
52
96
 
53
- require "rapper_lite"
54
- RapperLite::Engine.new( "config/rapper.yml" ).package
97
+ ## CoffeeScript ##
55
98
 
56
- When you run `rapper_lite`, the config is automatically updated with the latest version numbers.
99
+ RapperLite transparently supports CoffeeScript. You don't have to do anything. Refer to the file in your config like you would any regular ol' JavaScript file.
57
100
 
58
101
  # Development
59
102
 
@@ -64,6 +107,7 @@ Rapper's got a Gemfile. You know what to do.
64
107
 
65
108
  ## Version history
66
109
 
110
+ * **0.1.2** - Update Gemfile, add "rapper-lite" command.
67
111
  * **0.1.1** - Turns out you can only release `master`, which `jeweler` doesn't tell you. Oops.
68
112
  * **0.1.0** - Add CoffeeScript support. Re-write `rapper_lite` command to allow watching for changes. Add watch support to Rake task.
69
113
  * **0.0.2** - Fix gem homepage link.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.join( File.expand_path( File.dirname(__FILE__) ), '../lib/rapper_lite' )
4
+ require "optparse"
5
+ require "fssm"
6
+ require "rb-fsevent"
7
+
8
+ module RapperLite
9
+ class CommandLine
10
+
11
+ attr_reader :rapper
12
+
13
+ def initialize
14
+ args, options = self.parse_args
15
+ @config_path = args.first || RapperLite::Engine.find_config_path
16
+ @rapper = self.build_rapper_engine
17
+ options[:watch] ? @rapper.watch : @rapper.noisy_package
18
+ end
19
+
20
+ def build_rapper_engine
21
+ puts "Loading RapperLite with #{@config_path}"
22
+ RapperLite::Engine.new( @config_path )
23
+ end
24
+
25
+ protected
26
+
27
+ def parse_args
28
+ options = {}
29
+ OptionParser.new do |opts|
30
+ opts.banner = "Usage: #{File.basename(__FILE__)} [-w|--watch] [-h|--help] [configfile]"
31
+ opts.on( "-h", "--help", "Print this message") do
32
+ p opts
33
+ exit 1
34
+ end
35
+ opts.on( "-w", "--watch", "Watch files for changes") do
36
+ options[:watch] = true
37
+ end
38
+ end.parse!
39
+ [ARGV, options]
40
+ end
41
+ end
42
+ end
43
+
44
+ RapperLite::CommandLine.new
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rapper_lite"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyson Tate"]
12
- s.date = "2011-10-05"
12
+ s.date = "2011-10-09"
13
13
  s.description = "Simple static asset packaging. Compresses files only when they're updated."
14
14
  s.email = "tyson@tysontate.com"
15
- s.executables = ["rapper_lite"]
15
+ s.executables = ["rapper-lite", "rapper_lite"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE.txt",
18
18
  "README.markdown"
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "README.markdown",
25
25
  "Rakefile",
26
26
  "VERSION",
27
+ "bin/rapper-lite",
27
28
  "bin/rapper_lite",
28
29
  "lib/rapper_lite.rb",
29
30
  "lib/rapper_lite/build.rb",
@@ -118,36 +119,36 @@ Gem::Specification.new do |s|
118
119
  s.specification_version = 3
119
120
 
120
121
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
121
- s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
122
+ s.add_runtime_dependency(%q<yui-compressor>, ["~> 0.9.6"])
123
+ s.add_runtime_dependency(%q<fssm>, ["~> 0.2.7"])
124
+ s.add_runtime_dependency(%q<rb-fsevent>, [">= 0"])
125
+ s.add_runtime_dependency(%q<coffee-script>, ["~> 2.2.0"])
126
+ s.add_development_dependency(%q<rake>, ["= 0.9.2"])
122
127
  s.add_development_dependency(%q<rspec>, ["~> 1.3.2"])
123
128
  s.add_development_dependency(%q<yard>, [">= 0"])
124
129
  s.add_development_dependency(%q<rdiscount>, ["~> 1.6.8"])
125
130
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
126
- s.add_development_dependency(%q<yui-compressor>, ["~> 0.9.6"])
127
- s.add_development_dependency(%q<fssm>, ["~> 0.2.7"])
128
- s.add_development_dependency(%q<rb-fsevent>, [">= 0"])
129
- s.add_development_dependency(%q<coffee-script>, ["~> 2.2.0"])
130
131
  else
131
- s.add_dependency(%q<rake>, ["~> 0.9.2"])
132
- s.add_dependency(%q<rspec>, ["~> 1.3.2"])
133
- s.add_dependency(%q<yard>, [">= 0"])
134
- s.add_dependency(%q<rdiscount>, ["~> 1.6.8"])
135
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
136
132
  s.add_dependency(%q<yui-compressor>, ["~> 0.9.6"])
137
133
  s.add_dependency(%q<fssm>, ["~> 0.2.7"])
138
134
  s.add_dependency(%q<rb-fsevent>, [">= 0"])
139
135
  s.add_dependency(%q<coffee-script>, ["~> 2.2.0"])
136
+ s.add_dependency(%q<rake>, ["= 0.9.2"])
137
+ s.add_dependency(%q<rspec>, ["~> 1.3.2"])
138
+ s.add_dependency(%q<yard>, [">= 0"])
139
+ s.add_dependency(%q<rdiscount>, ["~> 1.6.8"])
140
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
140
141
  end
141
142
  else
142
- s.add_dependency(%q<rake>, ["~> 0.9.2"])
143
- s.add_dependency(%q<rspec>, ["~> 1.3.2"])
144
- s.add_dependency(%q<yard>, [">= 0"])
145
- s.add_dependency(%q<rdiscount>, ["~> 1.6.8"])
146
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
147
143
  s.add_dependency(%q<yui-compressor>, ["~> 0.9.6"])
148
144
  s.add_dependency(%q<fssm>, ["~> 0.2.7"])
149
145
  s.add_dependency(%q<rb-fsevent>, [">= 0"])
150
146
  s.add_dependency(%q<coffee-script>, ["~> 2.2.0"])
147
+ s.add_dependency(%q<rake>, ["= 0.9.2"])
148
+ s.add_dependency(%q<rspec>, ["~> 1.3.2"])
149
+ s.add_dependency(%q<yard>, [">= 0"])
150
+ s.add_dependency(%q<rdiscount>, ["~> 1.6.8"])
151
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
151
152
  end
152
153
  end
153
154
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapper_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,110 +9,111 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-05 00:00:00.000000000 Z
12
+ date: 2011-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rake
16
- requirement: &70105090745260 !ruby/object:Gem::Requirement
15
+ name: yui-compressor
16
+ requirement: &70178373844640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.9.2
22
- type: :development
21
+ version: 0.9.6
22
+ type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70105090745260
24
+ version_requirements: *70178373844640
25
25
  - !ruby/object:Gem::Dependency
26
- name: rspec
27
- requirement: &70105090744000 !ruby/object:Gem::Requirement
26
+ name: fssm
27
+ requirement: &70178373841380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 1.3.2
33
- type: :development
32
+ version: 0.2.7
33
+ type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70105090744000
35
+ version_requirements: *70178373841380
36
36
  - !ruby/object:Gem::Dependency
37
- name: yard
38
- requirement: &70105090743240 !ruby/object:Gem::Requirement
37
+ name: rb-fsevent
38
+ requirement: &70178373840080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
- type: :development
44
+ type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70105090743240
46
+ version_requirements: *70178373840080
47
47
  - !ruby/object:Gem::Dependency
48
- name: rdiscount
49
- requirement: &70105090742340 !ruby/object:Gem::Requirement
48
+ name: coffee-script
49
+ requirement: &70178373839580 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 1.6.8
55
- type: :development
54
+ version: 2.2.0
55
+ type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70105090742340
57
+ version_requirements: *70178373839580
58
58
  - !ruby/object:Gem::Dependency
59
- name: jeweler
60
- requirement: &70105090741660 !ruby/object:Gem::Requirement
59
+ name: rake
60
+ requirement: &70178373838980 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
- - - ~>
63
+ - - =
64
64
  - !ruby/object:Gem::Version
65
- version: 1.6.4
65
+ version: 0.9.2
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70105090741660
68
+ version_requirements: *70178373838980
69
69
  - !ruby/object:Gem::Dependency
70
- name: yui-compressor
71
- requirement: &70105090740380 !ruby/object:Gem::Requirement
70
+ name: rspec
71
+ requirement: &70178373838400 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
75
75
  - !ruby/object:Gem::Version
76
- version: 0.9.6
76
+ version: 1.3.2
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70105090740380
79
+ version_requirements: *70178373838400
80
80
  - !ruby/object:Gem::Dependency
81
- name: fssm
82
- requirement: &70105090739480 !ruby/object:Gem::Requirement
81
+ name: yard
82
+ requirement: &70178373837680 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
- - - ~>
85
+ - - ! '>='
86
86
  - !ruby/object:Gem::Version
87
- version: 0.2.7
87
+ version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70105090739480
90
+ version_requirements: *70178373837680
91
91
  - !ruby/object:Gem::Dependency
92
- name: rb-fsevent
93
- requirement: &70105090737600 !ruby/object:Gem::Requirement
92
+ name: rdiscount
93
+ requirement: &70178373836940 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
- - - ! '>='
96
+ - - ~>
97
97
  - !ruby/object:Gem::Version
98
- version: '0'
98
+ version: 1.6.8
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70105090737600
101
+ version_requirements: *70178373836940
102
102
  - !ruby/object:Gem::Dependency
103
- name: coffee-script
104
- requirement: &70105090735640 !ruby/object:Gem::Requirement
103
+ name: jeweler
104
+ requirement: &70178373836300 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: 2.2.0
109
+ version: 1.6.4
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70105090735640
112
+ version_requirements: *70178373836300
113
113
  description: Simple static asset packaging. Compresses files only when they're updated.
114
114
  email: tyson@tysontate.com
115
115
  executables:
116
+ - rapper-lite
116
117
  - rapper_lite
117
118
  extensions: []
118
119
  extra_rdoc_files:
@@ -125,6 +126,7 @@ files:
125
126
  - README.markdown
126
127
  - Rakefile
127
128
  - VERSION
129
+ - bin/rapper-lite
128
130
  - bin/rapper_lite
129
131
  - lib/rapper_lite.rb
130
132
  - lib/rapper_lite/build.rb
@@ -223,7 +225,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
225
  version: '0'
224
226
  segments:
225
227
  - 0
226
- hash: 3082783424749448526
228
+ hash: 2634545149066051193
227
229
  required_rubygems_version: !ruby/object:Gem::Requirement
228
230
  none: false
229
231
  requirements: