gumdrop 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog.md +4 -0
- data/License +4 -3
- data/lib/gumdrop/generator.rb +40 -60
- data/lib/gumdrop/site.rb +1 -1
- data/lib/gumdrop/version.rb +1 -1
- data/templates/backbone/Gemfile +1 -0
- data/templates/default/Gemfile +1 -0
- metadata +2 -2
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
|
-
|
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.
|
data/lib/gumdrop/generator.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
148
|
-
|
149
|
-
|
118
|
+
when true, :jsmin
|
119
|
+
require 'jsmin'
|
120
|
+
JSMin.minify content
|
150
121
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
122
|
+
when :yuic
|
123
|
+
require "yui/compressor"
|
124
|
+
compressor = YUI::JavaScriptCompressor.new(:munge => opts[:obfuscate])
|
125
|
+
compressor.compress(content)
|
155
126
|
|
156
|
-
|
157
|
-
|
158
|
-
|
127
|
+
when :uglify
|
128
|
+
require "uglifier"
|
129
|
+
Uglifier.compile( content, :mangle=>opts[:obfuscate])
|
159
130
|
|
160
|
-
|
161
|
-
|
131
|
+
when :packr
|
132
|
+
require 'packr'
|
133
|
+
Packr.pack(content, :shrink_vars => true, :base62 => false, :private=>false)
|
162
134
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
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 "
|
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
|
data/lib/gumdrop/version.rb
CHANGED
data/templates/backbone/Gemfile
CHANGED
data/templates/default/Gemfile
CHANGED