linner 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/lib/linner.rb +2 -1
- data/lib/linner/bundler.rb +20 -15
- data/lib/linner/command.rb +5 -5
- data/lib/linner/sprite.rb +2 -1
- data/lib/linner/templates/config.yml +1 -1
- data/lib/linner/version.rb +1 -1
- data/spec/linner/bundler_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d4b9dcd8883940be8091b2e79983293de357e8c
|
4
|
+
data.tar.gz: aaf4b84e513d058360dcc93b56e21e0212d60c8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f2364faae6de07606f8afec744c962c689a9fc4588f5451c279b96d40039a6f2195802d37f62ce8e7e1701234fab3da295adf66d64ffd5962a70351454a2fc5
|
7
|
+
data.tar.gz: ed780f4bfe2b73195e2365dd2e337f60f69c537482241c06aad1051ef5a0c7d1dee5a374202d1cc0af900cfb942c24d478e966e2af5b1e6400e6e81190299752
|
data/CHANGELOG
CHANGED
data/lib/linner.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/linner/bundler.rb
CHANGED
@@ -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(
|
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(
|
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(
|
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
|
43
|
+
install_to_repository bundle
|
44
44
|
if gzipped?(bundle.path)
|
45
|
-
link_and_extract_to_vendor bundle.path, File.join(
|
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(
|
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(
|
58
|
-
FileUtils.mkdir_p File.dirname(path)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
|
data/lib/linner/command.rb
CHANGED
@@ -17,14 +17,14 @@ module Linner
|
|
17
17
|
|
18
18
|
desc "check", "check dependencies"
|
19
19
|
def check
|
20
|
-
message = Linner::Bundler.new(env
|
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
|
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
|
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
|
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
|
104
|
+
Bundler.new(env).perform
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
data/lib/linner/sprite.rb
CHANGED
@@ -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
|
57
|
+
background: url(#{File.join url, name}) -#{image.left}px -#{image.top}px no-repeat;
|
57
58
|
}
|
58
59
|
"
|
59
60
|
end
|
data/lib/linner/version.rb
CHANGED
data/spec/linner/bundler_spec.rb
CHANGED
@@ -2,8 +2,8 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Bundler do
|
4
4
|
before(:each) do
|
5
|
-
|
6
|
-
@bundler = Linner::Bundler.new(
|
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.
|
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-
|
11
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|