linner 0.6.7 → 0.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b770edd6563495529705c3c1a51f41f6dad5c431
4
- data.tar.gz: 48902da4077a1a0cf2f1573c57422bd5b0e25b08
3
+ metadata.gz: 43cb77203c178db5c3249c4ce36d95d58f12b5e8
4
+ data.tar.gz: bf3d1893c49c31ba54d0970e1361363bab7ec998
5
5
  SHA512:
6
- metadata.gz: 6bcbf588cd150bf62b071daa8926b2df9da683dd708ecb6b5607e69ca5d31ec7e9286824b8f41b22951e369811ed54c00674271806f95b11ed2d36537d8559c1
7
- data.tar.gz: 214244e4cdbe6fa91f0c1496550972a2dcd521f44b89aa92f1ac7b35ed09d344a8421ac32aaa3f00fd310c86979c7dc6474fc12f0da22f7146f225b067b5a42a
6
+ metadata.gz: 4cecbc782ce184650bbf7fbf4ebacd40fc71a0a5fdd130eb9db8bcf05fe62760a3775abf7401366a270355acefac31f72739e4960583721cc3044502815f1196
7
+ data.tar.gz: 1ee56de1b603b060157dc6a2c9053422634dd85ba50a2ac82b5a8dbd939baa928ad44157d07823bada8e10a15c96a515597b9e3d840a1cd784e75ccb2a77cf2f
data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ v0.7.0
2
+ - lock the sass version to 3.2.19, cause compass not works perfectly with it
3
+ - remove Hpricot, use plain regex to support revision
4
+ - `revision` now is a hash, support `prefix`, move the `manifest` into `revision`, revision now has a `files` key
5
+
6
+ v0.6.7
7
+ - bypass a windows platform expand_path bug in ruby v2.0.0
8
+
9
+ v0.6.6
10
+ - lock the gem http to v0.5.0 and reel to 0.4.0
11
+
1
12
  v0.6.5
2
13
  - upgrade uglifier to 2.5.0 cause uglifier 2.2.0 has IE 8 compatibility issues
3
14
  - upgrade handlebars.rb to 0.1.2 cause handlebars version updated to 1.3.0
data/README.md CHANGED
@@ -4,11 +4,11 @@
4
4
 
5
5
  Linner is a full-featured HTML5 application assembler.
6
6
 
