shopify_cli 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 91f855067fbd543f5249e89ef86aaf33ff42de42
4
+ data.tar.gz: 120fb40fe1eb73fa650f17ca519494b4229b23c0
5
+ SHA512:
6
+ metadata.gz: c69b7e20cbf4e24738e913166edbed5239d51edde1df23e3f66b94b00923cb7525d3196cd34452fb6a13147a67cc4bd9417e7e3dbf08f2c0715dc0ac0f91768f
7
+ data.tar.gz: 8e0f6add33df6a2bdc2a52cc0f74a9672793a5a1d69888e7b7dbe5ce43c5a40bbe7ba4bf11c9d0af5627b09edd1838ee82248dd023c29cb03b9f68048a1c9be8
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ shopify_cli (1.0.0)
5
+ pry (>= 0.9.12.6)
6
+ shopify_api
7
+ thor (~> 0.18.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activemodel (4.0.13)
13
+ activesupport (= 4.0.13)
14
+ builder (~> 3.1.0)
15
+ activeresource (4.0.0)
16
+ activemodel (~> 4.0)
17
+ activesupport (~> 4.0)
18
+ rails-observers (~> 0.1.1)
19
+ activesupport (4.0.13)
20
+ i18n (~> 0.6, >= 0.6.9)
21
+ minitest (~> 4.2)
22
+ multi_json (~> 1.3)
23
+ thread_safe (~> 0.1)
24
+ tzinfo (~> 0.3.37)
25
+ builder (3.1.4)
26
+ coderay (1.1.0)
27
+ fakeweb (1.3.0)
28
+ i18n (0.7.0)
29
+ metaclass (0.0.4)
30
+ method_source (0.8.2)
31
+ minitest (4.7.5)
32
+ mocha (1.1.0)
33
+ metaclass (~> 0.0.1)
34
+ multi_json (1.11.0)
35
+ pry (0.10.1)
36
+ coderay (~> 1.1.0)
37
+ method_source (~> 0.8.1)
38
+ slop (~> 3.4)
39
+ rails-observers (0.1.2)
40
+ activemodel (~> 4.0)
41
+ rake (10.4.2)
42
+ shopify_api (3.2.7)
43
+ activeresource
44
+ pry (>= 0.9.12.6)
45
+ thor (~> 0.18.1)
46
+ slop (3.6.0)
47
+ thor (0.18.1)
48
+ thread_safe (0.3.5)
49
+ tzinfo (0.3.43)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ fakeweb
56
+ minitest (~> 4.0)
57
+ mocha (>= 0.9.8)
58
+ rake
59
+ shopify_cli!
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 "Shopify inc."
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,58 @@
1
+ = shopify_cli
2
+
3
+ This package also includes the ``shopify-cli`` executable to make it easy to open up an interactive console to use the API with a shop.
4
+
5
+ 1. Obtain a private API key and password to use with your shop (step 2 in "Getting Started")
6
+
7
+ 2. Use the ``shopify-cli`` script to save the credentials for the shop to quickly log in.
8
+
9
+ ```bash
10
+ shopify-cli add yourshopname
11
+ ```
12
+
13
+ Follow the prompts for the shop domain, API key and password.
14
+
15
+ 3. Start the console for the connection.
16
+
17
+ ```bash
18
+ shopify-cli console
19
+ ```
20
+
21
+ 4. To see the full list of commands, type:
22
+
23
+ ```bash
24
+ shopify-cli help
25
+ ```
26
+
27
+ ## Installation:
28
+
29
+ `gem install shopify_cli`
30
+
31
+ ## Contributing
32
+
33
+ After checking out the source, run:
34
+
35
+ `$ bundle install && bundle exec rake test`
36
+
37
+ ## License:
38
+
39
+ Copyright (c) 2015 Shopify
40
+
41
+ Permission is hereby granted, free of charge, to any person obtaining
42
+ a copy of this software and associated documentation files (the
43
+ 'Software'), to deal in the Software without restriction, including
44
+ without limitation the rights to use, copy, modify, merge, publish,
45
+ distribute, sublicense, and/or sell copies of the Software, and to
46
+ permit persons to whom the Software is furnished to do so, subject to
47
+ the following conditions:
48
+
49
+ The above copyright notice and this permission notice shall be
50
+ included in all copies or substantial portions of the Software.
51
+
52
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
53
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
54
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
55
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
56
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
57
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
58
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,42 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ require 'rake'
4
+ require "bundler/gem_tasks"
5
+
6
+ require 'rake/testtask'
7
+ Rake::TestTask.new(:test) do |test|
8
+ test.libs << 'lib' << 'test'
9
+ test.pattern = 'test/**/*_test.rb'
10
+ test.verbose = true
11
+ end
12
+
13
+ begin
14
+ require 'rcov/rcovtask'
15
+ Rcov::RcovTask.new do |test|
16
+ test.libs << 'test'
17
+ test.pattern = 'test/**/*_test.rb'
18
+ test.verbose = true
19
+ end
20
+ rescue LoadError
21
+ task :rcov do
22
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
23
+ end
24
+ end
25
+
26
+
27
+ task :default => :test
28
+
29
+ require 'rdoc/task'
30
+ Rake::RDocTask.new do |rdoc|
31
+ if File.exist?('VERSION.yml')
32
+ config = YAML.load(File.read('VERSION.yml'))
33
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
34
+ else
35
+ version = ""
36
+ end
37
+
38
+ rdoc.rdoc_dir = 'rdoc'
39
+ rdoc.title = "shopify_api #{version}"
40
+ rdoc.rdoc_files.include('README*')
41
+ rdoc.rdoc_files.include('lib/**/*.rb')
42
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../lib/shopify_cli',__FILE__)
3
+ require File.expand_path('../../lib/shopify_cli/cli',__FILE__)
4
+ ShopifyCLI::Cli.start(ARGV)
5
+
@@ -0,0 +1,3 @@
1
+ module ShopifyCLI
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,179 @@
1
+ require 'thor'
2
+ require 'abbrev'
3
+ require 'yaml'
4
+ require 'shopify_api'
5
+
6
+ module ShopifyCLI
7
+ class Cli < Thor
8
+ include Thor::Actions
9
+
10
+ class ConfigFileError < StandardError
11
+ end
12
+
13
+ desc "list", "list available connections"
14
+ def list
15
+ available_connections.each do |c|
16
+ prefix = default?(c) ? " * " : " "
17
+ puts prefix + c
18
+ end
19
+ end
20
+
21
+ desc "add CONNECTION", "create a config file for a connection named CONNECTION"
22
+ def add(connection)
23
+ file = config_file(connection)
24
+ if File.exist?(file)
25
+ raise ConfigFileError, "There is already a config file at #{file}"
26
+ else
27
+ config = {'protocol' => 'https'}
28
+ config['domain'] = ask("Domain? (leave blank for #{connection}.myshopify.com)")
29
+ config['domain'] = "#{connection}.myshopify.com" if config['domain'].blank?
30
+ config['domain'] = "#{config['domain']}.myshopify.com" unless config['domain'].match(/[.:]/)
31
+ puts "\nopen https://#{config['domain']}/admin/apps/private in your browser to create a private app and get API credentials\n"
32
+ config['api_key'] = ask("API key?")
33
+ config['password'] = ask("Password?")
34
+ if ask("Would you like to use pry as your shell? (y/n)") === "y"
35
+ config["shell"] = "pry"
36
+ else
37
+ config["shell"] = "irb"
38
+ end
39
+ create_file(file, config.to_yaml)
40
+ end
41
+ if available_connections.one?
42
+ default(connection)
43
+ end
44
+ end
45
+
46
+ desc "remove CONNECTION", "remove the config file for CONNECTION"
47
+ def remove(connection)
48
+ file = config_file(connection)
49
+ if File.exist?(file)
50
+ remove_file(default_symlink) if default?(connection)
51
+ remove_file(file)
52
+ else
53
+ no_config_file_error(file)
54
+ end
55
+ end
56
+
57
+ desc "edit [CONNECTION]", "open the config file for CONNECTION with your default editor"
58
+ def edit(connection=nil)
59
+ file = config_file(connection)
60
+ if File.exist?(file)
61
+ if ENV['EDITOR'].present?
62
+ system(ENV['EDITOR'], file)
63
+ else
64
+ puts "Please set an editor in the EDITOR environment variable"
65
+ end
66
+ else
67
+ no_config_file_error(file)
68
+ end
69
+ end
70
+
71
+ desc "show [CONNECTION]", "output the location and contents of the CONNECTION's config file"
72
+ def show(connection=nil)
73
+ connection ||= default_connection
74
+ file = config_file(connection)
75
+ if File.exist?(file)
76
+ puts file
77
+ puts `cat #{file}`
78
+ else
79
+ no_config_file_error(file)
80
+ end
81
+ end
82
+
83
+ desc "default [CONNECTION]", "show the default connection, or make CONNECTION the default"
84
+ def default(connection=nil)
85
+ if connection
86
+ target = config_file(connection)
87
+ if File.exist?(target)
88
+ remove_file(default_symlink)
89
+ `ln -s #{target} #{default_symlink}`
90
+ else
91
+ no_config_file_error(target)
92
+ end
93
+ end
94
+ if File.exist?(default_symlink)
95
+ puts "Default connection is #{default_connection}"
96
+ else
97
+ puts "There is no default connection set"
98
+ end
99
+ end
100
+
101
+ desc "console [CONNECTION]", "start an API console for CONNECTION"
102
+ def console(connection=nil)
103
+ file = config_file(connection)
104
+
105
+ config = YAML.load(File.read(file))
106
+ puts "using #{config['domain']}"
107
+ ShopifyAPI::Base.site = site_from_config(config)
108
+
109
+ launch_shell(config)
110
+ end
111
+
112
+ tasks.keys.abbrev.each do |shortcut, command|
113
+ map shortcut => command.to_sym
114
+ end
115
+
116
+ private
117
+
118
+ def shop_config_dir
119
+ @shop_config_dir ||= File.join(ENV['HOME'], '.shopify', 'shops')
120
+ end
121
+
122
+ def default_symlink
123
+ @default_symlink ||= File.join(shop_config_dir, 'default')
124
+ end
125
+
126
+ def config_file(connection)
127
+ if connection
128
+ File.join(shop_config_dir, "#{connection}.yml")
129
+ else
130
+ default_symlink
131
+ end
132
+ end
133
+
134
+ def site_from_config(config)
135
+ protocol = config['protocol'] || 'https'
136
+ api_key = config['api_key']
137
+ password = config['password']
138
+ domain = config['domain']
139
+
140
+ ShopifyAPI::Base.site = "#{protocol}://#{api_key}:#{password}@#{domain}/admin"
141
+ end
142
+
143
+ def launch_shell(config)
144
+ if config["shell"] === "pry"
145
+ require 'pry'
146
+ ARGV.clear
147
+ Pry.start
148
+ else
149
+ require 'irb'
150
+ require 'irb/completion'
151
+ ARGV.clear
152
+ IRB.start
153
+ end
154
+ end
155
+
156
+ def available_connections
157
+ @available_connections ||= begin
158
+ pattern = File.join(shop_config_dir, "*.yml")
159
+ Dir.glob(pattern).map { |f| File.basename(f, ".yml") }
160
+ end
161
+ end
162
+
163
+ def default_connection_target
164
+ @default_connection_target ||= File.readlink(default_symlink)
165
+ end
166
+
167
+ def default_connection
168
+ @default_connection ||= File.basename(default_connection_target, ".yml")
169
+ end
170
+
171
+ def default?(connection)
172
+ default_connection == connection
173
+ end
174
+
175
+ def no_config_file_error(filename)
176
+ raise ConfigFileError, "There is no config file at #{filename}"
177
+ end
178
+ end
179
+ end
@@ -0,0 +1 @@
1
+ # using the default shipit config
@@ -0,0 +1,41 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'shopify_cli'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{shopify_cli}
7
+ s.version = ShopifyCLI::VERSION
8
+ s.author = "Shopify"
9
+
10
+ s.summary = %q{The Shopify CLI gem is a tool for accessing the Shopify admin REST web services from the console}
11
+ s.description = %q{}
12
+ s.email = %q{developers@shopify.com}
13
+ s.homepage = %q{http://www.shopify.com/partners/apps}
14
+
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.md"
18
+ ]
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+
23
+ s.rdoc_options = ["--charset=UTF-8"]
24
+ s.license = 'MIT'
25
+
26
+ s.add_dependency("shopify_api")
27
+ s.add_dependency("thor", "~> 0.18.1")
28
+ s.add_dependency("pry", ">= 0.9.12.6")
29
+
30
+ dev_dependencies = [['mocha', '>= 0.9.8'],
31
+ ['fakeweb'],
32
+ ['minitest', '~> 4.0'],
33
+ ['rake']
34
+ ]
35
+
36
+ if s.respond_to?(:add_development_dependency)
37
+ dev_dependencies.each { |dep| s.add_development_dependency(*dep) }
38
+ else
39
+ dev_dependencies.each { |dep| s.add_dependency(*dep) }
40
+ end
41
+ end
@@ -0,0 +1,137 @@
1
+ require 'test_helper'
2
+ require 'shopify_cli/cli'
3
+ require 'fileutils'
4
+
5
+ class CliTest < Test::Unit::TestCase
6
+ HOME_DIR = File.expand_path(File.dirname(__FILE__))
7
+ TEST_HOME = File.join(HOME_DIR, 'files', 'home')
8
+ CONFIG_DIR = File.join(TEST_HOME, '.shopify', 'shops')
9
+ DEFAULT_SYMLINK = File.join(CONFIG_DIR, 'default')
10
+
11
+ def setup
12
+ force_remove(TEST_HOME)
13
+
14
+ ENV['HOME'] = TEST_HOME
15
+ @cli = ShopifyCLI::Cli.new
16
+
17
+ FileUtils.mkdir_p(CONFIG_DIR)
18
+ Dir.chdir(CONFIG_DIR)
19
+
20
+ add_config('foo', default: true, config: valid_options.merge(domain: 'foo.myshopify.com'))
21
+ add_config('bar', config: valid_options.merge(domain: 'bar.myshopify.com'))
22
+ end
23
+
24
+ def teardown
25
+ Dir.chdir(HOME_DIR)
26
+ force_remove(TEST_HOME)
27
+ end
28
+
29
+ test "add with blank domain" do
30
+ standard_add_shop_prompts
31
+ $stdin.expects(:gets).times(4).returns("", "key", "pass", "y")
32
+ @cli.expects(:puts).with("\nopen https://foo.myshopify.com/admin/apps/private in your browser to create a private app and get API credentials\n")
33
+ @cli.expects(:puts).with("Default connection is foo")
34
+
35
+ @cli.add('foo')
36
+
37
+ config = YAML.load(File.read(config_file('foo')))
38
+ assert_equal 'foo.myshopify.com', config['domain']
39
+ assert_equal 'key', config['api_key']
40
+ assert_equal 'pass', config['password']
41
+ assert_equal 'pry', config['shell']
42
+ assert_equal 'https', config['protocol']
43
+ assert_equal config_file('foo'), File.readlink(DEFAULT_SYMLINK)
44
+ end
45
+
46
+ test "add with explicit domain" do
47
+ standard_add_shop_prompts
48
+ $stdin.expects(:gets).times(4).returns("bar.myshopify.com", "key", "pass", "y")
49
+ @cli.expects(:puts).with("\nopen https://bar.myshopify.com/admin/apps/private in your browser to create a private app and get API credentials\n")
50
+ @cli.expects(:puts).with("Default connection is foo")
51
+
52
+ @cli.add('foo')
53
+
54
+ config = YAML.load(File.read(config_file('foo')))
55
+ assert_equal 'bar.myshopify.com', config['domain']
56
+ end
57
+
58
+ test "add with irb as shell" do
59
+ standard_add_shop_prompts
60
+ $stdin.expects(:gets).times(4).returns("bar.myshopify.com", "key", "pass", "fuuuuuuu")
61
+ @cli.expects(:puts).with("\nopen https://bar.myshopify.com/admin/apps/private in your browser to create a private app and get API credentials\n")
62
+ @cli.expects(:puts).with("Default connection is foo")
63
+
64
+ @cli.add('foo')
65
+
66
+ config = YAML.load(File.read(config_file('foo')))
67
+ assert_equal 'irb', config['shell']
68
+ end
69
+
70
+ test "list" do
71
+ @cli.expects(:puts).with(" bar")
72
+ @cli.expects(:puts).with(" * foo")
73
+
74
+ @cli.list
75
+ end
76
+
77
+ test "show default" do
78
+ @cli.expects(:puts).with("Default connection is foo")
79
+
80
+ @cli.default
81
+ end
82
+
83
+ test "set default" do
84
+ @cli.expects(:puts).with("Default connection is bar")
85
+
86
+ @cli.default('bar')
87
+
88
+ assert_equal config_file('bar'), File.readlink(DEFAULT_SYMLINK)
89
+ end
90
+
91
+ test "remove default connection" do
92
+ @cli.remove('foo')
93
+
94
+ assert !File.exist?(DEFAULT_SYMLINK)
95
+ assert !File.exist?(config_file('foo'))
96
+ assert File.exist?(config_file('bar'))
97
+ end
98
+
99
+ test "remove non-default connection" do
100
+ @cli.remove('bar')
101
+
102
+ assert_equal 'foo.yml', File.readlink(DEFAULT_SYMLINK)
103
+ assert File.exist?(config_file('foo'))
104
+ assert !File.exist?(config_file('bar'))
105
+ end
106
+
107
+ private
108
+
109
+ def valid_options
110
+ {'domain' => 'snowdevil.myshopify.com', 'api_key' => 'key', 'password' => 'pass', 'shell' => 'pry', 'protocol' => 'https'}
111
+ end
112
+
113
+ def config_file(connection)
114
+ File.join(CONFIG_DIR, "#{connection}.yml")
115
+ end
116
+
117
+ def add_config(name, config: nil, default: false)
118
+ File.open("#{name}.yml", 'w') do |file|
119
+ file.puts config.to_yaml
120
+ end
121
+ File.symlink("#{name}.yml", DEFAULT_SYMLINK) if default
122
+ end
123
+
124
+ def standard_add_shop_prompts
125
+ force_remove("#{CONFIG_DIR}/*")
126
+
127
+ $stdout.expects(:print).with("Domain? (leave blank for foo.myshopify.com) ")
128
+ $stdout.expects(:print).with("API key? ")
129
+ $stdout.expects(:print).with("Password? ")
130
+ $stdout.expects(:print).with("Would you like to use pry as your shell? (y/n) ")
131
+ end
132
+
133
+ def force_remove(pattern)
134
+ `rm -rf #{pattern}`
135
+ end
136
+
137
+ end
@@ -0,0 +1,77 @@
1
+ require 'rubygems'
2
+ require 'minitest/autorun'
3
+ require 'fakeweb'
4
+ require 'mocha/setup'
5
+
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
+ require 'shopify_cli'
9
+ require 'shopify_api'
10
+
11
+ FakeWeb.allow_net_connect = false
12
+
13
+ module Test
14
+ module Unit
15
+ class TestCase < MiniTest::Unit::TestCase
16
+ end
17
+ end
18
+ end
19
+ # setup ShopifyAPI with fake api_key and secret
20
+
21
+ class Test::Unit::TestCase
22
+ def self.test(string, &block)
23
+ define_method("test:#{string}", &block)
24
+ end
25
+
26
+ def self.should(string, &block)
27
+ self.test("should_#{string}", &block)
28
+ end
29
+
30
+ def self.context(string)
31
+ yield
32
+ end
33
+
34
+ def setup
35
+ ActiveResource::Base.format = :json
36
+ ShopifyAPI.constants.each do |const|
37
+ begin
38
+ const = "ShopifyAPI::#{const}".constantize
39
+ const.format = :json if const.respond_to?(:format=)
40
+ rescue NameError
41
+ end
42
+ end
43
+
44
+ ShopifyAPI::Base.clear_session
45
+ ShopifyAPI::Base.site = "https://this-is-my-test-shop.myshopify.com/admin"
46
+ ShopifyAPI::Base.password = nil
47
+ ShopifyAPI::Base.user = nil
48
+ end
49
+
50
+ def teardown
51
+ FakeWeb.clean_registry
52
+ end
53
+
54
+ # Custom Assertions
55
+ def assert_not(expression)
56
+ assert_block("Expected <#{expression}> to be false!") { not expression }
57
+ end
58
+
59
+ def load_fixture(name, format=:json)
60
+ File.read(File.dirname(__FILE__) + "/fixtures/#{name}.#{format}")
61
+ end
62
+
63
+ def fake(endpoint, options={})
64
+ body = options.has_key?(:body) ? options.delete(:body) : load_fixture(endpoint)
65
+ format = options.delete(:format) || :json
66
+ method = options.delete(:method) || :get
67
+ extension = ".#{options.delete(:extension)||'json'}" unless options[:extension]==false
68
+
69
+ url = if options.has_key?(:url)
70
+ options[:url]
71
+ else
72
+ "https://this-is-my-test-shop.myshopify.com/admin/#{endpoint}#{extension}"
73
+ end
74
+
75
+ FakeWeb.register_uri(method, url, {:body => body, :status => 200, :content_type => "text/#{format}", :content_length => 1}.merge(options))
76
+ end
77
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shopify_cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Shopify
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: shopify_api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.18.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
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
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.8
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.8
69
+ - !ruby/object:Gem::Dependency
70
+ name: fakeweb
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: ''
112
+ email: developers@shopify.com
113
+ executables:
114
+ - shopify-cli
115
+ extensions: []
116
+ extra_rdoc_files:
117
+ - LICENSE
118
+ - README.md
119
+ files:
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - LICENSE
123
+ - README.md
124
+ - Rakefile
125
+ - bin/shopify-cli
126
+ - lib/shopify_cli.rb
127
+ - lib/shopify_cli/cli.rb
128
+ - shipit.rubygems.yml
129
+ - shopify_cli.gemspec
130
+ - test/cli_test.rb
131
+ - test/test_helper.rb
132
+ homepage: http://www.shopify.com/partners/apps
133
+ licenses:
134
+ - MIT
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options:
138
+ - "--charset=UTF-8"
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubyforge_project:
153
+ rubygems_version: 2.4.5
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: The Shopify CLI gem is a tool for accessing the Shopify admin REST web services
157
+ from the console
158
+ test_files: []