shopify_api 3.2.2 → 3.2.3

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: 4b7258c4c1368bc212523e4f8454567e21d46737
4
- data.tar.gz: 3ab24e5dba88ffb8172b7b4b9f9b72029fefe208
3
+ metadata.gz: 0d56d8ba23ba5cddaaf15ce71861a42ac8f8b412
4
+ data.tar.gz: 0c0f579decadffd4a01c6f67ecf68997d79c4b65
5
5
  SHA512:
6
- metadata.gz: b3f0a8efebafd6e97a057c5e87de87a1fc81be1a587c4471c5c2129589d0ecbae0ba2b7398b5ecc6e6b4986e2cd1a2f9c85bbb090209e7438d7c31d42b885ab8
7
- data.tar.gz: e38505ed41e9ae8bd00377483b57cf8a8b62dfff37eb218193cc620665309e978668193ede11b824cb2e7bf3bcbd820e85b4b5eb88a49539c6167eef7bb6e22e
6
+ metadata.gz: 829ebcf857c29c748840b16bd5eeafe2edaa54354ea1c999882a64d95dc1ab8e2b31025418af4eff916c5cebd6b040134626095371a732e26475e56440968868
7
+ data.tar.gz: b48dbc3b6d8a14ab36019292824d4ade9cb19a085287f08778dced7097435934e0af0230ddc2cbeb434f0ffcc2662cf8f24317e3832a63220d5eff321d623959
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == Version 3.2.3
2
+
3
+ * Added pry to the CLI
4
+
1
5
  == Version 3.2.2
2
6
 
3
7
  * Temporary fix for the CLI
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (3.2.2)
4
+ shopify_api (3.2.3)
5
5
  activeresource (>= 3.0.0)
6
+ pry
6
7
  thor (~> 0.18.1)
7
8
 
8
9
  GEM
@@ -23,16 +24,23 @@ GEM
23
24
  tzinfo (~> 0.3.37)
24
25
  atomic (1.1.14)
25
26
  builder (3.1.4)
27
+ coderay (1.1.0)
26
28
  fakeweb (1.3.0)
27
29
  i18n (0.6.9)
28
30
  metaclass (0.0.1)
31
+ method_source (0.8.2)
29
32
  minitest (4.7.5)
30
33
  mocha (0.14.0)
31
34
  metaclass (~> 0.0.1)
32
35
  multi_json (1.8.4)
36
+ pry (0.9.12.6)
37
+ coderay (~> 1.0)
38
+ method_source (~> 0.8)
39
+ slop (~> 3.4)
33
40
  rails-observers (0.1.2)
34
41
  activemodel (~> 4.0)
35
42
  rake (10.1.0)
43
+ slop (3.5.0)
36
44
  thor (0.18.1)
37
45
  thread_safe (0.1.3)
38
46
  atomic
@@ -30,6 +30,11 @@ module ShopifyAPI
30
30
  puts "\nopen https://#{config['domain']}/admin/api in your browser to get API credentials\n"
31
31
  config['api_key'] = ask("API key?")
32
32
  config['password'] = ask("Password?")
33
+ if ask("Would you like to use pry as your shell? (y/n)") === "y"
34
+ config["shell"] = "pry"
35
+ else
36
+ config["shell"] = "irb"
37
+ end
33
38
  create_file(file, config.to_yaml)
34
39
  end
35
40
  if available_connections.one?
@@ -100,10 +105,7 @@ module ShopifyAPI
100
105
  puts "using #{config['domain']}"
101
106
  ShopifyAPI::Base.site = site_from_config(config)
102
107
 
103
- require 'irb'
104
- require 'irb/completion'
105
- ARGV.clear
106
- IRB.start
108
+ launch_shell(config)
107
109
  end
108
110
 
109
111
  tasks.keys.abbrev.each do |shortcut, command|
@@ -137,6 +139,19 @@ module ShopifyAPI
137
139
  ShopifyAPI::Base.site = "#{protocol}://#{api_key}:#{password}@#{domain}/admin"
138
140
  end
139
141
 
142
+ def launch_shell(config)
143
+ if config["shell"] === "pry"
144
+ require 'pry'
145
+ ARGV.clear
146
+ Pry.start
147
+ else
148
+ require 'irb'
149
+ require 'irb/completion'
150
+ ARGV.clear
151
+ IRB.start
152
+ end
153
+ end
154
+
140
155
  def available_connections
141
156
  @available_connections ||= begin
142
157
  pattern = File.join(shop_config_dir, "*.yml")
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "3.2.2"
2
+ VERSION = "3.2.3"
3
3
  end
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
 
27
27
  s.add_dependency("activeresource", [">= 3.0.0"])
28
28
  s.add_dependency("thor", ["~> 0.18.1"])
29
+ s.add_dependency("pry", [">= 0.9.12.6"])
29
30
 
30
31
  if s.respond_to?(:add_development_dependency)
31
32
  s.add_development_dependency("mocha", ">= 0.9.8")
@@ -26,11 +26,8 @@ class CliTest < Test::Unit::TestCase
26
26
  end
27
27
 
28
28
  test "add with blank domain" do
29
- `rm -rf #{@shop_config_dir}/*`
30
- $stdout.expects(:print).with("Domain? (leave blank for foo.myshopify.com) ")
31
- $stdout.expects(:print).with("API key? ")
32
- $stdout.expects(:print).with("Password? ")
33
- $stdin.expects(:gets).times(3).returns("", "key", "pass")
29
+ standard_add_shop_prompts
30
+ $stdin.expects(:gets).times(4).returns("", "key", "pass", "y")
34
31
  @cli.expects(:puts).with("\nopen https://foo.myshopify.com/admin/api in your browser to get API credentials\n")
35
32
  @cli.expects(:puts).with("Default connection is foo")
36
33
 
@@ -40,16 +37,14 @@ class CliTest < Test::Unit::TestCase
40
37
  assert_equal 'foo.myshopify.com', config['domain']
41
38
  assert_equal 'key', config['api_key']
42
39
  assert_equal 'pass', config['password']
40
+ assert_equal 'pry', config['shell']
43
41
  assert_equal 'https', config['protocol']
44
42
  assert_equal config_file('foo'), File.readlink(@default_symlink)
45
43
  end
46
44
 
47
45
  test "add with explicit domain" do
48
- `rm -rf #{@shop_config_dir}/*`
49
- $stdout.expects(:print).with("Domain? (leave blank for foo.myshopify.com) ")
50
- $stdout.expects(:print).with("API key? ")
51
- $stdout.expects(:print).with("Password? ")
52
- $stdin.expects(:gets).times(3).returns("bar.myshopify.com", "key", "pass")
46
+ standard_add_shop_prompts
47
+ $stdin.expects(:gets).times(4).returns("bar.myshopify.com", "key", "pass", "y")
53
48
  @cli.expects(:puts).with("\nopen https://bar.myshopify.com/admin/api in your browser to get API credentials\n")
54
49
  @cli.expects(:puts).with("Default connection is foo")
55
50
 
@@ -59,6 +54,18 @@ class CliTest < Test::Unit::TestCase
59
54
  assert_equal 'bar.myshopify.com', config['domain']
60
55
  end
61
56
 
57
+ test "add with irb as shell" do
58
+ standard_add_shop_prompts
59
+ $stdin.expects(:gets).times(4).returns("bar.myshopify.com", "key", "pass", "fuuuuuuu")
60
+ @cli.expects(:puts).with("\nopen https://bar.myshopify.com/admin/api in your browser to get API credentials\n")
61
+ @cli.expects(:puts).with("Default connection is foo")
62
+
63
+ @cli.add('foo')
64
+
65
+ config = YAML.load(File.read(config_file('foo')))
66
+ assert_equal 'irb', config['shell']
67
+ end
68
+
62
69
  test "list" do
63
70
  @cli.expects(:puts).with(" bar")
64
71
  @cli.expects(:puts).with(" * foo")
@@ -99,11 +106,19 @@ class CliTest < Test::Unit::TestCase
99
106
  private
100
107
 
101
108
  def valid_options
102
- {'domain' => 'snowdevil.myshopify.com', 'api_key' => 'key', 'password' => 'pass', 'protocol' => 'https'}
109
+ {'domain' => 'snowdevil.myshopify.com', 'api_key' => 'key', 'password' => 'pass', 'shell' => 'pry', 'protocol' => 'https'}
103
110
  end
104
111
 
105
112
  def config_file(connection)
106
113
  File.join(@shop_config_dir, "#{connection}.yml")
107
114
  end
108
115
 
116
+ def standard_add_shop_prompts
117
+ `rm -rf #{@shop_config_dir}/*`
118
+ $stdout.expects(:print).with("Domain? (leave blank for foo.myshopify.com) ")
119
+ $stdout.expects(:print).with("API key? ")
120
+ $stdout.expects(:print).with("Password? ")
121
+ $stdout.expects(:print).with("Would you like to use pry as your shell? (y/n) ")
122
+ end
123
+
109
124
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-28 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.18.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.12.6
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.12.6
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: mocha
43
57
  requirement: !ruby/object:Gem::Requirement