gumdrop 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.7.2
2
+ - Now supports :packr as a type of compression for stitch/sprockets (be sure it's in your Gemfile)
3
+ - Cleaned up generator internals
4
+
1
5
  # v0.7.1
2
6
  - Ignore/skip (greylist/blacklist) will now include/skip generated content too.
3
7
  - Quiet mode will actually be quiet.
data/License CHANGED
@@ -7,12 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
7
  copies of the Software, and to permit persons to whom the Software is
8
8
  furnished to do so, subject to the following conditions:
9
9
 
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
12
 
13
13
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
14
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
15
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
16
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -88,90 +88,70 @@ module Gumdrop
88
88
  env = Sprockets::Environment.new @site.root_path
89
89
  env.append_path @site.src_path
90
90
  opts[:paths].each do |path|
91
- # path = File.expand_path path
92
- # puts ">>>> adding path #{path}"
93
91
  env.append_path(path)
94
92
  end
95
93
 
96
94
  content= env[ opts[:src] ].to_s
97
- # pp env
98
- # pp opts[:src]
99
- # pp env[ opts[:src] ]
100
- # puts "RENDERED OUTPUT!"
101
- # pp content
102
95
  page name do
103
- case opts[:compress]
104
-
105
- when true, :jsmin
106
- require 'jsmin'
107
- JSMin.minify content
108
-
109
- when :yuic
110
- require "yui/compressor"
111
- compressor = YUI::JavaScriptCompressor.new(:munge => opts[:obfuscate])
112
- compressor.compress(content)
113
-
114
- when :uglify
115
- require "uglifier"
116
- Uglifier.compile( content, :mangle=>opts[:obfuscate])
117
-
118
- when false
119
- content
120
-
121
- else
122
- # UNKNOWN Compressor type!
123
- @site.report "Unknown javascript compressor type! (#{ opts[:compressor] })", :warning
124
- content
125
- end
126
- end
127
-
128
- if opts[:prune] and opts[:root]
129
- sp = File.expand_path( @site.config.source_dir )
130
- rp = File.expand_path(opts[:root])
131
- relative_root = rp.gsub(sp, '')[1..-1]
132
- rrlen= relative_root.length - 1
133
- @site.node_tree.keys.each do |path|
134
- if path[0..rrlen] == relative_root and name != path
135
- @site.node_tree.delete path
136
- end
137
- end
96
+ compress_output(content, opts)
138
97
  end
98
+ keep_src(name, content, opts)
99
+ prune_src(name, opts)
139
100
  end
140
101
 
141
102
  def stitch(name, opts)
142
103
  require 'gumdrop/stitch_support'
143
104
  content= Stitch::Package.new(opts).compile
144
105
  page name do
145
- case opts[:compress]
106
+ compress_output(content, opts)
107
+ end
108
+ keep_src(name, content, opts)
109
+ prune_src(name, opts)
110
+ end
111
+
112
+
113
+ private
114
+
115
+ def compress_output(content, opts)
116
+ case opts[:compress]
146
117
 
147
- when true, :jsmin
148
- require 'jsmin'
149
- JSMin.minify content
118
+ when true, :jsmin
119
+ require 'jsmin'
120
+ JSMin.minify content
150
121
 
151
- when :yuic
152
- require "yui/compressor"
153
- compressor = YUI::JavaScriptCompressor.new(:munge => opts[:obfuscate])
154
- compressor.compress(content)
122
+ when :yuic
123
+ require "yui/compressor"
124
+ compressor = YUI::JavaScriptCompressor.new(:munge => opts[:obfuscate])
125
+ compressor.compress(content)
155
126
 
156
- when :uglify
157
- require "uglifier"
158
- Uglifier.compile( content, :mangle=>opts[:obfuscate])
127
+ when :uglify
128
+ require "uglifier"
129
+ Uglifier.compile( content, :mangle=>opts[:obfuscate])
159
130
 
160
- when false
161
- content
131
+ when :packr
132
+ require 'packr'
133
+ Packr.pack(content, :shrink_vars => true, :base62 => false, :private=>false)
162
134
 
163
- else
164
- # UNKNOWN Compressor type!
165
- @site.report "Unknown javascript compressor type! (#{ opts[:compressor] })", :warning
166
- content
167
- end
135
+ when false
136
+ content
137
+
138
+ else
139
+ # UNKNOWN Compressor type!
140
+ @site.report "Unknown javascript compressor type! (#{ opts[:compressor] })", :warning
141
+ content
168
142
  end
143
+ end
144
+
145
+ def keep_src(name, content, opts)
169
146
  if opts[:keep_src] or opts[:keep_source]
170
147
  ext= File.extname name
171
148
  page name.gsub(ext, "#{opts.fetch(:source_postfix, '-src')}#{ext}") do
172
149
  content
173
150
  end
174
151
  end
152
+ end
153
+
154
+ def prune_src(name, opts)
175
155
  if opts[:prune] and opts[:root]
176
156
  sp = File.expand_path( @site.config.source_dir )
177
157
  rp = File.expand_path(opts[:root])
data/lib/gumdrop/site.rb CHANGED
@@ -209,7 +209,7 @@ module Gumdrop
209
209
  node= Content.new(path, self)
210
210
  path= node.to_s
211
211
  if blacklist.any? {|pattern| path_match path, pattern }
212
- report "-excluding: #{path}", :info
212
+ report " excluding: #{path}", :info
213
213
  else
214
214
  node.ignored= greylist.any? {|pattern| path_match path, pattern }
215
215
  # Sort out Layouts, Generators, and Partials
@@ -1,5 +1,5 @@
1
1
  module Gumdrop
2
2
 
3
- VERSION = "0.7.1" unless defined?(::Gumdrop::VERSION)
3
+ VERSION = "0.7.2" unless defined?(::Gumdrop::VERSION)
4
4
 
5
5
  end
@@ -19,6 +19,7 @@ gem "coffee-script"
19
19
  # For JavaScript stitching and compressing:
20
20
  #gem 'uglifier'
21
21
  #gem 'yui-compressor'
22
+ #gem 'packr'
22
23
  gem 'jsmin'
23
24
  gem 'stitch-rb'
24
25
  #gem 'sprockets'
@@ -19,6 +19,7 @@ gem "coffee-script"
19
19
  # For JavaScript stitching and compressing:
20
20
  #gem 'uglifier'
21
21
  #gem 'yui-compressor'
22
+ #gem 'packr'
22
23
  gem 'jsmin'
23
24
  gem 'stitch-rb'
24
25
  #gem 'sprockets'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 1
9
- version: 0.7.1
8
+ - 2
9
+ version: 0.7.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt McCray