shopify_theme 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -2
- data/lib/shopify_theme/cli.rb +28 -26
- data/lib/shopify_theme/version.rb +1 -1
- data/shopify_theme.gemspec +2 -2
- metadata +13 -13
data/README.md
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
+
# Requirements
|
2
|
+
|
3
|
+
Ruby 1.9
|
4
|
+
|
1
5
|
# Installation
|
2
6
|
|
3
7
|
````
|
4
|
-
gem install shopify_theme
|
8
|
+
gem install shopify_theme [optional_theme_id]
|
5
9
|
````
|
6
10
|
|
7
11
|
# Usage
|
8
12
|
|
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.
|
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.
|
10
14
|
|
11
15
|
````
|
12
16
|
theme configure api_key password store_url
|
data/lib/shopify_theme/cli.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'yaml'
|
3
|
+
YAML::ENGINE.yamler = 'syck'
|
3
4
|
require 'abbrev'
|
4
5
|
require 'base64'
|
5
6
|
require 'fileutils'
|
6
7
|
require 'json'
|
7
|
-
require '
|
8
|
+
require 'listen'
|
8
9
|
|
9
10
|
module ShopifyTheme
|
10
11
|
class Cli < Thor
|
@@ -17,9 +18,9 @@ module ShopifyTheme
|
|
17
18
|
map shortcut => command.to_sym
|
18
19
|
end
|
19
20
|
|
20
|
-
desc "configure API_KEY PASSWORD STORE", "generate a config file for the store to connect to"
|
21
|
-
def configure(api_key=nil, password=nil, store=nil)
|
22
|
-
config = {:api_key => api_key, :password => password, :store => store, :theme_id =>
|
21
|
+
desc "configure API_KEY PASSWORD STORE THEME_ID", "generate a config file for the store to connect to"
|
22
|
+
def configure(api_key=nil, password=nil, store=nil, theme_id=nil)
|
23
|
+
config = {:api_key => api_key, :password => password, :store => store, :theme_id => theme_id, :ignore_files => ["README"]}
|
23
24
|
create_file('config.yml', config.to_yaml)
|
24
25
|
end
|
25
26
|
|
@@ -48,25 +49,25 @@ module ShopifyTheme
|
|
48
49
|
desc "replace FILE", "completely replace shop theme assets with local theme assets"
|
49
50
|
method_option :quiet, :type => :boolean, :default => false
|
50
51
|
def replace(*keys)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
52
|
+
say("Are you sure you want to completely replace your shop theme assets? This is not undoable.", :yellow)
|
53
|
+
if ask("Continue? (Y/N): ") == "Y"
|
54
|
+
remote_assets = keys.empty? ? ShopifyTheme.asset_list : keys
|
55
|
+
remote_assets.each do |asset|
|
56
|
+
delete_asset(asset, options['quiet'])
|
57
|
+
end
|
58
|
+
local_assets = keys.empty? ? local_assets_list : keys
|
59
|
+
local_assets.each do |asset|
|
60
|
+
send_asset(asset, options['quiet'])
|
61
|
+
end
|
62
|
+
say("Done.", :green) unless options['quiet']
|
63
|
+
end
|
63
64
|
end
|
64
65
|
|
65
66
|
desc "remove FILE", "remove theme asset"
|
66
67
|
method_option :quiet, :type => :boolean, :default => false
|
67
68
|
def remove(*keys)
|
68
69
|
keys.each do |key|
|
69
|
-
|
70
|
+
delete_asset(key, options['quiet'])
|
70
71
|
end
|
71
72
|
say("Done.", :green) unless options['quiet']
|
72
73
|
end
|
@@ -75,18 +76,19 @@ module ShopifyTheme
|
|
75
76
|
method_option :quiet, :type => :boolean, :default => false
|
76
77
|
method_option :keep_files, :type => :boolean, :default => false
|
77
78
|
def watch
|
78
|
-
|
79
|
-
|
80
|
-
|
79
|
+
puts "Watching current folder:"
|
80
|
+
Listen.to('',:relative_paths => true) do |modified, added, removed|
|
81
|
+
modified.each do |filePath|
|
82
|
+
send_asset(filePath, options['quiet']) if local_assets_list.include?(filePath)
|
81
83
|
end
|
82
|
-
|
83
|
-
send_asset(
|
84
|
+
added.each do |filePath|
|
85
|
+
send_asset(filePath, options['quiet']) if local_assets_list.include?(filePath)
|
84
86
|
end
|
85
87
|
if !options['keep_files']
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
removed.each do |filePath|
|
89
|
+
delete_asset(filePath, options['quiet']) if local_assets_list.include?(relative)
|
90
|
+
end
|
91
|
+
end
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
data/shopify_theme.gemspec
CHANGED
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.rubyforge_project = "shopify_theme"
|
16
16
|
s.add_dependency("thor", [">= 0.14.4"])
|
17
|
-
s.add_dependency("httparty", ["
|
17
|
+
s.add_dependency("httparty", [">= 0.8.0"])
|
18
18
|
s.add_dependency("json")
|
19
|
-
s.add_dependency("
|
19
|
+
s.add_dependency("listen")
|
20
20
|
|
21
21
|
s.files = `git ls-files`.split("\n")
|
22
22
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
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.
|
4
|
+
version: 0.0.7
|
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-
|
12
|
+
date: 2012-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70203650189020 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: 0.14.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70203650189020
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: httparty
|
27
|
-
requirement: &
|
27
|
+
requirement: &70203650188460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.8.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70203650188460
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &70203650188060 !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: *
|
46
|
+
version_requirements: *70203650188060
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
48
|
+
name: listen
|
49
|
+
requirement: &70203650187580 !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: *
|
57
|
+
version_requirements: *70203650187580
|
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.
|