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 CHANGED
@@ -4,6 +4,7 @@ gem "yui-compressor", "~> 0.9.6"
4
4
  gem "fssm", "~> 0.2.7"
5
5
  gem "rb-fsevent"
6
6
  gem "coffee-script", "~> 2.2.0"
7
+ gem "sass", "~> 3.1.10"
7
8
 
8
9
  group :development do
9
10
  gem "rake", "= 0.9.2"
@@ -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)
@@ -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.4
1
+ 0.2.0
@@ -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
- # Convert any CoffeeScript to JS
11
- if type == :js
12
- source_paths.map! do |source_path|
13
- if File.extname( source_path ) == ".coffee"
14
- tempfile = Tempfile.new( "rapper_lite_coffee" )
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
@@ -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}.#{type}" )
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rapper_lite"
8
- s.version = "0.1.4"
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.css",
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"])
@@ -0,0 +1,3 @@
1
+ *
2
+ margin: 0px 0px 0px 0px
3
+ color: #ffffff
@@ -1 +1 @@
1
- body{margin:0;color:#333}*{margin:0;color:#fff}
1
+ body{margin:0;color:#333}*{margin:0;color:white}
@@ -1 +1 @@
1
- body{margin:0;color:#333}*{margin:0;color:#fff}body{margin:0;color:#333}
1
+ body{margin:0;color:#333}*{margin:0;color:white}body{margin:0;color:#333}
@@ -7,12 +7,12 @@
7
7
  - files:
8
8
  - simple_1
9
9
  - simple_2
10
- - version: 683e7ae
10
+ - version: 4f2b49d
11
11
  - base_combined: !omap
12
12
  - files:
13
13
  - +base
14
14
  - simple_1
15
- - version: 0bb9443
15
+ - version: 1fecd63
16
16
  - js: !omap
17
17
  - base: !omap
18
18
  - files:
@@ -4,5 +4,4 @@ body {
4
4
  }
5
5
  * {
6
6
  margin: 0px 0px 0px 0px;
7
- color: #ffffff;
8
- }
7
+ color: white; }
@@ -4,8 +4,7 @@ body {
4
4
  }
5
5
  * {
6
6
  margin: 0px 0px 0px 0px;
7
- color: #ffffff;
8
- }
7
+ color: white; }
9
8
  body {
10
9
  margin: 0px 0px 0px 0px;
11
10
  color: #333333;
@@ -7,12 +7,12 @@
7
7
  - files:
8
8
  - simple_1
9
9
  - simple_2
10
- - version: 683e7ae
10
+ - version: 4f2b49d
11
11
  - base_combined: !omap
12
12
  - files:
13
13
  - +base
14
14
  - simple_1
15
- - version: 0bb9443
15
+ - version: 1fecd63
16
16
  - js: !omap
17
17
  - base: !omap
18
18
  - files:
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.4
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: &70281444735360 !ruby/object:Gem::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: *70281444735360
24
+ version_requirements: *70353465397060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fssm
27
- requirement: &70281444732040 !ruby/object:Gem::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: *70281444732040
35
+ version_requirements: *70353465395900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rb-fsevent
38
- requirement: &70281444731200 !ruby/object:Gem::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: *70281444731200
46
+ version_requirements: *70353465394400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: coffee-script
49
- requirement: &70281444730640 !ruby/object:Gem::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: *70281444730640
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: &70281444730080 !ruby/object:Gem::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: *70281444730080
79
+ version_requirements: *70353465390060
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: rspec
71
- requirement: &70281444729540 !ruby/object:Gem::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: *70281444729540
90
+ version_requirements: *70353465389360
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: yard
82
- requirement: &70281444728740 !ruby/object:Gem::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: *70281444728740
101
+ version_requirements: *70353465388680
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: rdiscount
93
- requirement: &70281444728060 !ruby/object:Gem::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: *70281444728060
112
+ version_requirements: *70353465388060
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: jeweler
104
- requirement: &70281444727380 !ruby/object:Gem::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: *70281444727380
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.css
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: -1529530463017386165
239
+ hash: -179179325362599579
229
240
  required_rubygems_version: !ruby/object:Gem::Requirement
230
241
  none: false
231
242
  requirements:
@@ -1,4 +0,0 @@
1
- * {
2
- margin: 0px 0px 0px 0px;
3
- color: #ffffff;
4
- }