shopify_theme 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,7 +6,7 @@ gem install shopify_theme
6
6
 
7
7
  # Usage
8
8
 
9
- Generate the config file
9
+ 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.
10
10
 
11
11
  ````
12
12
  theme configure api_key password store_url
data/lib/shopify_theme.rb CHANGED
@@ -7,30 +7,34 @@ module ShopifyTheme
7
7
  def self.asset_list
8
8
  # HTTParty parser chokes on assest listing, have it noop
9
9
  # and then use a rel JSON parser.
10
- response = shopify.get("/admin/assets.json", :parser => NOOPParser)
10
+ response = shopify.get(path, :parser => NOOPParser)
11
11
  assets = JSON.parse(response.body)["assets"].collect {|a| a['key'] }
12
12
  # Remove any .css files if a .css.liquid file exists
13
13
  assets.reject{|a| assets.include?("#{a}.liquid") }
14
14
  end
15
15
 
16
16
  def self.get_asset(asset)
17
- response = shopify.get("/admin/assets.json", :query =>{:asset => {:key => asset}}, :parser => NOOPParser)
17
+ response = shopify.get(path, :query =>{:asset => {:key => asset}}, :parser => NOOPParser)
18
18
  # HTTParty json parsing is broken?
19
19
  JSON.parse(response.body)["asset"]
20
20
  end
21
21
 
22
22
  def self.send_asset(data)
23
- shopify.put("/admin/assets.json", :body =>{:asset => data})
23
+ shopify.put(path, :body =>{:asset => data})
24
24
  end
25
25
 
26
26
  def self.delete_asset(asset)
27
- shopify.delete("/admin/assets.json", :body =>{:asset => {:key => asset}})
27
+ shopify.delete(path, :body =>{:asset => {:key => asset}})
28
28
  end
29
29
 
30
30
  def self.config
31
31
  @config ||= YAML.load(File.read('config.yml'))
32
32
  end
33
33
 
34
+ def self.path
35
+ @path ||= config[:theme_id] ? "/admin/themes/#{config[:theme_id]}/assets.json" : "/admin/assets.json"
36
+ end
37
+
34
38
  def self.ignore_files
35
39
  @ignore_files ||= (config[:ignore_files] || []).compact.collect { |r| Regexp.new(r) }
36
40
  end
@@ -19,7 +19,7 @@ module ShopifyTheme
19
19
 
20
20
  desc "configure API_KEY PASSWORD STORE", "generate a config file for the store to connect to"
21
21
  def configure(api_key=nil, password=nil, store=nil)
22
- config = {:api_key => api_key, :password => password, :store => store, :ignore_files => ["README"]}
22
+ config = {:api_key => api_key, :password => password, :store => store, :theme_id => nil, :ignore_files => ["README"]}
23
23
  create_file('config.yml', config.to_yaml)
24
24
  end
25
25
 
@@ -1,3 +1,3 @@
1
1
  module ShopifyTheme
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-11 00:00:00.000000000 Z
12
+ date: 2012-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &2162609340 !ruby/object:Gem::Requirement
16
+ requirement: &70240424766980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.14.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2162609340
24
+ version_requirements: *70240424766980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: httparty
27
- requirement: &2162608820 !ruby/object:Gem::Requirement
27
+ requirement: &70240424766460 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.7.8
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2162608820
35
+ version_requirements: *70240424766460
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &2162608420 !ruby/object:Gem::Requirement
38
+ requirement: &70240424766080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2162608420
46
+ version_requirements: *70240424766080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fssm
49
- requirement: &2162607940 !ruby/object:Gem::Requirement
49
+ requirement: &70240424765620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2162607940
57
+ version_requirements: *70240424765620
58
58
  description: Command line tool to help with developing Shopify themes. Provides simple
59
59
  commands to download, upload and delete files from a theme. Also includes the watch
60
60
  command to watch a directory and upload files as they change.