7
- ![Linner](http://d.pr/i/bWPA+)
7
+ ![Linner](http://cl.ly/image/2J0d1C0D3S0E/logo.png)
8
8
 
9
9
  #### Screencast
10
10
 
11
- [![Screencast](http://d.pr/i/MIyk+)](https://vimeo.com/71944672)
11
+ [![Screencast](http://cl.ly/image/000k0R400F30/Image%202014-04-29%20at%2010.20.12%20AM.png)](https://vimeo.com/71944672)
12
12
 
13
13
  * Fast!
14
14
  * Supports `Sass`, `Compass` and `Coffee`.
@@ -34,7 +34,9 @@ Linner is a full-featured HTML5 application assembler.
34
34
 
35
35
  #### Windows
36
36
 
37
- * JRuby 1.7.4 with 2.0 mode (`set JRUBY_OPTS=--2.0`)
37
+ * Install [Ruby](http://rubyinstaller.org/downloads/) and [DevKit](http://rubyinstaller.org/downloads/)
38
+ * Install gem `wdm`
39
+ * Install Node.js to make Linner faster
38
40
 
39
41
  ## Installation
40
42
 
data/bin/linner CHANGED
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Trap interrupts to quit cleanly. See
4
+ # https://twitter.com/mitchellh/status/283014103189053442
5
+ Signal.trap("INT") { abort }
6
+
3
7
  require File.dirname(__FILE__) + "/../lib/linner"
4
8
  Linner::Command.start
data/docs/config.md CHANGED
@@ -78,8 +78,6 @@ sprites:
78
78
  path: "/images/"
79
79
  # css selector
80
80
  selector: ".icon-"
81
- # css url background: url(/images/icon.png)
82
- url: "http://s3.amazonaws.com/"
83
81
  ```
84
82
 
85
83
  ## `modules`
@@ -106,10 +104,20 @@ The definition file will prepend to `definition` field, which will join with `pu
106
104
  Default:
107
105
 
108
106
  ```yaml
109
- revision: "index.html"
107
+ revision:
108
+ prefix: ""
109
+ manifest: "manifest.yml"
110
+ files:
111
+ - "index.html"
110
112
  ```
111
113
 
112
- `index.html` will join with `public` folder. So, by default when you `build` your application, the `public/index.html` file will be rewrited with revision.
114
+ the `prefix` will join with revision hashes, It's useful for CDN support.
115
+
116
+ the `manifest` will join with `public` folder, write a manifest file with the name.
117
+
118
+ `index.html` will join with `public` folder. So, by default when you `build` your application, the `public/index.html` file will be rewrote with revision.
119
+
120
+
113
121
 
114
122
  If you don't need `revision` support, it can be `false`.
115
123
 
@@ -22,9 +22,9 @@ module Linner
22
22
  end
23
23
 
24
24
  def check
25
- return [false, "Bundles didn't exsit!"] unless File.exists? REPOSITORY
25
+ return [false, "Bundles didn't exsit!"] unless File.exist? REPOSITORY
26
26
  @bundles.each do |bundle|
27
- unless File.exists?(bundle.path) and File.exists?(File.join(VENDOR, bundle.name))
27
+ unless File.exist?(bundle.path) and File.exist?(File.join(VENDOR, bundle.name))
28
28
  return [false, "Bundle #{bundle.name} v#{bundle.version} didn't match!"]
29
29
  end
30
30
  end
@@ -32,12 +32,12 @@ module Linner
32
32
  end
33
33
 
34
34
  def install
35
- unless File.exists? REPOSITORY
35
+ unless File.exist? REPOSITORY
36
36
  FileUtils.mkdir_p(REPOSITORY)
37
37
  end
38
38
  @bundles.each do |bundle|
39
39
  if bundle.version != "master"
40
- next if File.exists?(bundle.path) and File.exists?(File.join(VENDOR, bundle.name))
40
+ next if File.exist?(bundle.path) and File.exist?(File.join(VENDOR, bundle.name))
41
41
  end
42
42
  puts "Installing #{bundle.name} #{bundle.version}..."
43
43
  install_to_repository bundle.url, bundle.path
@@ -37,15 +37,14 @@ module Linner
37
37
  def build
38
38
  Linner.compile = true
39
39
  clean
40
- Linner::Bundler.new(env.bundles).perform
40
+ Bundler.new(env.bundles).perform
41
41
  perform
42
42
  end
43
43
 
44
44
  desc "watch", "watch assets"
45
45
  def watch
46
- trap(:INT) { exit! }
47
46
  clean
48
- Linner::Bundler.new(env.bundles).perform
47
+ Bundler.new(env.bundles).perform
49
48
  perform
50
49
  watch_for_env
51
50
  watch_for_perform
@@ -96,7 +95,7 @@ module Linner
96
95
  def watch_for_env
97
96
  Listen.to Linner.root, filter: /(config\.yml|Linnerfile)$/ do |modified, added, removed|
98
97
  Linner.env = Environment.new Linner.config_file
99
- Linner::Bundler.new(env.bundles).perform
98
+ Bundler.new(env.bundles).perform
100
99
  end
101
100
  end
102
101
 
@@ -106,4 +105,3 @@ module Linner
106
105
  end
107
106
  end
108
107
  end
109
-
@@ -20,16 +20,20 @@ module Linner
20
20
 
21
21
  def watched_paths
22
22
  [app_folder, vendor_folder, test_folder].select do |path|
23
- File.exists? path
23
+ File.exist? path
24
24
  end
25
25
  end
26
26
 
27
- %w(revision notification manifest).each do |method|
27
+ %w(revision notification).each do |method|
28
28
  define_method("#{method}") do
29
29
  @env[method]
30
30
  end
31
31
  end
32
32
 
33
+ def manifest
34
+ revision["manifest"]
35
+ end
36
+
33
37
  def bundles
34
38
  @env["bundles"] || []
35
39
  end
data/lib/linner/sprite.rb CHANGED
@@ -51,7 +51,7 @@ module Linner
51
51
  "#{selector}#{selector_with_pseudo_class} {
52
52
  width: #{image.width}px;
53
53
  height: #{image.height}px;
54
- background: url(#{File.join config['url'], name}) -#{image.left}px -#{image.top}px no-repeat;
54
+ background: url(#{File.join config['path'], name}) -#{image.left}px -#{image.top}px no-repeat;
55
55
  }
56
56
  "
57
57
  end
@@ -36,10 +36,11 @@ modules:
36
36
  ignored: vendor/**/*
37
37
  definition: /scripts/app.js
38
38
  sprites:
39
- url: /images/
40
39
  path: /images/
41
40
  selector: .icon-
42
- revision: index.html
41
+ revision:
42
+ files:
43
+ - index.html
43
44
  notification: true
44
45
  bundles:
45
46
  jquery.js:
@@ -48,4 +49,3 @@ bundles:
48
49
  handlebars.js:
49
50
  version: 1.0.0
50
51
  url: https://raw.github.com/wycats/handlebars.js/1.0.0/dist/handlebars.runtime.js
51
-
@@ -1,3 +1,3 @@
1
1
  module Linner
2
- VERSION = "0.6.7"
2
+ VERSION = "0.7.0"
3
3
  end
data/lib/linner.rb CHANGED
@@ -1,5 +1,3 @@
1
- require "hpricot"
2
-
3
1
  require "linner/version"
4
2
  require "linner/command"
5
3
  require "linner/asset"
@@ -64,13 +62,13 @@ module Linner
64
62
  name = File.basename(dest).sub /[^.]+\z/, "png"
65
63
  dest = File.join env.sprites["path"], name
66
64
  asset = Asset.new(File.join env.public_folder, dest)
67
- hash[dest] = asset.relative_digest_path
65
+ hash[dest] = env.revision["prefix"] + asset.relative_digest_path
68
66
  asset.revision!
69
67
 
70
68
  (concat_assets + copy_assets).flatten.each do |file|
71
69
  path = File.join env.public_folder, file
72
70
  next unless Asset.new(path).stylesheet?
73
- puts = File.read(path).gsub(File.join(env.sprites["url"], File.basename(dest)), File.join(env.sprites["url"], File.basename(asset.relative_digest_path)))
71
+ puts = File.read(path).gsub(File.join(env.sprites["path"], File.basename(dest)), File.join(env.revision["prefix"], env.sprites["path"], File.basename(asset.relative_digest_path)))
74
72
  File.open(path, "w") { |file| file << puts }
75
73
  end
76
74
  end
@@ -79,7 +77,7 @@ module Linner
79
77
  (concat_assets + template_assets + copy_assets).flatten.each do |dest|
80
78
  asset = Asset.new(File.join env.public_folder, dest)
81
79
  next unless asset.revable?
82
- hash[dest] = asset.relative_digest_path
80
+ hash[dest] = env.revision["prefix"] + asset.relative_digest_path
83
81
  asset.revision!
84
82
  end
85
83
 
@@ -110,7 +108,7 @@ module Linner
110
108
  copy(config) if config["copy"]
111
109
  concat(config) if config["concat"]
112
110
  end
113
- revision if compile? and env.revision
111
+ revision if compile? and env.revision and env.revision["files"]
114
112
  end
115
113
 
116
114
  private
@@ -162,7 +160,7 @@ module Linner
162
160
 
163
161
  def revision
164
162
  dump_manifest
165
- [env.revision].flatten.each do |rev|
163
+ env.revision["files"].flatten.each do |rev|
166
164
  file = File.join env.public_folder, rev.to_s
167
165
  next if not File.exist?(file)
168
166
  replace_attributes file
@@ -207,21 +205,20 @@ module Linner
207
205
  end
208
206
 
209
207
  def replace_attributes file
210
- doc = Hpricot(File.read file)
211
- replace_tag_with_manifest_value doc, "script", "src"
212
- replace_tag_with_manifest_value doc, "link", "href"
213
- File.open(file, "w") {|f| f.write doc.to_html}
214
- end
208
+ doc = File.read file
209
+ doc.gsub!(/(<script.+src=['"])([^"']+)(["'])/) do |m|
210
+ if p = manifest[$2] then $1 << p << $3 else m end
211
+ end
215
212
 
216
- def replace_tag_with_manifest_value doc, tag, attribute
217
- doc.search("//#{tag}").each do |tag|
218
- value = tag.attributes[attribute]
219
- tag.attributes[attribute] = manifest[value] if value and manifest[value]
213
+ doc.gsub!(/(<link[^\>]+href=['"])([^"']+)(["'])/) do |m|
214
+ if p = manifest[$2] then $1 << p << $3 else m end
220
215
  end
216
+
217
+ File.open(file, "w") {|f| f.write doc}
221
218
  end
222
219
 
223
220
  def dump_manifest
224
- File.open(File.join(env.public_folder, env.manifest), "w") do |f|
221
+ File.open(File.join(env.public_folder, env.revision["manifest"]), "w") do |f|
225
222
  YAML.dump(manifest, f)
226
223
  end
227
224
  end
data/linner.gemspec CHANGED
@@ -22,10 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency "http", "~> 0.5.0"
23
23
  spec.add_dependency "thor", "~> 0.18"
24
24
  spec.add_dependency "tilt", "~> 1.4"
25
- spec.add_dependency "sass", "~> 3.2"
25
+ spec.add_dependency "sass", "~> 3.2.19"
26
26
  spec.add_dependency "listen", "~> 1.3"
27
27
  spec.add_dependency "uglifier", "~> 2.5.0"
28
- spec.add_dependency "hpricot", "~> 0.8.6"
29
28
  spec.add_dependency "compass", "~> 0.12.2"
30
29
  spec.add_dependency "cssminify", "~> 1.0.2"
31
30
  spec.add_dependency "coffee-script", "~> 2.2"
@@ -17,8 +17,9 @@ describe Environment do
17
17
  it "should equals default config" do
18
18
  @env.notification.should be_true
19
19
  @env.wrapper.should == "cmd"
20
- @env.manifest.should == "manifest.yml"
21
- @env.revision.should == false
20
+ @env.revision["prefix"].should == ""
21
+ @env.revision["manifest"].should == "manifest.yml"
22
+ @env.revision["files"].should == nil
22
23
  @env.groups.should respond_to(:each)
23
24
  end
24
25
  end
@@ -26,6 +26,8 @@ modules:
26
26
  ignored: "vendor/**/*"
27
27
  definition: "/scripts/app.js"
28
28
 
29
- manifest: "manifest.yml"
30
- revision: false
29
+ revision:
30
+ prefix: ""
31
+ manifest: "manifest.yml"
32
+
31
33
  notification: true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-28 00:00:00.000000000 Z
11
+ date: 2014-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reel
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.2'
75
+ version: 3.2.19
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.2'
82
+ version: 3.2.19
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: listen
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.5.0
111
- - !ruby/object:Gem::Dependency
112
- name: hpricot
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.8.6
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.8.6
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: compass
127
113
  requirement: !ruby/object:Gem::Requirement