linner 0.8.3 → 0.8.4

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: 5da7940f6afc37793df10b89c7de5319df22ef4a
4
- data.tar.gz: 78d598e3d444373fa669ffa9a8efba2ff2a209c6
3
+ metadata.gz: 3d4b9dcd8883940be8091b2e79983293de357e8c
4
+ data.tar.gz: aaf4b84e513d058360dcc93b56e21e0212d60c8b
5
5
  SHA512:
6
- metadata.gz: 0160dbd09246a9de42b3b5dd820b69d33e7c2fbac64be4b367fd269d848e4355a95bfdc411a0b55835a11c0524398350f145760120a0ef6dcab5260d385ca7cc
7
- data.tar.gz: 25820424614789c286d2c20f7bcdd03dfd23e2d74b59f10d2f2115d77f388c7ed7011d142e1640c1243f4a43df1e1a34482abaaf4dec4fb8c104a4e3421763b1
6
+ metadata.gz: 5f2364faae6de07606f8afec744c962c689a9fc4588f5451c279b96d40039a6f2195802d37f62ce8e7e1701234fab3da295adf66d64ffd5962a70351454a2fc5
7
+ data.tar.gz: ed780f4bfe2b73195e2365dd2e337f60f69c537482241c06aad1051ef5a0c7d1dee5a374202d1cc0af900cfb942c24d478e966e2af5b1e6400e6e81190299752
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.8.4
2
+ - fix the vendor path for bundles
3
+ - fix the sprite url config, now it's working again
4
+
1
5
  v0.8.3
2
6
  - fix a windows md5sum bug cause it calculate in text mode by default
3
7
 
@@ -67,7 +67,8 @@ module Linner
67
67
  (concat_assets + copy_assets).flatten.each do |file|
68
68
  path = File.join env.public_folder, file
69
69
  next unless Asset.new(path).stylesheet?
70
- puts = File.read(path).gsub(File.join(env.sprites["path"], File.basename(dest)), File.join(prefix, env.sprites["path"], File.basename(asset.relative_digest_path)))
70
+ url = env.sprites["url"] || env.sprites["path"]
71
+ puts = File.read(path).gsub(File.join(url, File.basename(dest)), File.join(prefix, url, File.basename(asset.relative_digest_path)))
71
72
  File.open(path, "w") { |file| file << puts }
72
73
  end
73
74
  end
@@ -5,7 +5,6 @@ require "open-uri"
5
5
 
6
6
  module Linner
7
7
  class Bundler
8
- VENDOR = Pathname(".").join "vendor"
9
8
  REPOSITORY = File.expand_path "~/.linner/bundles"
10
9
 
11
10
  Bundle = Struct.new(:name, :version, :url) do
@@ -14,17 +13,18 @@ module Linner
14
13
  end
15
14
  end
16
15
 
17
- def initialize(bundles)
16
+ def initialize(env)
18
17
  @bundles = []
19
- bundles.each do |name, props|
18
+ env.bundles.each do |name, props|
20
19
  @bundles << Bundle.new(name, props["version"], props["url"])
21
20
  end
21
+ @vendor = Pathname(".").join env.vendor_folder
22
22
  end
23
23
 
24
24
  def check
25
25
  return [false, "Bundles didn't exsit!"] unless File.exist? REPOSITORY
26
26
  @bundles.each do |bundle|
