shopify_theme 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/shopify_theme/cli.rb +18 -3
- data/lib/shopify_theme/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/cli_spec.rb +10 -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: 0abb771c83e424ef8b45f044e15d1a158aa36637
|
4
|
+
data.tar.gz: 418b006ba4a64f64a7928ba8ef2b06e752284c3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03d44021f69846911011df9b30a78d78e75ad74af16db991b2086d647c4d8d02867fee7f087c47dda42870103cd377febc73fe7fc8a9e4ffd9f2ed7ee90f806c
|
7
|
+
data.tar.gz: 3935759c7d23c873ae0ba30cdc5c56a6895c72a47817cf5161512f2640261ff9682823cf02b006640db51a47029beb07aeb04a1dbb83e81828d8c0404d4800dc
|
data/CHANGELOG.md
CHANGED
data/lib/shopify_theme/cli.rb
CHANGED
@@ -9,9 +9,21 @@ require 'filewatcher'
|
|
9
9
|
require 'launchy'
|
10
10
|
require 'mimemagic'
|
11
11
|
|
12
|
-
MimeMagic.add('application/x-liquid', extensions: %w(liquid), parents: 'text/plain')
|
13
|
-
|
14
12
|
module ShopifyTheme
|
13
|
+
EXTENSIONS = [
|
14
|
+
{mimetype: 'application/x-liquid', extensions: %w(liquid), parents: 'text/plain'},
|
15
|
+
{mimetype: 'application/json', extensions: %w(json), parents: 'text/plain'},
|
16
|
+
{mimetype: 'application/js', extensions: %w(map), parents: 'text/plain'},
|
17
|
+
{mimetype: 'application/vnd.ms-fontobject', extensions: %w(eot)},
|
18
|
+
{mimetype: 'image/svg+xml', extensions: %w(svg svgz)}
|
19
|
+
]
|
20
|
+
|
21
|
+
def self.configureMimeMagic
|
22
|
+
ShopifyTheme::EXTENSIONS.each do |extension|
|
23
|
+
MimeMagic.add(extension.delete(:mimetype), extension)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
15
27
|
class Cli < Thor
|
16
28
|
include Thor::Actions
|
17
29
|
|
@@ -250,7 +262,9 @@ module ShopifyTheme
|
|
250
262
|
end
|
251
263
|
|
252
264
|
def binary_file?(path)
|
253
|
-
|
265
|
+
mime = MimeMagic.by_path(path)
|
266
|
+
say("'#{path}' is an unknown file-type, uploading asset as binary", :yellow) if mime.nil? && ENV['TEST'] != 'true'
|
267
|
+
mime.nil? || !mime.text?
|
254
268
|
end
|
255
269
|
|
256
270
|
def report_error(time, message, response)
|
@@ -287,3 +301,4 @@ module ShopifyTheme
|
|
287
301
|
end
|
288
302
|
end
|
289
303
|
end
|
304
|
+
ShopifyTheme.configureMimeMagic
|
data/spec/spec_helper.rb
CHANGED
data/spec/unit/cli_spec.rb
CHANGED
@@ -63,8 +63,14 @@ module ShopifyTheme
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should report binary files as such" do
|
66
|
-
|
67
|
-
|
66
|
+
extensions = %w(png gif jpg jpeg eot svg ttf woff otf swf ico pdf)
|
67
|
+
extensions.each do |ext|
|
68
|
+
assert @cli.binary_file?("hello.#{ext}"), "#{ext.upcase}s are binary files"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should report unknown files as binary files" do
|
73
|
+
assert @cli.binary_file?('omg.wut'), "Unknown filetypes are assumed to be binary"
|
68
74
|
end
|
69
75
|
|
70
76
|
it "should not report text based files as binary" do
|
@@ -72,6 +78,8 @@ module ShopifyTheme
|
|
72
78
|
refute @cli.binary_file?('style.sass.liquid'), "sass.liquid files are not binary"
|
73
79
|
refute @cli.binary_file?('style.css'), 'CSS files are not binary'
|
74
80
|
refute @cli.binary_file?('application.js'), 'Javascript files are not binary'
|
81
|
+
refute @cli.binary_file?('settings_data.json'), 'JSON files are not binary'
|
82
|
+
refute @cli.binary_file?('applicaton.js.map'), 'Javascript Map files are not binary'
|
75
83
|
end
|
76
84
|
end
|
77
85
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Duff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|