rapper_lite 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.markdown +1 -0
- data/VERSION +1 -1
- data/lib/rapper_lite/build.rb +35 -14
- data/lib/rapper_lite/config.rb +4 -2
- data/rapper_lite.gemspec +5 -2
- data/spec/fixtures/src/simple_2.sass +3 -0
- data/spec/fixtures/testcases/combination/expected/base.css +1 -1
- data/spec/fixtures/testcases/combination/expected/base_combined.css +1 -1
- data/spec/fixtures/testcases/combination/rapper.yml +2 -2
- data/spec/fixtures/testcases/concatenation/expected/base.css +1 -2
- data/spec/fixtures/testcases/concatenation/expected/base_combined.css +1 -2
- data/spec/fixtures/testcases/concatenation/rapper.yml +2 -2
- metadata +32 -21
- data/spec/fixtures/src/simple_2.css +0 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -23,6 +23,7 @@ GEM
|
|
23
23
|
rb-fsevent (0.4.3.1)
|
24
24
|
rdiscount (1.6.8)
|
25
25
|
rspec (1.3.2)
|
26
|
+
sass (3.1.10)
|
26
27
|
yard (0.7.2)
|
27
28
|
yui-compressor (0.9.6)
|
28
29
|
POpen4 (>= 0.1.4)
|
@@ -39,5 +40,6 @@ DEPENDENCIES
|
|
39
40
|
rb-fsevent
|
40
41
|
rdiscount (~> 1.6.8)
|
41
42
|
rspec (~> 1.3.2)
|
43
|
+
sass (~> 3.1.10)
|
42
44
|
yard
|
43
45
|
yui-compressor (~> 0.9.6)
|
data/README.markdown
CHANGED
@@ -107,6 +107,7 @@ Rapper's got a Gemfile. You know what to do.
|
|
107
107
|
|
108
108
|
## Version history
|
109
109
|
|
110
|
+
* **0.2.0** - Add Sass support.
|
110
111
|
* **0.1.4** - Prevent premature unlinking of temp files used when processing CoffeesScript files. Bad GC, bad!
|
111
112
|
* **0.1.3** - Don't crash when errors are raised while watching for changes.
|
112
113
|
* **0.1.2** - Update Gemfile, add "rapper-lite" command.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/rapper_lite/build.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "coffee-script"
|
2
|
+
require "sass"
|
2
3
|
|
3
4
|
module RapperLite::Build
|
4
5
|
|
@@ -7,20 +8,11 @@ module RapperLite::Build
|
|
7
8
|
destination_file = self.destination_path( type, name )
|
8
9
|
tempfiles = []
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# Keep reference to prevent GC (premature unlinking)
|
16
|
-
tempfiles << tempfile
|
17
|
-
tempfile.write( CoffeeScript.compile( File.read( source_path ) ) )
|
18
|
-
tempfile.close
|
19
|
-
tempfile.path
|
20
|
-
else
|
21
|
-
source_path
|
22
|
-
end
|
23
|
-
end
|
11
|
+
source_paths.map! do |source_path|
|
12
|
+
tempfile, path = self.process( source_path )
|
13
|
+
# Keep reference so GC doesn't unlink file
|
14
|
+
tempfiles << tempfile if tempfile
|
15
|
+
path
|
24
16
|
end
|
25
17
|
|
26
18
|
# Join files and compress if needed
|
@@ -30,4 +22,33 @@ module RapperLite::Build
|
|
30
22
|
# Cleanup
|
31
23
|
tempfiles.each{ |tempfile| tempfile.unlink }
|
32
24
|
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
# Returns tuple: [nil or Tempfile, path to file]
|
29
|
+
def process( source_path )
|
30
|
+
tempfile = nil
|
31
|
+
path = source_path
|
32
|
+
|
33
|
+
if engine = self.conversion_engine( source_path )
|
34
|
+
tempfile = Tempfile.new( "rapper_lite_source" )
|
35
|
+
if engine == Sass
|
36
|
+
tempfile.write( engine.compile( File.read( source_path ), :syntax => :sass ) )
|
37
|
+
else
|
38
|
+
tempfile.write( engine.compile( File.read( source_path ) ) )
|
39
|
+
end
|
40
|
+
tempfile.close
|
41
|
+
path = tempfile.path
|
42
|
+
end
|
43
|
+
|
44
|
+
[tempfile, path]
|
45
|
+
end
|
46
|
+
|
47
|
+
def conversion_engine( source_path )
|
48
|
+
{
|
49
|
+
".sass" => Sass,
|
50
|
+
".coffee" => CoffeeScript
|
51
|
+
}[File.extname( source_path )]
|
52
|
+
end
|
53
|
+
|
33
54
|
end
|
data/lib/rapper_lite/config.rb
CHANGED
@@ -34,8 +34,10 @@ module RapperLite::Config
|
|
34
34
|
coffee_path = File.join( self.root( type ), "#{file}.coffee" )
|
35
35
|
js_path = File.join( self.root( type ), "#{file}.js" )
|
36
36
|
File.exists?( coffee_path ) ? coffee_path : js_path
|
37
|
-
else
|
38
|
-
File.join( self.root( type ), "#{file}
|
37
|
+
else # CSS
|
38
|
+
sass_path = File.join( self.root( type ), "#{file}.sass" )
|
39
|
+
css_path = File.join( self.root( type ), "#{file}.css" )
|
40
|
+
File.exists?( sass_path ) ? sass_path : css_path
|
39
41
|
end
|
40
42
|
end.flatten
|
41
43
|
end
|
data/rapper_lite.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rapper_lite"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
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"]
|
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
|
|
39
39
|
"spec/fixtures/src/coffeescript.coffee",
|
40
40
|
"spec/fixtures/src/simple_1.css",
|
41
41
|
"spec/fixtures/src/simple_1.js",
|
42
|
-
"spec/fixtures/src/simple_2.
|
42
|
+
"spec/fixtures/src/simple_2.sass",
|
43
43
|
"spec/fixtures/src/subfolder/simple_2.js",
|
44
44
|
"spec/fixtures/testcases/combination/expected/base.css",
|
45
45
|
"spec/fixtures/testcases/combination/expected/base.js",
|
@@ -123,6 +123,7 @@ Gem::Specification.new do |s|
|
|
123
123
|
s.add_runtime_dependency(%q<fssm>, ["~> 0.2.7"])
|
124
124
|
s.add_runtime_dependency(%q<rb-fsevent>, [">= 0"])
|
125
125
|
s.add_runtime_dependency(%q<coffee-script>, ["~> 2.2.0"])
|
126
|
+
s.add_runtime_dependency(%q<sass>, ["~> 3.1.10"])
|
126
127
|
s.add_development_dependency(%q<rake>, ["= 0.9.2"])
|
127
128
|
s.add_development_dependency(%q<rspec>, ["~> 1.3.2"])
|
128
129
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
@@ -133,6 +134,7 @@ Gem::Specification.new do |s|
|
|
133
134
|
s.add_dependency(%q<fssm>, ["~> 0.2.7"])
|
134
135
|
s.add_dependency(%q<rb-fsevent>, [">= 0"])
|
135
136
|
s.add_dependency(%q<coffee-script>, ["~> 2.2.0"])
|
137
|
+
s.add_dependency(%q<sass>, ["~> 3.1.10"])
|
136
138
|
s.add_dependency(%q<rake>, ["= 0.9.2"])
|
137
139
|
s.add_dependency(%q<rspec>, ["~> 1.3.2"])
|
138
140
|
s.add_dependency(%q<yard>, [">= 0"])
|
@@ -144,6 +146,7 @@ Gem::Specification.new do |s|
|
|
144
146
|
s.add_dependency(%q<fssm>, ["~> 0.2.7"])
|
145
147
|
s.add_dependency(%q<rb-fsevent>, [">= 0"])
|
146
148
|
s.add_dependency(%q<coffee-script>, ["~> 2.2.0"])
|
149
|
+
s.add_dependency(%q<sass>, ["~> 3.1.10"])
|
147
150
|
s.add_dependency(%q<rake>, ["= 0.9.2"])
|
148
151
|
s.add_dependency(%q<rspec>, ["~> 1.3.2"])
|
149
152
|
s.add_dependency(%q<yard>, [">= 0"])
|
@@ -1 +1 @@
|
|
1
|
-
body{margin:0;color:#333}*{margin:0;color
|
1
|
+
body{margin:0;color:#333}*{margin:0;color:white}
|
@@ -1 +1 @@
|
|
1
|
-
body{margin:0;color:#333}*{margin:0;color
|
1
|
+
body{margin:0;color:#333}*{margin:0;color:white}body{margin:0;color:#333}
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yui-compressor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70353465397060 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70353465397060
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fssm
|
27
|
-
requirement: &
|
27
|
+
requirement: &70353465395900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.2.7
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70353465395900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rb-fsevent
|
38
|
-
requirement: &
|
38
|
+
requirement: &70353465394400 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70353465394400
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: coffee-script
|
49
|
-
requirement: &
|
49
|
+
requirement: &70353465391800 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,21 @@ dependencies:
|
|
54
54
|
version: 2.2.0
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70353465391800
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: sass
|
60
|
+
requirement: &70353465390700 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 3.1.10
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70353465390700
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: rake
|
60
|
-
requirement: &
|
71
|
+
requirement: &70353465390060 !ruby/object:Gem::Requirement
|
61
72
|
none: false
|
62
73
|
requirements:
|
63
74
|
- - =
|
@@ -65,10 +76,10 @@ dependencies:
|
|
65
76
|
version: 0.9.2
|
66
77
|
type: :development
|
67
78
|
prerelease: false
|
68
|
-
version_requirements: *
|
79
|
+
version_requirements: *70353465390060
|
69
80
|
- !ruby/object:Gem::Dependency
|
70
81
|
name: rspec
|
71
|
-
requirement: &
|
82
|
+
requirement: &70353465389360 !ruby/object:Gem::Requirement
|
72
83
|
none: false
|
73
84
|
requirements:
|
74
85
|
- - ~>
|
@@ -76,10 +87,10 @@ dependencies:
|
|
76
87
|
version: 1.3.2
|
77
88
|
type: :development
|
78
89
|
prerelease: false
|
79
|
-
version_requirements: *
|
90
|
+
version_requirements: *70353465389360
|
80
91
|
- !ruby/object:Gem::Dependency
|
81
92
|
name: yard
|
82
|
-
requirement: &
|
93
|
+
requirement: &70353465388680 !ruby/object:Gem::Requirement
|
83
94
|
none: false
|
84
95
|
requirements:
|
85
96
|
- - ! '>='
|
@@ -87,10 +98,10 @@ dependencies:
|
|
87
98
|
version: '0'
|
88
99
|
type: :development
|
89
100
|
prerelease: false
|
90
|
-
version_requirements: *
|
101
|
+
version_requirements: *70353465388680
|
91
102
|
- !ruby/object:Gem::Dependency
|
92
103
|
name: rdiscount
|
93
|
-
requirement: &
|
104
|
+
requirement: &70353465388060 !ruby/object:Gem::Requirement
|
94
105
|
none: false
|
95
106
|
requirements:
|
96
107
|
- - ~>
|
@@ -98,10 +109,10 @@ dependencies:
|
|
98
109
|
version: 1.6.8
|
99
110
|
type: :development
|
100
111
|
prerelease: false
|
101
|
-
version_requirements: *
|
112
|
+
version_requirements: *70353465388060
|
102
113
|
- !ruby/object:Gem::Dependency
|
103
114
|
name: jeweler
|
104
|
-
requirement: &
|
115
|
+
requirement: &70353465387400 !ruby/object:Gem::Requirement
|
105
116
|
none: false
|
106
117
|
requirements:
|
107
118
|
- - ~>
|
@@ -109,7 +120,7 @@ dependencies:
|
|
109
120
|
version: 1.6.4
|
110
121
|
type: :development
|
111
122
|
prerelease: false
|
112
|
-
version_requirements: *
|
123
|
+
version_requirements: *70353465387400
|
113
124
|
description: Simple static asset packaging. Compresses files only when they're updated.
|
114
125
|
email: tyson@tysontate.com
|
115
126
|
executables:
|
@@ -141,7 +152,7 @@ files:
|
|
141
152
|
- spec/fixtures/src/coffeescript.coffee
|
142
153
|
- spec/fixtures/src/simple_1.css
|
143
154
|
- spec/fixtures/src/simple_1.js
|
144
|
-
- spec/fixtures/src/simple_2.
|
155
|
+
- spec/fixtures/src/simple_2.sass
|
145
156
|
- spec/fixtures/src/subfolder/simple_2.js
|
146
157
|
- spec/fixtures/testcases/combination/expected/base.css
|
147
158
|
- spec/fixtures/testcases/combination/expected/base.js
|
@@ -225,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
236
|
version: '0'
|
226
237
|
segments:
|
227
238
|
- 0
|
228
|
-
hash: -
|
239
|
+
hash: -179179325362599579
|
229
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
241
|
none: false
|
231
242
|
requirements:
|