27
- unless File.exist?(bundle.path) and File.exist?(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
@@ -37,14 +37,14 @@ module Linner
37
37
  end
38
38
  @bundles.each do |bundle|
39
39
  if bundle.version != "master"
40
- next if File.exist?(bundle.path) and File.exist?(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
- install_to_repository bundle.url, bundle.path
43
+ install_to_repository bundle
44
44
  if gzipped?(bundle.path)
45
- link_and_extract_to_vendor bundle.path, File.join(VENDOR, ".pkg", bundle.name, File.basename(bundle.path)), File.join(VENDOR, bundle.name)
45
+ link_and_extract_to_vendor bundle.path, File.join(@vendor, ".pkg", bundle.name, File.basename(bundle.path)), File.join(@vendor, bundle.name)
46
46
  else
47
- link_to_vendor bundle.path, File.join(VENDOR, bundle.name)
47
+ link_to_vendor bundle.path, File.join(@vendor, bundle.name)
48
48
  end
49
49
  end
50
50
  end
@@ -54,14 +54,19 @@ module Linner
54
54
  end
55
55
 
56
56
  private
57
- def install_to_repository(url, path)
58
- FileUtils.mkdir_p File.dirname(path)
59
- File.open(path, "w") do |dest|
60
- if url =~ URI::regexp
61
- open(url, "r:UTF-8") {|file| dest.write file.read}
62
- else
63
- dest.write(File.read Pathname(url).expand_path)
57
+ def install_to_repository(bundle)
58
+ FileUtils.mkdir_p File.dirname(bundle.path)
59
+ begin
60
+ File.open(bundle.path, "w") do |dest|
61
+ if bundle.url =~ URI::regexp
62
+ open(bundle.url, "r:UTF-8") {|file| dest.write file.read}
63
+ else
64
+ dest.write(File.read Pathname(bundle.url).expand_path)
65
+ end
64
66
  end
67
+ rescue
68
+ Notifier.error("Can't fetch bundle #{bundle.name} from #{bundle.url}")
69
+ Kernel::exit
65
70
  end
66
71
  end
67
72
 
@@ -17,14 +17,14 @@ module Linner
17
17
 
18
18
  desc "check", "check dependencies"
19
19
  def check
20
- message = Linner::Bundler.new(env.bundles).check
20
+ message = Linner::Bundler.new(env).check
21
21
  puts (message.first ? "🍵 :" : "👻 :") + message.last
22
22
  end
23
23
 
24
24
  desc "install", "install dependencies"
25
25
  def install
26
26
  begin
27
- Linner::Bundler.new(env.bundles).perform
27
+ Linner::Bundler.new(env).perform
28
28
  rescue
29
29
  puts "👻 : Install failed!"
30
30
  puts $!
@@ -43,14 +43,14 @@ module Linner
43
43
  Linner.compile = true
44
44
  Linner.strict = true if options[:strict]
45
45
  clean
46
- Bundler.new(env.bundles).perform
46
+ Bundler.new(env).perform
47
47
  perform
48
48
  end
49
49
 
50
50
  desc "watch", "watch assets"
51
51
  def watch
52
52
  clean
53
- Bundler.new(env.bundles).perform
53
+ Bundler.new(env).perform
54
54
  perform
55
55
  watch_for_env
56
56
  watch_for_perform
@@ -101,7 +101,7 @@ module Linner
101
101
  def watch_for_env
102
102
  Listen.to Linner.root, filter: /(config\.yml|Linnerfile)$/ do |modified, added, removed|
103
103
  Linner.env = Environment.new Linner.config_file
104
- Bundler.new(env.bundles).perform
104
+ Bundler.new(env).perform
105
105
  end
106
106
  end
107
107
 
@@ -42,6 +42,7 @@ module Linner
42
42
 
43
43
  def generate_style(config, name)
44
44
  selector = config["selector"] || ".icon-"
45
+ url = config['url'] || config['path']
45
46
  @images.inject("") do |style, image|
46
47
  logical_path = Asset.new(image.path).logical_path
47
48
  selector_with_pseudo_class = logical_path.chomp(File.extname(logical_path))
@@ -53,7 +54,7 @@ module Linner
53
54
  "#{selector}#{selector_with_pseudo_class} {
54
55
  width: #{image.width}px;
55
56
  height: #{image.height}px;
56
- background: url(#{File.join config['path'], name}) -#{image.left}px -#{image.top}px no-repeat;
57
+ background: url(#{File.join url, name}) -#{image.left}px -#{image.top}px no-repeat;
57
58
  }
58
59
  "
59
60
  end
@@ -8,7 +8,7 @@ groups:
8
8
  "/scripts/app.js": "app/**/*.{js,coffee}"
9
9
  "/scripts/vendor.js": "vendor/**/*.{js,coffee}"
10
10
  order:
11
- - vendor/jquery-1.10.2.js
11
+ - vendor/jquery.js
12
12
  - ...
13
13
  - app/scripts/app.coffee
14
14
  styles:
@@ -1,3 +1,3 @@
1
1
  module Linner
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.4"
3
3
  end
@@ -2,8 +2,8 @@ require "spec_helper"
2
2
 
3
3
  describe Bundler do
4
4
  before(:each) do
5
- bundles = Environment.new(root.join "config.yml").bundles
6
- @bundler = Linner::Bundler.new(bundles)
5
+ env = Environment.new(root.join "config.yml")
6
+ @bundler = Linner::Bundler.new(env)
7
7
  end
8
8
 
9
9
  it "should check failure when REPOSITORY is not exist" do
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.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-07 00:00:00.000000000 Z
11
+ date: 2015-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor