shopify-sinatra-app 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/bin/shopify-sinatra-app-generator +3 -0
- data/lib/generator/lib/app.rb +0 -2
- data/shopify-sinatra-app.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5c6280877cb5f262f0f68438da82e68fd553968
|
4
|
+
data.tar.gz: 29f093aaf57542798dbdd0ecfa5fdc0823bc0ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aab213ea3f6f4dfaaf54a1c5009dd90e3db70a726dd056562159b78d2925daabaeac46d0394bd028685f81917aa4534b2eacd0749a5794a6fdd94d7fd81e9f9
|
7
|
+
data.tar.gz: 7adc98d77829296d23f09a130ca61a02762912606628c5570ae0a93487c862c00d1100b2e067da02bcea419f9dd7b5978fa573b52282f4dc6abc5bc0650cfb9b
|
data/README.md
CHANGED
@@ -127,15 +127,19 @@ note - a flash must be followed by a redirect or it won't work!
|
|
127
127
|
|
128
128
|
Developing
|
129
129
|
----------
|
130
|
+
You can set the application url in the [Shopify Partner area](https://app.shopify.com/services/partners/api_clients) to be `http://localhost:4567/` which will allow you to install your app on a live shop while running it locally.
|
131
|
+
|
132
|
+
When developing locally you'll need to enable unsafe javascripts in your browser for the Embedded App SDK to function. Read more [here](http://docs.shopify.com/embedded-app-sdk/getting-started).
|
133
|
+
|
130
134
|
To run the app locally we use `foreman` which comes with the [Heroku Toolbelt](https://devcenter.heroku.com/articles/quickstart). Foreman handles running our application and setting our credentials as environment variables. To run the application type:
|
131
135
|
|
132
136
|
```
|
133
|
-
foreman
|
137
|
+
foreman run bundle exec rackup config.ru
|
134
138
|
```
|
135
139
|
|
136
|
-
|
140
|
+
Note - we use `foreman run ...` not foreman start because we only want to start the single process that is our app. This means if you add a debugger in your app it will trigger properly in the command line when the debugger is hit. If you don't have any debuggers feel free to use `foreman start -p 4567`.
|
137
141
|
|
138
|
-
|
142
|
+
To debug your app simply add `require 'byebug'` at the top and then type `byebug` where you would like to drop into an interactive session. You may also want to try out Pry.
|
139
143
|
|
140
144
|
While running the app locally you'll be able to test the install and other routes because your browser is aware of your local application but if you want to test a route that listens to a webhook this will not work because Shopify cannot talk to your local web application. You could expose your local application to the web but an easier solution is to use a tool called [Ngrok](https://ngrok.com/). Download Ngrok and run it on port 4567 (or whichever port you are using):
|
141
145
|
|
@@ -145,8 +149,6 @@ While running the app locally you'll be able to test the install and other route
|
|
145
149
|
|
146
150
|
Ngrok will report what address your app is available at, leave Ngrok running and then create your webhook to point to the ngrok url plus your route e.g. `<ngrok url>/webhook_test.json`. Now trigger the webhook you are testing and it will get forwarded through ngrok to your local web application allowing you to use debuggers and repls to complete your code.
|
147
151
|
|
148
|
-
When developing locally you'll need to enable unsafe javascripts in your browser for the Embedded App SDK to function. Read more [here](http://docs.shopify.com/embedded-app-sdk/getting-started).
|
149
|
-
|
150
152
|
|
151
153
|
Deploying
|
152
154
|
---------
|
data/lib/generator/lib/app.rb
CHANGED
@@ -33,8 +33,6 @@ class SinatraApp < Sinatra::Base
|
|
33
33
|
# inside here.
|
34
34
|
def install
|
35
35
|
shopify_session do
|
36
|
-
params = YAML.load(File.read("config/app.yml"))
|
37
|
-
|
38
36
|
# create an uninstall webhook, this webhook gets sent
|
39
37
|
# when your app is uninstalled from a shop. It is good
|
40
38
|
# practice to clean up any data from a shop when they
|
data/shopify-sinatra-app.gemspec
CHANGED