shopify_theme 0.0.18 → 0.0.19

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: 8b849c05437407aeafa434479b6f2f198a3dc475
4
- data.tar.gz: f33e3b4294a93ce747a650c3bc65e67f82bef9d6
3
+ metadata.gz: 9e1b5d933905a18bf4497561a5c88afe6da8c6bd
4
+ data.tar.gz: d413dd12ee0d7bc488f9aca40f95c61ba5f3cf1b
5
5
  SHA512:
6
- metadata.gz: 21aa13d50791237942291edf030d96a624879809e53487b4251c40e1551f5e190b0703b6d2c1f4067e74e89ca94f18bfe876504ae9172e91deba84a2a9c47b95
7
- data.tar.gz: 8e3a476aabbfce33e154c1d42014f54a63a285c027d96cedb04caa84bbe29ac0d3ae1a08714ae81d40d459ac531f2212f3778ffa07df1836ac35aead254958a7
6
+ metadata.gz: 29208b7826fb1895b399d3fd20805c63daa9f0fbd82c65a8aaffa6a46691a3a4ee11898a102c5143b8c4522a436d198398ffd793cc0bdce378dd32682b8e043c
7
+ data.tar.gz: c323befe94bf7c8e1360603adc8d5ec1a48b66e57bc8a41f595db802870f49eb8316d41d77e1c3b642e8ead4aab983d0acae230f807fb28998b1a5c8488a6849
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.0.19
2
+ * Fixes issue with incorrectly detecting binary assets -- csaunders
3
+ * Properly handle unknown event types --
4
+
1
5
  # v0.0.12
2
6
 
3
7
  * Fixes issue where app tried uploading directories
@@ -5,4 +9,4 @@
5
9
  # v0.0.11
6
10
 
7
11
  * Locks JSON api version which fixed an issue with downloading large binary files -- Tyler Ball
8
- * Respect API limits when downloading theme assets from Shopify API -- Chris Saunders
12
+ * Respect API limits when downloading theme assets from Shopify API -- Chris Saunders
data/CONTRIBUTING ADDED
@@ -0,0 +1,6 @@
1
+ - If the issue doesn't exist, open one to start a discussion
2
+ - If the issue is fine (it probably is) start working on your patch
3
+ - Create a Pull Request
4
+ - Be sure to update CHANGELOG.md to include the details of your fix
5
+ - Go through code review
6
+ - Get it merged
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Edit your Shopify theme locally
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/shopify_theme.svg)](http://badge.fury.io/rb/shopify_theme)
4
+
3
5
  The Shopify theme gem is a command line tool that lets you make live changes to themes on your Shopify store. If the command line is scary, check out the [Desktop Theme Editor app](http://apps.shopify.com/desktop-theme-editor).
4
6
 
5
7
  It will watch your local folders for any changes in your theme (including adding and removing files) and will update your .myshopify.com store to the latest changes.
@@ -107,6 +109,15 @@ theme bootstrap api_key password shop_name theme_name master
107
109
 
108
110
  # Common Problems
109
111
 
112
+ ## SSL Certificates won't verify on Windows
113
+
114
+ If you are experiencing SSL validation errors, it is most likely because your installation does not have any valid
115
+ certificates. This can be taken care of by [downloading a certificate file](http://curl.haxx.se/ca/cacert.pem) and
116
+ [setting a the SSL_CERT_PATH environment variable on your system](http://www.computerhope.com/issues/ch000549.htm).
117
+ For more details check out the following [gist](https://gist.github.com/fnichol/867550).
118
+
119
+ [See the following issue for more details](https://github.com/Shopify/shopify_theme/issues/103)
120
+
110
121
  ## How do I edit a theme that isn't my shops main theme?
111
122
 
112
123
  This can be done by setting the `theme_id` field in `config.yml` which was created when you
@@ -7,12 +7,14 @@ require 'fileutils'
7
7
  require 'json'
8
8
  require 'filewatcher'
9
9
  require 'launchy'
10
+ require 'mimemagic'
11
+
12
+ MimeMagic.add('application/x-liquid', extensions: %w(liquid), parents: 'text/plain')
10
13
 
11
14
  module ShopifyTheme
12
15
  class Cli < Thor
13
16
  include Thor::Actions
14
17
 
15
- BINARY_EXTENSIONS = %w(png gif jpg jpeg eot svg ttf woff otf swf ico)
16
18
  IGNORE = %w(config.yml)
17
19
  DEFAULT_WHITELIST = %w(layout/ assets/ config/ snippets/ templates/)
18
20
  TIMEFORMAT = "%H:%M:%S"
@@ -126,13 +128,16 @@ module ShopifyTheme
126
128
  puts "Watching current folder: #{Dir.pwd}"
127
129
  watcher do |filename, event|
128
130
  filename = filename.gsub("#{Dir.pwd}/", '')
129
- action = if local_assets_list.include?(filename) && [:changed, :new].include?(event)
130
- :send_asset
131
- elsif event == :delete
132
- :delete_asset
133
- else
134
- raise NotImplementedError, "Unknown event -- #{event}"
135
- end
131
+
132
+ next unless local_assets_list.include?(filename)
133
+ action = if [:changed, :new].include?(event)
134
+ :send_asset
135
+ elsif event == :delete
136
+ :delete_asset
137
+ else
138
+ raise NotImplementedError, "Unknown event -- #{event} -- #{filename}"
139
+ end
140
+
136
141
  send(action, filename, options['quiet'])
137
142
  end
138
143
  end
@@ -203,7 +208,7 @@ module ShopifyTheme
203
208
  return unless valid?(asset)
204
209
  data = {:key => asset}
205
210
  content = File.read(asset)
206
- if BINARY_EXTENSIONS.include?(File.extname(asset).gsub('.','')) || ShopifyTheme.is_binary_data?(content)
211
+ if binary_file?(asset) || ShopifyTheme.is_binary_data?(content)
207
212
  content = File.open(asset, "rb") { |io| io.read }
208
213
  data.merge!(:attachment => Base64.encode64(content))
209
214
  else
@@ -244,6 +249,10 @@ module ShopifyTheme
244
249
  false
245
250
  end
246
251
 
252
+ def binary_file?(path)
253
+ !MimeMagic.by_path(path).text?
254
+ end
255
+
247
256
  def report_error(time, message, response)
248
257
  say("[#{timestamp(time)}] Error: #{message}", :red)
249
258
  say("Error Details: #{errors_from_response(response)}", :yellow)
@@ -1,3 +1,3 @@
1
1
  module ShopifyTheme
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.add_dependency('thor', '>= 0.14.4')
18
18
  s.add_dependency('httparty', '~> 0.13.0')
19
19
  s.add_dependency('json', '~> 1.8.0')
20
+ s.add_dependency('mimemagic')
20
21
  s.add_dependency('filewatcher')
21
22
  s.add_dependency('launchy')
22
23
 
@@ -18,6 +18,11 @@ module ShopifyTheme
18
18
  super
19
19
  end
20
20
 
21
+ desc "",""
22
+ def binary_file?(file)
23
+ super
24
+ end
25
+
21
26
  desc "", ""
22
27
  def local_files
23
28
  @local_files
@@ -56,5 +61,17 @@ module ShopifyTheme
56
61
  @cli.mock_config = {store: 'somethingfancy.myshopify.com', theme_id: ''}
57
62
  assert_equal "somethingfancy.myshopify.com", @cli.shop_theme_url
58
63
  end
64
+
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"
68
+ end
69
+
70
+ it "should not report text based files as binary" do
71
+ refute @cli.binary_file?('theme.liquid'), "liquid files are not binary"
72
+ refute @cli.binary_file?('style.sass.liquid'), "sass.liquid files are not binary"
73
+ refute @cli.binary_file?('style.css'), 'CSS files are not binary'
74
+ refute @cli.binary_file?('application.js'), 'Javascript files are not binary'
75
+ end
59
76
  end
60
77
  end
metadata CHANGED
@@ -1,161 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Duff
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MQ8wDQYDVQQDDAZhZG1p
14
- bnMxFzAVBgoJkiaJk/IsZAEZFgdzaG9waWZ5MRMwEQYKCZImiZPyLGQBGRYDY29t
15
- MB4XDTE0MDUxNTIwMzM0OFoXDTE1MDUxNTIwMzM0OFowPzEPMA0GA1UEAwwGYWRt
16
- aW5zMRcwFQYKCZImiZPyLGQBGRYHc2hvcGlmeTETMBEGCgmSJomT8ixkARkWA2Nv
17
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL0/81O3e1vh5smcwp2G
18
- MpLQ6q0kejQLa65bPYPxdzWA1SYOKyGfw+yR9LdFzsuKpwWzKq6zX35lj1IckWS4
19
- bNBEQzxmufUxU0XPM02haFB8fOfDJzdXsWte9Ge4IFwahwn68gpMqN+BvxL+KMYz
20
- Iut9YmN44d4LZdsENEIO5vmybuG2vYDz7R56qB0PA+Q2P2CdhymsBad2DQs69FBo
21
- uico9V6VMYYctL9lCYdzu9IXrOYNTt88suKIVzzAlHOKeN0Ng5qdztFoTR8sfxDr
22
- Ydg3KHl5n47wlpgd8R0f/4b5gGxW+v9pyJCgQnLlRu7DedVSvv7+GMtj3g9r3nhJ
23
- KqECAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFI/o
24
- maf34HXbUOQsdoLHacEKQgunMB0GA1UdEQQWMBSBEmFkbWluc0BzaG9waWZ5LmNv
25
- bTAdBgNVHRIEFjAUgRJhZG1pbnNAc2hvcGlmeS5jb20wDQYJKoZIhvcNAQEFBQAD
26
- ggEBADkK9aj5T0HPExsov4EoMWFnO+G7RQ28C30VAfKxnL2UxG6i4XMHVs6Xi94h
27
- qXFw1ec9Y2eDUqaolT3bviOk9BB197+A8Vz/k7MC6ci2NE+yDDB7HAC8zU6LAx8Y
28
- Iqvw7B/PSZ/pz4bUVFlTATif4mi1vO3lidRkdHRtM7UePSn2rUpOi0gtXBP3bLu5
29
- YjHJN7wx5cugMEyroKITG5gL0Nxtu21qtOlHX4Hc4KdE2JqzCPOsS4zsZGhgwhPs
30
- fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
31
- TConQSX2BnZdhIEYW+cKzEC/bLc=
32
- -----END CERTIFICATE-----
33
- date: 2014-05-27 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2014-07-03 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: thor
37
15
  requirement: !ruby/object:Gem::Requirement
38
16
  requirements:
39
- - - ">="
17
+ - - '>='
40
18
  - !ruby/object:Gem::Version
41
19
  version: 0.14.4
42
20
  type: :runtime
43
21
  prerelease: false
44
22
  version_requirements: !ruby/object:Gem::Requirement
45
23
  requirements:
46
- - - ">="
24
+ - - '>='
47
25
  - !ruby/object:Gem::Version
48
26
  version: 0.14.4
49
27
  - !ruby/object:Gem::Dependency
50
28
  name: httparty
51
29
  requirement: !ruby/object:Gem::Requirement
52
30
  requirements:
53
- - - "~>"
31
+ - - ~>
54
32
  - !ruby/object:Gem::Version
55
33
  version: 0.13.0
56
34
  type: :runtime
57
35
  prerelease: false
58
36
  version_requirements: !ruby/object:Gem::Requirement
59
37
  requirements:
60
- - - "~>"
38
+ - - ~>
61
39
  - !ruby/object:Gem::Version
62
40
  version: 0.13.0
63
41
  - !ruby/object:Gem::Dependency
64
42
  name: json
65
43
  requirement: !ruby/object:Gem::Requirement
66
44
  requirements:
67
- - - "~>"
45
+ - - ~>
68
46
  - !ruby/object:Gem::Version
69
47
  version: 1.8.0
70
48
  type: :runtime
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
51
  requirements:
74
- - - "~>"
52
+ - - ~>
75
53
  - !ruby/object:Gem::Version
76
54
  version: 1.8.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: mimemagic
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
77
69
  - !ruby/object:Gem::Dependency
78
70
  name: filewatcher
79
71
  requirement: !ruby/object:Gem::Requirement
80
72
  requirements:
81
- - - ">="
73
+ - - '>='
82
74
  - !ruby/object:Gem::Version
83
75
  version: '0'
84
76
  type: :runtime
85
77
  prerelease: false
86
78
  version_requirements: !ruby/object:Gem::Requirement
87
79
  requirements:
88
- - - ">="
80
+ - - '>='
89
81
  - !ruby/object:Gem::Version
90
82
  version: '0'
91
83
  - !ruby/object:Gem::Dependency
92
84
  name: launchy
93
85
  requirement: !ruby/object:Gem::Requirement
94
86
  requirements:
95
- - - ">="
87
+ - - '>='
96
88
  - !ruby/object:Gem::Version
97
89
  version: '0'
98
90
  type: :runtime
99
91
  prerelease: false
100
92
  version_requirements: !ruby/object:Gem::Requirement
101
93
  requirements:
102
- - - ">="
94
+ - - '>='
103
95
  - !ruby/object:Gem::Version
104
96
  version: '0'
105
97
  - !ruby/object:Gem::Dependency
106
98
  name: rake
107
99
  requirement: !ruby/object:Gem::Requirement
108
100
  requirements:
109
- - - ">="
101
+ - - '>='
110
102
  - !ruby/object:Gem::Version
111
103
  version: '0'
112
104
  type: :development
113
105
  prerelease: false
114
106
  version_requirements: !ruby/object:Gem::Requirement
115
107
  requirements:
116
- - - ">="
108
+ - - '>='
117
109
  - !ruby/object:Gem::Version
118
110
  version: '0'
119
111
  - !ruby/object:Gem::Dependency
120
112
  name: minitest
121
113
  requirement: !ruby/object:Gem::Requirement
122
114
  requirements:
123
- - - ">="
115
+ - - '>='
124
116
  - !ruby/object:Gem::Version
125
117
  version: 5.0.0
126
118
  type: :development
127
119
  prerelease: false
128
120
  version_requirements: !ruby/object:Gem::Requirement
129
121
  requirements:
130
- - - ">="
122
+ - - '>='
131
123
  - !ruby/object:Gem::Version
132
124
  version: 5.0.0
133
125
  - !ruby/object:Gem::Dependency
134
126
  name: pry
135
127
  requirement: !ruby/object:Gem::Requirement
136
128
  requirements:
137
- - - ">="
129
+ - - '>='
138
130
  - !ruby/object:Gem::Version
139
131
  version: '0'
140
132
  type: :development
141
133
  prerelease: false
142
134
  version_requirements: !ruby/object:Gem::Requirement
143
135
  requirements:
144
- - - ">="
136
+ - - '>='
145
137
  - !ruby/object:Gem::Version
146
138
  version: '0'
147
139
  - !ruby/object:Gem::Dependency
148
140
  name: pry-debugger
149
141
  requirement: !ruby/object:Gem::Requirement
150
142
  requirements:
151
- - - ">="
143
+ - - '>='
152
144
  - !ruby/object:Gem::Version
153
145
  version: '0'
154
146
  type: :development
155
147
  prerelease: false
156
148
  version_requirements: !ruby/object:Gem::Requirement
157
149
  requirements:
158
- - - ">="
150
+ - - '>='
159
151
  - !ruby/object:Gem::Version
160
152
  version: '0'
161
153
  description: Command line tool to help with developing Shopify themes. Provides simple
@@ -168,9 +160,10 @@ executables:
168
160
  extensions: []
169
161
  extra_rdoc_files: []
170
162
  files:
171
- - ".gitignore"
172
- - ".travis.yml"
163
+ - .gitignore
164
+ - .travis.yml
173
165
  - CHANGELOG.md
166
+ - CONTRIBUTING
174
167
  - Gemfile
175
168
  - MIT-LICENSE
176
169
  - README.md
@@ -194,18 +187,20 @@ require_paths:
194
187
  - lib
195
188
  required_ruby_version: !ruby/object:Gem::Requirement
196
189
  requirements:
197
- - - ">="
190
+ - - '>='
198
191
  - !ruby/object:Gem::Version
199
192
  version: '0'
200
193
  required_rubygems_version: !ruby/object:Gem::Requirement
201
194
  requirements:
202
- - - ">="
195
+ - - '>='
203
196
  - !ruby/object:Gem::Version
204
197
  version: '0'
205
198
  requirements: []
206
199
  rubyforge_project: shopify_theme
207
- rubygems_version: 2.2.0
200
+ rubygems_version: 2.2.2
208
201
  signing_key:
209
202
  specification_version: 4
210
203
  summary: Command line tool for developing themes
211
- test_files: []
204
+ test_files:
205
+ - spec/spec_helper.rb
206
+ - spec/unit/cli_spec.rb
checksums.yaml.gz.sig DELETED
@@ -1 +0,0 @@
1
- 0Ϲ���cC��:\�H�%3�_R��L����o��r���4�X*�[�(.0�����L�p����ؑ`�������dah s�@#ն���^w�+�)zL��TP�� H��&Oy:S$ �NJ'�p�{F�P�+&h�� d�ī�Bȯ;��ψ�D��橦Е��&+RNǙ_���v :L��K�����<:��J|�E7hMVTL�L���K�4:��K��Q���ե[8޿w *�U�� q�yQ�V��:
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file