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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e1b5d933905a18bf4497561a5c88afe6da8c6bd
4
- data.tar.gz: d413dd12ee0d7bc488f9aca40f95c61ba5f3cf1b
3
+ metadata.gz: 0abb771c83e424ef8b45f044e15d1a158aa36637
4
+ data.tar.gz: 418b006ba4a64f64a7928ba8ef2b06e752284c3f
5
5
  SHA512:
6
- metadata.gz: 29208b7826fb1895b399d3fd20805c63daa9f0fbd82c65a8aaffa6a46691a3a4ee11898a102c5143b8c4522a436d198398ffd793cc0bdce378dd32682b8e043c
7
- data.tar.gz: c323befe94bf7c8e1360603adc8d5ec1a48b66e57bc8a41f595db802870f49eb8316d41d77e1c3b642e8ead4aab983d0acae230f807fb28998b1a5c8488a6849
6
+ metadata.gz: 03d44021f69846911011df9b30a78d78e75ad74af16db991b2086d647c4d8d02867fee7f087c47dda42870103cd377febc73fe7fc8a9e4ffd9f2ed7ee90f806c
7
+ data.tar.gz: 3935759c7d23c873ae0ba30cdc5c56a6895c72a47817cf5161512f2640261ff9682823cf02b006640db51a47029beb07aeb04a1dbb83e81828d8c0404d4800dc
@@ -1,4 +1,9 @@
1
+ # v0.0.20
2
+
3
+ * Fixes issue with unknown types raising exceptions -- csaunders
4
+
1
5
  # v0.0.19
6
+
2
7
  * Fixes issue with incorrectly detecting binary assets -- csaunders
3
8
  * Properly handle unknown event types --
4
9
 
@@ -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
- !MimeMagic.by_path(path).text?
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
@@ -1,3 +1,3 @@
1
1
  module ShopifyTheme
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
@@ -1,3 +1,4 @@
1
+ ENV['TEST'] = 'true'
1
2
  require 'minitest/autorun'
2
3
  require 'pry'
3
4
  require 'pry-debugger'
@@ -63,8 +63,14 @@ module ShopifyTheme
63
63
  end
64
64
 
65
65
  it "should report binary files as such" do
66
- assert @cli.binary_file?('hello.pdf'), "PDFs are binary files"
67
- assert @cli.binary_file?('hello.png'), "PNGs are binary files"
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.19
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-03 00:00:00.000000000 Z
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor