shopify_theme 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,12 +10,24 @@ gem install shopify_theme [optional_theme_id]
10
10
 
11
11
  # Usage
12
12
 
13
- Generate the config file. Go get a valid api_key and password for your store head to https://[your store].myshopify.com/admin/api and generate a private application. Default it adds the main theme, if you want to edit one of your other themes, add the theme_id.
13
+ Generate the config file. Go get a valid api_key and password for your store head to https://[your store].myshopify.com/admin/apps/private and generate a private application. Default it adds the main theme, if you want to edit one of your other themes, add the theme_id.
14
14
 
15
15
  ````
16
16
  theme configure api_key password store_url
17
17
  ````
18
18
 
19
+ Example of config.yml. Notice store has no http or https declaration.
20
+
21
+ ````
22
+ ---
23
+ :api_key: 7a8da86d3dd730b67a357dedabaac5d6
24
+ :password: 552338ce0d3aba7fc501dcf99bc57a81
25
+ :store: little-plastics.myshopify.com
26
+ :theme_id:
27
+ :ignore_files:
28
+ - README
29
+ ````
30
+
19
31
  Download all the theme files
20
32
 
21
33
  ````
data/lib/shopify_theme.rb CHANGED
@@ -32,7 +32,7 @@ module ShopifyTheme
32
32
  end
33
33
 
34
34
  def self.path
35
- @path ||= config[:theme_id] ? "/admin/themes/#{config[:theme_id]}/assets.json" : "/admin/assets.json"
35
+ @path ||= config[:theme_id] ? "/admin/themes/#{config[:theme_id]}/assets.json" : "/admin/assets.json"
36
36
  end
37
37
 
38
38
  def self.ignore_files
@@ -47,6 +47,10 @@ module ShopifyTheme
47
47
  end
48
48
  end
49
49
 
50
+ def self.check_config
51
+ shopify.get(path).code == 200
52
+ end
53
+
50
54
  private
51
55
  def self.shopify
52
56
  basic_auth config[:api_key], config[:password]
@@ -12,7 +12,7 @@ module ShopifyTheme
12
12
  class Cli < Thor
13
13
  include Thor::Actions
14
14
 
15
- BINARY_EXTENSIONS = %w(png gif jpg jpeg eot svg ttf woff swf ico)
15
+ BINARY_EXTENSIONS = %w(png gif jpg jpeg eot svg ttf woff otf swf ico)
16
16
  IGNORE = %w(config.yml)
17
17
  TIMEFORMAT = "%H:%M:%S"
18
18
 
@@ -20,6 +20,15 @@ module ShopifyTheme
20
20
  map shortcut => command.to_sym
21
21
  end
22
22
 
23
+ desc "check", "check configuration"
24
+ def check
25
+ if ShopifyTheme.check_config
26
+ say("Configuration [OK]", :green)
27
+ else
28
+ say("Configuration [FAIL]", :red)
29
+ end
30
+ end
31
+
23
32
  desc "configure API_KEY PASSWORD STORE THEME_ID", "generate a config file for the store to connect to"
24
33
  def configure(api_key=nil, password=nil, store=nil, theme_id=nil)
25
34
  config = {:api_key => api_key, :password => password, :store => store, :theme_id => theme_id, :ignore_files => ["README"]}
@@ -137,7 +146,7 @@ module ShopifyTheme
137
146
  time = Time.now
138
147
  data = {:key => asset}
139
148
  content = File.read(asset)
140
- if ShopifyTheme.is_binary_data?(content) || BINARY_EXTENSIONS.include?(File.extname(asset).gsub('.',''))
149
+ if BINARY_EXTENSIONS.include?(File.extname(asset).gsub('.','')) || ShopifyTheme.is_binary_data?(content)
141
150
  content = IO.read asset
142
151
  data.merge!(:attachment => Base64.encode64(content))
143
152
  else
@@ -161,8 +170,17 @@ module ShopifyTheme
161
170
  end
162
171
 
163
172
  def errors_from_response(response)
164
- if response.parsed_response
165
- response.parsed_response["errors"] ? response.parsed_response["errors"].values.join(", ") : ""
173
+ return unless response.parsed_response
174
+
175
+ errors = response.parsed_response["errors"]
176
+
177
+ case errors
178
+ when NilClass
179
+ ''
180
+ when String
181
+ errors
182
+ else
183
+ errors.values.join(", ")
166
184
  end
167
185
  end
168
186
  end
@@ -1,3 +1,3 @@
1
1
  module ShopifyTheme
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -15,9 +15,9 @@ Gem::Specification.new do |s|
15
15
  s.rubyforge_project = "shopify_theme"
16
16
  s.add_development_dependency 'rake'
17
17
  s.add_dependency("thor", [">= 0.14.4"])
18
- s.add_dependency("httparty", [">= 0.8.0"])
18
+ s.add_dependency("httparty", "~> 0.11")
19
19
  s.add_dependency("json")
20
- s.add_dependency("listen", [">= 1.0.3"])
20
+ s.add_dependency("listen", "~>1.0")
21
21
  s.add_dependency("launchy")
22
22
 
23
23
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,112 +1,112 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_theme
3
3
  version: !ruby/object:Gem::Version
4
+ version: 0.0.10
4
5
  prerelease:
5
- version: 0.0.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Duff
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-20 00:00:00.000000000 Z
12
+ date: 2013-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- version_requirements: !ruby/object:Gem::Requirement
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
- none: false
21
- name: rake
22
22
  type: :development
23
23
  prerelease: false
24
- requirement: !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
25
26
  requirements:
26
27
  - - ! '>='
27
28
  - !ruby/object:Gem::Version
28
29
  version: '0'
29
- none: false
30
30
  - !ruby/object:Gem::Dependency
31
- version_requirements: !ruby/object:Gem::Requirement
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
32
34
  requirements:
33
35
  - - ! '>='
34
36
  - !ruby/object:Gem::Version
35
37
  version: 0.14.4
36
- none: false
37
- name: thor
38
38
  type: :runtime
39
39
  prerelease: false
40
- requirement: !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
41
42
  requirements:
42
43
  - - ! '>='
43
44
  - !ruby/object:Gem::Version
44
45
  version: 0.14.4
45
- none: false
46
46
  - !ruby/object:Gem::Dependency
47
- version_requirements: !ruby/object:Gem::Requirement
47
+ name: httparty
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
48
50
  requirements:
49
- - - ! '>='
51
+ - - ~>
50
52
  - !ruby/object:Gem::Version
51
- version: 0.8.0
52
- none: false
53
- name: httparty
53
+ version: '0.11'
54
54
  type: :runtime
55
55
  prerelease: false
56
- requirement: !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
57
58
  requirements:
58
- - - ! '>='
59
+ - - ~>
59
60
  - !ruby/object:Gem::Version
60
- version: 0.8.0
61
- none: false
61
+ version: '0.11'
62
62
  - !ruby/object:Gem::Dependency
63
- version_requirements: !ruby/object:Gem::Requirement
63
+ name: json
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
64
66
  requirements:
65
67
  - - ! '>='
66
68
  - !ruby/object:Gem::Version
67
69
  version: '0'
68
- none: false
69
- name: json
70
70
  type: :runtime
71
71
  prerelease: false
72
- requirement: !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
73
74
  requirements:
74
75
  - - ! '>='
75
76
  - !ruby/object:Gem::Version
76
77
  version: '0'
77
- none: false
78
78
  - !ruby/object:Gem::Dependency
79
- version_requirements: !ruby/object:Gem::Requirement
79
+ name: listen
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
80
82
  requirements:
81
- - - ! '>='
83
+ - - ~>
82
84
  - !ruby/object:Gem::Version
83
- version: 1.0.3
84
- none: false
85
- name: listen
85
+ version: '1.0'
86
86
  type: :runtime
87
87
  prerelease: false
88
- requirement: !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
89
90
  requirements:
90
- - - ! '>='
91
+ - - ~>
91
92
  - !ruby/object:Gem::Version
92
- version: 1.0.3
93
- none: false
93
+ version: '1.0'
94
94
  - !ruby/object:Gem::Dependency
95
- version_requirements: !ruby/object:Gem::Requirement
95
+ name: launchy
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
96
98
  requirements:
97
99
  - - ! '>='
98
100
  - !ruby/object:Gem::Version
99
101
  version: '0'
100
- none: false
101
- name: launchy
102
102
  type: :runtime
103
103
  prerelease: false
104
- requirement: !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
105
106
  requirements:
106
107
  - - ! '>='
107
108
  - !ruby/object:Gem::Version
108
109
  version: '0'
109
- none: false
110
110
  description: Command line tool to help with developing Shopify themes. Provides simple
111
111
  commands to download, upload and delete files from a theme. Also includes the watch
112
112
  command to watch a directory and upload files as they change.
@@ -134,17 +134,17 @@ rdoc_options: []
134
134
  require_paths:
135
135
  - lib
136
136
  required_ruby_version: !ruby/object:Gem::Requirement
137
+ none: false
137
138
  requirements:
138
139
  - - ! '>='
139
140
  - !ruby/object:Gem::Version
140
141
  version: '0'
141
- none: false
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
+ none: false
143
144
  requirements:
144
145
  - - ! '>='
145
146
  - !ruby/object:Gem::Version
146
147
  version: '0'
147
- none: false
148
148
  requirements: []
149
149
  rubyforge_project: shopify_theme
150
150
  rubygems_version: 1.8.23