shopify_app 6.3.0 → 6.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +8 -0
- data/QUICKSTART.md +73 -0
- data/README.md +12 -1
- data/app/views/sessions/new.html.erb +85 -8
- data/lib/generators/shopify_app/install/install_generator.rb +1 -1
- data/lib/generators/shopify_app/install/templates/_flash_messages.html.erb +2 -0
- data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +34 -18
- data/lib/generators/shopify_app/install/templates/index.html.erb +7 -12
- data/lib/generators/shopify_app/install/templates/shopify_app_ready_script.html.erb +11 -0
- data/lib/generators/shopify_app/install/templates/shopify_provider.rb +2 -6
- data/lib/shopify_app/sessions_controller.rb +2 -2
- data/lib/shopify_app/version.rb +1 -1
- data/shopify_app.gemspec +1 -1
- data/test/support/generator_test_helpers.rb +1 -1
- data/test/test_helper.rb +4 -0
- metadata +6 -5
- data/lib/generators/shopify_app/install/templates/shopify_app_ready_script.html +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fdbb7537a49e1636bfed63000bcad7c99080486
|
4
|
+
data.tar.gz: fd61682e6ec442674b7fd0e340ad25ea5c1a1ed1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02d042ee94d3c5a9beab3a1c2df59472b88acf4a415c70982689f28af8ff5f5552f28b16a24901afea9071a5753da6e27cd6ffb8b3e0d9675666748c109fb052
|
7
|
+
data.tar.gz: 56d11b9ded7132222e769d140f60107c16ae67531dfbe3fa37351bdca0dd997eb64ff76666a2e7292e7b1076652d23669adeb270805e8db603f5720e4ab77d62
|
data/CHANGELOG
CHANGED
data/QUICKSTART.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
Quickstart
|
2
|
+
==========
|
3
|
+
|
4
|
+
Build and deploy a new Shopify App to Heroku in minutes
|
5
|
+
|
6
|
+
1. New Rails App (with postgres)
|
7
|
+
--------------------------------
|
8
|
+
|
9
|
+
```
|
10
|
+
rails new test-app --database=postgresql
|
11
|
+
cd test-app
|
12
|
+
git init
|
13
|
+
git add .
|
14
|
+
git commit -m 'new rails app'
|
15
|
+
```
|
16
|
+
|
17
|
+
2. Create a new Heroku app
|
18
|
+
--------------------------
|
19
|
+
|
20
|
+
The next step is to create a new heroku app. Pull up your heroku dashboard and make a new app!
|
21
|
+
|
22
|
+
cli:
|
23
|
+
```
|
24
|
+
heroku new
|
25
|
+
git remote -v
|
26
|
+
git remote set-url heroku git@heroku.com:<name>.git
|
27
|
+
```
|
28
|
+
|
29
|
+
now we need to let git know where the remote server is so we'll be able to deploy later
|
30
|
+
|
31
|
+
web:
|
32
|
+
```
|
33
|
+
https://dashboard.heroku.com/new
|
34
|
+
git remote add heroku git@heroku.com:appinfive.git
|
35
|
+
```
|
36
|
+
|
37
|
+
3. Create a new App in the partners area
|
38
|
+
-----------------------------------------
|
39
|
+
[https://app.shopify.com/services/partners/api_clients](https://app.shopify.com/services/partners/api_clients)
|
40
|
+
* set the callback url to `https://<name>.herokuapp.com/`
|
41
|
+
* choose an embedded app
|
42
|
+
* set the redirect_uri to `https://<name>.herokuapp.com/auth/shopify/callback`
|
43
|
+
|
44
|
+
|
45
|
+
4. Add ShopifyApp to gemfile
|
46
|
+
----------------------------
|
47
|
+
```
|
48
|
+
vim Gemfile
|
49
|
+
add
|
50
|
+
gem 'shopify_app', '~> 6.0.6'
|
51
|
+
|
52
|
+
bundle install
|
53
|
+
```
|
54
|
+
|
55
|
+
5. Run the ShopifyApp generator
|
56
|
+
-------------------------------
|
57
|
+
```
|
58
|
+
use the keys from your app in the partners area
|
59
|
+
rails generate shopify_app -api_key=a366cbafaccebd2f615aebdfc932fa1c -secret=8750306a895b3dbc7f4136c2ae2ea293 -redirect_uri=https://<name>.herokuapp.com/auth/shopify/callback
|
60
|
+
git add .
|
61
|
+
git commit -m 'generated shopify app'
|
62
|
+
```
|
63
|
+
|
64
|
+
6. Deploy
|
65
|
+
---------
|
66
|
+
```
|
67
|
+
git push heroku
|
68
|
+
heroku run rake db:migrate
|
69
|
+
```
|
70
|
+
|
71
|
+
7. Install the App!
|
72
|
+
-------------------
|
73
|
+
`https://<name>.herokuapp.com/`
|
data/README.md
CHANGED
@@ -18,6 +18,7 @@ Check out this screencast on how to create and deploy a new Shopify App to Herok
|
|
18
18
|
|
19
19
|
[https://vimeo.com/130247240](https://vimeo.com/130247240)
|
20
20
|
|
21
|
+
Or if you prefer text instructions the steps in the video are written out [here](https://github.com/Shopify/shopify_app/blob/master/QUICKSTART.md)
|
21
22
|
|
22
23
|
Becoming a Shopify App Developer
|
23
24
|
--------------------------------
|
@@ -122,7 +123,7 @@ end
|
|
122
123
|
WebhooksManager
|
123
124
|
---------------
|
124
125
|
|
125
|
-
ShopifyApp can manage your app's webhooks for you
|
126
|
+
ShopifyApp can manage your app's webhooks for you by setting which webhooks you require in the initializer:
|
126
127
|
|
127
128
|
```ruby
|
128
129
|
ShopifyApp.configure do |config|
|
@@ -149,6 +150,8 @@ end
|
|
149
150
|
|
150
151
|
The module skips the `verify_authenticity_token` before_action and adds an action to verify that the webhook came from Shopify.
|
151
152
|
|
153
|
+
The WebhooksManager uses ActiveJob, if ActiveJob is not configured then by default Rails will run the jobs inline. However it is highly recommended to configure a proper background processing queue like sidekiq or resque in production.
|
154
|
+
|
152
155
|
|
153
156
|
ShopifyApp::SessionRepository
|
154
157
|
-----------------------------
|
@@ -175,6 +178,14 @@ $ bundle exec spring stop
|
|
175
178
|
|
176
179
|
Run shopify_app generator again.
|
177
180
|
|
181
|
+
Testing an embedded app outside the Shopify admin
|
182
|
+
-------------------------------------------------
|
183
|
+
|
184
|
+
By default, loading your embedded app will redirect to the Shopify admin, with the app view loaded in an `iframe`. If you need to load your app outside of the Shopify admin (e.g., for performance testing), you can change `forceRedirect: false` to `true` in `ShopifyApp.init` block in the `embedded_app` view. To keep the redirect on in production but off in your `development` and `test` environments, you can use:
|
185
|
+
|
186
|
+
```javascript
|
187
|
+
forceRedirect: <%= Rails.env.development? || Rails.env.test? ? 'false' : 'true' %>
|
188
|
+
```
|
178
189
|
|
179
190
|
Questions or problems?
|
180
191
|
----------------------
|
@@ -1,17 +1,94 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
|
-
<html>
|
2
|
+
<html lang="en">
|
3
3
|
<head>
|
4
|
-
<title>
|
4
|
+
<title>Shopify App — Installation</title>
|
5
|
+
|
6
|
+
<style>
|
7
|
+
html, body { padding: 0; margin: 0; }
|
8
|
+
|
9
|
+
body {
|
10
|
+
font-family: "ProximaNovaLight", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
11
|
+
background-color: #f2f7fa;
|
12
|
+
}
|
13
|
+
|
14
|
+
h1 {
|
15
|
+
font-weight: 300;
|
16
|
+
font-size: 40px;
|
17
|
+
margin-bottom: 10px;
|
18
|
+
}
|
19
|
+
|
20
|
+
.subhead {
|
21
|
+
font-size: 17px;
|
22
|
+
line-height: 32px;
|
23
|
+
font-weight: 300;
|
24
|
+
color: #969A9C;
|
25
|
+
}
|
26
|
+
|
27
|
+
input {
|
28
|
+
width: 300px;
|
29
|
+
height: 50px;
|
30
|
+
padding: 10px;
|
31
|
+
border: 1px solid #479CCf;
|
32
|
+
color: #575757;
|
33
|
+
background-color: #ffffff;
|
34
|
+
box-sizing: border-box;
|
35
|
+
border-radius: 4px 0 0 4px;
|
36
|
+
font-size: 18px;
|
37
|
+
float: left;
|
38
|
+
}
|
39
|
+
|
40
|
+
button {
|
41
|
+
color: #ffffff;
|
42
|
+
background-color: #3793cb;
|
43
|
+
width: 100px;
|
44
|
+
height: 50px;
|
45
|
+
padding: 10px 20px 10px 20px;
|
46
|
+
box-sizing: border-box;
|
47
|
+
border: none;
|
48
|
+
text-shadow: 0 1px 0 #3188bc;
|
49
|
+
font-size: 18px;
|
50
|
+
cursor: pointer;
|
51
|
+
border-radius: 0 4px 4px 0;
|
52
|
+
float: right;
|
53
|
+
}
|
54
|
+
|
55
|
+
button:hover {
|
56
|
+
background-color: #479CCf;
|
57
|
+
}
|
58
|
+
|
59
|
+
form {
|
60
|
+
display: block;
|
61
|
+
}
|
62
|
+
|
63
|
+
.container {
|
64
|
+
text-align: center;
|
65
|
+
margin-top: 100px;
|
66
|
+
padding: 20px;
|
67
|
+
}
|
68
|
+
|
69
|
+
.container__form {
|
70
|
+
width: 400px;
|
71
|
+
margin: auto;
|
72
|
+
}
|
73
|
+
</style>
|
5
74
|
</head>
|
6
75
|
<body>
|
7
76
|
|
8
|
-
<
|
77
|
+
<main class="container" role="main">
|
78
|
+
<header>
|
79
|
+
<h1>Shopify App — Installation</h1>
|
80
|
+
<p class="subhead">
|
81
|
+
<label for="shop">Please enter the “myshopify” domain of your store</label>
|
82
|
+
</p>
|
83
|
+
</header>
|
9
84
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
85
|
+
<div class="container__form">
|
86
|
+
<form method="GET" action="login">
|
87
|
+
<input type="text" name="shop" id="shop" placeholder="blabla.myshopify.com"/>
|
88
|
+
<button type="submit">Install</button>
|
89
|
+
</form>
|
90
|
+
</div>
|
91
|
+
</main>
|
15
92
|
|
16
93
|
</body>
|
17
94
|
</html>
|
@@ -76,7 +76,7 @@ module ShopifyApp
|
|
76
76
|
if embedded_app?
|
77
77
|
prepend_to_file(
|
78
78
|
'app/views/home/index.html.erb',
|
79
|
-
File.read(File.expand_path(find_in_source_paths('shopify_app_ready_script.html')))
|
79
|
+
File.read(File.expand_path(find_in_source_paths('shopify_app_ready_script.html.erb')))
|
80
80
|
)
|
81
81
|
end
|
82
82
|
end
|
@@ -1,24 +1,40 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
|
-
<head>
|
4
|
-
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title>Shopify Embedded Example App</title>
|
6
|
+
<%= stylesheet_link_tag 'application' %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
5
9
|
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
<body>
|
11
|
+
<div class="app-wrapper">
|
12
|
+
<div class="app-content">
|
13
|
+
<main role="main">
|
14
|
+
<%= yield %>
|
15
|
+
</main>
|
16
|
+
</div>
|
17
|
+
</div>
|
14
18
|
|
15
|
-
|
16
|
-
<%= javascript_include_tag 'application' %>
|
17
|
-
<%= csrf_meta_tags %>
|
18
|
-
</head>
|
19
|
+
<%= render 'layouts/flash_messages' %>
|
19
20
|
|
20
|
-
<
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
<script src="//cdn.shopify.com/s/assets/external/app.js?<%= Time.now.strftime('%Y%m%d%H') %>"></script>
|
22
|
+
|
23
|
+
<script type="text/javascript">
|
24
|
+
ShopifyApp.init({
|
25
|
+
apiKey: "<%= ShopifyApp.configuration.api_key %>",
|
26
|
+
shopOrigin: "<%= "https://#{ @shop_session.url }" if @shop_session %>",
|
27
|
+
debug: <%= Rails.env.development? ? 'true' : 'false' %>,
|
28
|
+
forceRedirect: false
|
29
|
+
});
|
30
|
+
</script>
|
31
|
+
|
32
|
+
<%= javascript_include_tag 'application', "data-turbolinks-track" => true %>
|
33
|
+
|
34
|
+
<% if content_for?(:javascript) %>
|
35
|
+
<div id="ContentForJavascript" data-turbolinks-temporary>
|
36
|
+
<%= yield :javascript %>
|
37
|
+
</div>
|
38
|
+
<% end %>
|
39
|
+
</body>
|
24
40
|
</html>
|
@@ -1,12 +1,7 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
</td>
|
9
|
-
</tr>
|
10
|
-
<% end %>
|
11
|
-
</tbody>
|
12
|
-
</table>
|
1
|
+
<h2>Products</h2>
|
2
|
+
|
3
|
+
<ul>
|
4
|
+
<% @products.each do |product| %>
|
5
|
+
<li><%= link_to product.title, "https://#{@shop_session.url}/admin/products/#{product.id}", target: "_top" %></li>
|
6
|
+
<% end %>
|
7
|
+
</ul>
|
@@ -1,9 +1,5 @@
|
|
1
1
|
provider :shopify,
|
2
2
|
ShopifyApp.configuration.api_key,
|
3
3
|
ShopifyApp.configuration.secret,
|
4
|
-
|
5
|
-
:
|
6
|
-
|
7
|
-
:callback_url => ShopifyApp.configuration.redirect_uri,
|
8
|
-
|
9
|
-
:scope => ShopifyApp.configuration.scope
|
4
|
+
redirect_uri: ShopifyApp.configuration.redirect_uri,
|
5
|
+
scope: ShopifyApp.configuration.scope
|
@@ -25,7 +25,7 @@ module ShopifyApp
|
|
25
25
|
redirect_to return_address
|
26
26
|
else
|
27
27
|
flash[:error] = "Could not log in to Shopify store."
|
28
|
-
redirect_to
|
28
|
+
redirect_to login_url
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -33,7 +33,7 @@ module ShopifyApp
|
|
33
33
|
session[:shopify] = nil
|
34
34
|
session[:shopify_domain] = nil
|
35
35
|
flash[:notice] = "Successfully logged out."
|
36
|
-
redirect_to
|
36
|
+
redirect_to login_url
|
37
37
|
end
|
38
38
|
|
39
39
|
protected
|
data/lib/shopify_app/version.rb
CHANGED
data/shopify_app.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.add_dependency('rails', '>= 3.1', '< 5.0')
|
12
12
|
|
13
13
|
s.add_runtime_dependency('shopify_api', '~> 4.0.2')
|
14
|
-
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 1.1.
|
14
|
+
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 1.1.11')
|
15
15
|
|
16
16
|
s.add_development_dependency('rake')
|
17
17
|
s.add_development_dependency('byebug')
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.1.
|
53
|
+
version: 1.1.11
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 1.1.
|
60
|
+
version: 1.1.11
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- CONTRIBUTING.md
|
141
141
|
- Gemfile
|
142
142
|
- LICENSE
|
143
|
+
- QUICKSTART.md
|
143
144
|
- README.md
|
144
145
|
- RELEASING
|
145
146
|
- Rakefile
|
@@ -155,7 +156,7 @@ files:
|
|
155
156
|
- lib/generators/shopify_app/install/templates/index.html.erb
|
156
157
|
- lib/generators/shopify_app/install/templates/omniauth.rb
|
157
158
|
- lib/generators/shopify_app/install/templates/shopify_app.rb
|
158
|
-
- lib/generators/shopify_app/install/templates/shopify_app_ready_script.html
|
159
|
+
- lib/generators/shopify_app/install/templates/shopify_app_ready_script.html.erb
|
159
160
|
- lib/generators/shopify_app/install/templates/shopify_provider.rb
|
160
161
|
- lib/generators/shopify_app/install/templates/shopify_session_repository.rb
|
161
162
|
- lib/generators/shopify_app/routes/routes_generator.rb
|