shopify-sinatra-app 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -0
  3. data/CHANGELOG +7 -0
  4. data/Gemfile +1 -29
  5. data/Gemfile.lock +55 -59
  6. data/README.md +6 -5
  7. data/bin/shopify-sinatra-app-generator +51 -28
  8. data/{lib/generator → example}/.gitignore +0 -0
  9. data/{lib/generator → example}/Gemfile +15 -18
  10. data/{lib/generator → example}/Gemfile.lock +61 -58
  11. data/{lib/generator → example}/Procfile +0 -0
  12. data/{lib/generator → example}/README.md +0 -0
  13. data/{lib/generator → example}/Rakefile +0 -1
  14. data/{lib/generator → example}/config.ru +0 -0
  15. data/{lib/generator → example}/config/database.yml +4 -1
  16. data/{lib/generator → example}/db/.keep +0 -0
  17. data/{lib/generator → example}/db/migrate/20140413221328_create_shops.rb +0 -0
  18. data/{lib/generator → example}/db/migrate/20140414042317_add_index_to_shops.rb +0 -0
  19. data/{lib/generator → example}/db/schema.rb +0 -0
  20. data/{lib/generator → example}/db/seeds.rb +0 -0
  21. data/{lib/generator → example}/lib/app.rb +14 -11
  22. data/{lib/generator → example}/public/icon.png +0 -0
  23. data/{lib/generator → example}/public/legend.gif +0 -0
  24. data/{lib/generator → example}/test/app_test.rb +0 -0
  25. data/{lib/generator → example}/test/test_helper.rb +1 -0
  26. data/{lib/generator/views/_top_bar.erb → example/views/_flash_messages.erb} +0 -6
  27. data/example/views/_top_bar.erb +7 -0
  28. data/example/views/home.erb +9 -0
  29. data/{lib/generator → example}/views/install.erb +0 -0
  30. data/{lib/generator → example}/views/layouts/application.erb +2 -0
  31. data/lib/sinatra/shopify-sinatra-app.rb +20 -29
  32. data/shopify-sinatra-app.gemspec +12 -11
  33. data/test.sh +3 -1
  34. metadata +78 -61
  35. data/lib/generator/views/home.erb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fae906100926e37440e36e3c32b544491d343bf
4
- data.tar.gz: 40e0db9fd66ea7bb3486e8409ebfde06583beda8
3
+ metadata.gz: 72cdd06c5ebe172600536e29a0043fd0ddbf02b5
4
+ data.tar.gz: 86216e56a91dcd10c944b1892e6cb63fb4aa08dc
5
5
  SHA512:
6
- metadata.gz: 5cde198192ce18527f0726cc1500939decf625303167e8c125d6a8298660f6c42bf8a3c5b7d67962bb55ed4b2c974bc15d3c5e6a2ad64c6b27270f857e28ed09
7
- data.tar.gz: 7ed43029dc45fbf1b1e25c217575722fb1d960158be508ed15e485009665816f0e000f30807b6251482540b28ca7a674cc7c75ebb55d1d265504ab24c70d4028
6
+ metadata.gz: 8c2501035a0d5668e4931384214c8f147f732abe352ce2cae22e6271ae270688364e320958aeef0251553a00ee7d9cbaa8fd130d01550bfa70b769c0056e0e2d
7
+ data.tar.gz: 4ff8f7249009cd3fbe8d55d5ad6be65892a70cf2c725d85f48bd4c692db4b9e9bd68566c5e90b86d641833bec72a36c6190703952a31516b9eb71ba226a5ac89
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.1.5
5
+
6
+ gemfile:
7
+ - Gemfile
8
+
9
+ script: "./test.sh"
@@ -0,0 +1,7 @@
1
+ 0.2.0
2
+ -----
3
+ * added a SHOPIFY_REDIRECT_URI env param for setting the redirect_uri (was breifly HOSTNAME)
4
+ * add versions to gemfile
5
+ * refactored the generator
6
+ * Changed install method to after_shopify_auth. Implementations of this method must now be idempotent as this will be called anytime the app is auth'd which may be due to just a lost session and not necessarily an install.
7
+ * Always redo the full auth rather than trying to keep track of first time install state vs re-auth
data/Gemfile CHANGED
@@ -1,30 +1,2 @@
1
1
  source 'https://rubygems.org'
2
- ruby '2.1.5'
3
-
4
- gem 'sinatra'
5
- gem 'sinatra-redis'
6
- gem 'sinatra-activerecord'
7
- gem 'sinatra-twitter-bootstrap', require: 'sinatra/twitter-bootstrap'
8
- gem 'rack-flash3', require: 'rack-flash'
9
- gem 'activesupport'
10
- gem 'attr_encrypted'
11
- gem 'foreman'
12
- gem 'rake'
13
-
14
- gem 'resque', '~> 1.22.0'
15
-
16
- gem 'omniauth-shopify-oauth2', '~> 1.1.8'
17
- gem 'shopify_api', '~> 4.0.2'
18
-
19
- group :production do
20
- gem 'pg'
21
- end
22
-
23
- group :development do
24
- gem 'sqlite3'
25
- gem 'rack-test'
26
- gem 'minitest'
27
- gem 'fakeweb'
28
- gem 'mocha', require: false
29
- gem 'byebug'
30
- end
2
+ gemspec
@@ -1,52 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ shopify-sinatra-app (0.1.5)
5
+ activesupport (~> 4.1.1)
6
+ attr_encrypted (~> 1.3.2)
7
+ omniauth-shopify-oauth2 (~> 1.1.11)
8
+ rack-flash3 (~> 1.0.5)
9
+ resque (~> 1.25.2)
10
+ shopify_api (~> 4.0.2)
11
+ sinatra (~> 1.4.6)
12
+ sinatra-activerecord (~> 2.0.9)
13
+ sinatra-redis (~> 0.3.0)
14
+ sinatra-twitter-bootstrap (~> 2.3.3)
15
+
1
16
  GEM
2
17
  remote: https://rubygems.org/
3
18
  specs:
4
- activemodel (4.1.1)
5
- activesupport (= 4.1.1)
19
+ activemodel (4.1.14)
20
+ activesupport (= 4.1.14)
6
21
  builder (~> 3.1)
7
- activerecord (4.1.1)
8
- activemodel (= 4.1.1)
9
- activesupport (= 4.1.1)
22
+ activerecord (4.1.14)
23
+ activemodel (= 4.1.14)
24
+ activesupport (= 4.1.14)
10
25
  arel (~> 5.0.0)
11
26
  activeresource (4.0.0)
12
27
  activemodel (~> 4.0)
13
28
  activesupport (~> 4.0)
14
29
  rails-observers (~> 0.1.1)
15
- activesupport (4.1.1)
30
+ activesupport (4.1.14)
16
31
  i18n (~> 0.6, >= 0.6.9)
17
32
  json (~> 1.7, >= 1.7.7)
18
33
  minitest (~> 5.1)
19
34
  thread_safe (~> 0.1)
20
35
  tzinfo (~> 1.1)
21
36
  arel (5.0.1.20140414130214)
22
- attr_encrypted (1.3.2)
37
+ attr_encrypted (1.3.4)
23
38
  encryptor (>= 1.3.0)
24
39
  builder (3.2.2)
25
- byebug (3.1.2)
26
- columnize (~> 0.8)
27
- debugger-linecache (~> 1.2)
28
- columnize (0.8.9)
29
- debugger-linecache (1.2.0)
30
- dotenv (0.7.0)
31
40
  encryptor (1.3.0)
32
41
  fakeweb (1.3.0)
33
- faraday (0.9.1)
42
+ faraday (0.9.2)
34
43
  multipart-post (>= 1.2, < 3)
35
- foreman (0.64.0)
36
- dotenv (~> 0.7.0)
37
- thor (>= 0.13.6)
38
- hashie (3.4.1)
39
- i18n (0.6.9)
40
- json (1.8.1)
41
- jwt (1.5.0)
44
+ hashie (3.4.3)
45
+ i18n (0.7.0)
46
+ json (1.8.3)
47
+ jwt (1.5.2)
42
48
  metaclass (0.0.4)
43
- minitest (5.3.4)
49
+ minitest (5.8.3)
44
50
  mocha (1.1.0)
45
51
  metaclass (~> 0.0.1)
46
- multi_json (1.10.1)
52
+ mono_logger (1.1.0)
53
+ multi_json (1.11.2)
47
54
  multi_xml (0.5.5)
48
55
  multipart-post (2.0.0)
49
- oauth2 (0.9.4)
56
+ oauth2 (1.0.0)
50
57
  faraday (>= 0.8, < 0.10)
51
58
  jwt (~> 1.0)
52
59
  multi_json (~> 1.3)
@@ -55,14 +62,11 @@ GEM
55
62
  omniauth (1.2.2)
56
63
  hashie (>= 1.2, < 4)
57
64
  rack (~> 1.0)
58
- omniauth-oauth2 (1.1.2)
59
- faraday (>= 0.8, < 0.10)
60
- multi_json (~> 1.3)
61
- oauth2 (~> 0.9.3)
65
+ omniauth-oauth2 (1.4.0)
66
+ oauth2 (~> 1.0)
62
67
  omniauth (~> 1.2)
63
- omniauth-shopify-oauth2 (1.1.8)
64
- omniauth-oauth2 (~> 1.1.1)
65
- pg (0.17.1)
68
+ omniauth-shopify-oauth2 (1.1.11)
69
+ omniauth-oauth2 (~> 1.2)
66
70
  rack (1.5.2)
67
71
  rack-flash3 (1.0.5)
68
72
  rack
@@ -73,32 +77,33 @@ GEM
73
77
  rails-observers (0.1.2)
74
78
  activemodel (~> 4.0)
75
79
  rake (10.3.2)
76
- redis (3.0.7)
77
- redis-namespace (1.4.1)
78
- redis (~> 3.0.4)
79
- resque (1.22.0)
80
+ redis (3.2.2)
81
+ redis-namespace (1.5.2)
82
+ redis (~> 3.0, >= 3.0.4)
83
+ resque (1.25.2)
84
+ mono_logger (~> 1.0)
80
85
  multi_json (~> 1.0)
81
- redis-namespace (~> 1.0)
86
+ redis-namespace (~> 1.3)
82
87
  sinatra (>= 0.9.2)
83
88
  vegas (~> 0.1.2)
84
- shopify_api (4.0.2)
89
+ shopify_api (4.0.7)
85
90
  activeresource
86
- sinatra (1.4.5)
91
+ rack
92
+ sinatra (1.4.6)
87
93
  rack (~> 1.4)
88
94
  rack-protection (~> 1.4)
89
- tilt (~> 1.3, >= 1.3.4)
90
- sinatra-activerecord (2.0.2)
95
+ tilt (>= 1.3, < 3)
96
+ sinatra-activerecord (2.0.9)
91
97
  activerecord (>= 3.2)
92
98
  sinatra (~> 1.0)
93
99
  sinatra-redis (0.3.0)
94
100
  redis
95
101
  sinatra (>= 0.9.4)
96
- sinatra-twitter-bootstrap (2.3.3)
97
- sqlite3 (1.3.9)
98
- thor (0.18.1)
99
- thread_safe (0.3.4)
100
- tilt (1.4.1)
101
- tzinfo (1.2.1)
102
+ sinatra-twitter-bootstrap (2.3.4)
103
+ sqlite3 (1.3.11)
104
+ thread_safe (0.3.5)
105
+ tilt (2.0.1)
106
+ tzinfo (1.2.2)
102
107
  thread_safe (~> 0.1)
103
108
  vegas (0.1.11)
104
109
  rack (>= 1.0.0)
@@ -107,22 +112,13 @@ PLATFORMS
107
112
  ruby
108
113
 
109
114
  DEPENDENCIES
110
- activesupport
111
- attr_encrypted
112
- byebug
113
115
  fakeweb
114
- foreman
115
116
  minitest
116
117
  mocha
117
- omniauth-shopify-oauth2 (~> 1.1.8)
118
- pg
119
- rack-flash3
120
118
  rack-test
121
119
  rake
122
- resque (~> 1.22.0)
123
- shopify_api (~> 4.0.2)
124
- sinatra
125
- sinatra-activerecord
126
- sinatra-redis
127
- sinatra-twitter-bootstrap
120
+ shopify-sinatra-app!
128
121
  sqlite3
122
+
123
+ BUNDLED WITH
124
+ 1.10.6
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- shopify-sinatra-app
1
+ shopify-sinatra-app [![Build Status](https://travis-ci.org/kevinhughes27/shopify-tax-receipts.svg)](https://travis-ci.org/kevinhughes27/shopify-sinatra-app)
2
2
  ===================
3
3
 
4
4
  "A classy shopify app"
@@ -57,7 +57,7 @@ This will create a new skeleton shopify-sinatra-app. The generator will create s
57
57
 
58
58
  ### Setting the app to use your Shopify API credentials
59
59
 
60
- You'll need to create a Shopify Partner Account and a new application. You can make an account [here](http://www.shopify.ca/partners) and see this [tutorial](http://docs.shopify.com/api/the-basics/getting-started) for creating a new application.
60
+ You'll need to create a Shopify Partner Account and a new application. You can make an account [here](http://www.shopify.ca/partners) and see this [tutorial](http://docs.shopify.com/api/the-basics/getting-started) for creating a new application. This app uses the default redirect_uri from omniauth `<your domain>/auth/shopify/callback` so set it accordingly when creating your app.
61
61
 
62
62
  Note - The shopify-sinatra-app creates an embedded app! You need change the embedded setting to `enabled` in the [Shopify Partner area](https://app.shopify.com/services/partners/api_clients) for your app. If you don't want your app to be embedded then remove the related code in `layout/application.erb` and delete the `layout/_top_bar.erb` file and the references to it in the other views.
63
63
 
@@ -66,6 +66,7 @@ After creating your new application you need to edit the `.env` file and add the
66
66
  ```
67
67
  SHOPIFY_API_KEY=<your api key>
68
68
  SHOPIFY_SHARED_SECRET=<your shared secret>
69
+ SHOPIFY_REDIRECT_URI="<your redirect_uri>"
69
70
  SECRET=<generate a random string to encrypt credentials with>
70
71
  ```
71
72
 
@@ -111,7 +112,7 @@ class OrderWebhookJob
111
112
  end
112
113
  ```
113
114
 
114
- **install** - This is a private method provided with the framework that gets called when the app is authorized for the first time. You should fill this method in with anything you need to initialize on install, for example webhooks and services on Shopify or any other database models you have created specific to a shop.
115
+ **after_shopify_auth** - This is a private method provided with the framework that gets called whenever the app is authorized. You should fill this method in with anything you need to initialize, for example webhooks and services on Shopify or any other database models you have created specific to a shop. Note that this method will be called anytime the auth flow is completed so this method should be idempotent (running it twice has the same effect as running it once).
115
116
 
116
117
  **logout** - This method clears the current session
117
118
 
@@ -125,7 +126,7 @@ end
125
126
 
126
127
  shopify-sinatra-app includes sinatra/activerecord for creating models that can be persisted in the database. You might want to read more about sinatra/activerecord and the methods it makes available to you: [https://github.com/janko-m/sinatra-activerecord](https://github.com/janko-m/sinatra-activerecord)
127
128
 
128
- shopify-sinatra-app also includes `rack-flash3` and the flash messages are forwarded to the Shopify Embedded App SDK (see the code in `views/layouts/application.erb`). Flash messages are useful for signalling to your users that a request was successful without changing the page. The following is an example of how to use a flash message in a route:
129
+ shopify-sinatra-app also includes `rack-flash3` and the flash messages are forwarded to the Shopify Embedded App SDK (see the code in `views/layouts/application.erb`). Flash messages are useful for signaling to your users that a request was successful without changing the page. The following is an example of how to use a flash message in a route:
129
130
 
130
131
  ```
131
132
  post '/flash_message' do
@@ -158,7 +159,7 @@ While running the app locally you'll be able to test the install and other route
158
159
  ./ngrok 4567
159
160
  ```
160
161
 
161
- 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.
162
+ 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.
162
163
 
163
164
  Testing
164
165
  -------
@@ -1,60 +1,83 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'fileutils'
3
3
 
4
- working_dir = Dir.pwd
4
+ class Generator
5
+ attr_reader :spec, :app_dir, :example_dir
5
6
 
6
- spec = Gem::Specification.find_by_name('shopify-sinatra-app')
7
- gem_root = spec.gem_dir
8
- gem_lib = gem_root + '/lib'
7
+ def initialize(app_name)
8
+ @spec = Gem::Specification.find_by_name('shopify-sinatra-app')
9
+ gem_root = spec.gem_dir
10
+ @example_dir = gem_root + '/example'
9
11
 
10
- generator_dir = gem_lib + '/generator'
12
+ working_dir = Dir.pwd
13
+ @app_dir = working_dir + '/' + app_name
11
14
 
12
- if ARGV.length < 2
13
- puts "Usage:\n./shopify-sinatra-app new <app_name>"
14
- else
15
- app_name = ARGV[1]
16
- app_dir = working_dir + '/' + app_name
15
+ log "Generating new app: #{app_name}"
16
+ log "fullpath: #{app_dir}"
17
+ end
17
18
 
18
- puts "Generating new app: #{app_name}"
19
- puts "fullpath: #{app_dir}"
19
+ def run
20
+ if Dir.exists? app_dir
21
+ log 'App directory alread exists, pick a new app name or delete the existing folder'
22
+ return
23
+ end
20
24
 
21
- begin
22
- Dir.mkdir(app_dir)
25
+ copy_example_app
26
+ create_dot_env
27
+ sub_latest_version
28
+ bundle_install
29
+ migrate_database
30
+ end
23
31
 
24
- FileUtils.cp_r(generator_dir + '/config', app_dir + '/config')
25
- FileUtils.cp_r(generator_dir + '/db', app_dir + '/db')
26
- FileUtils.cp_r(generator_dir + '/lib', app_dir + '/lib')
27
- FileUtils.cp_r(generator_dir + '/public', app_dir + '/public')
28
- FileUtils.cp_r(generator_dir + '/views', app_dir + '/views')
29
- FileUtils.cp_r(generator_dir + '/test', app_dir + '/test')
32
+ private
30
33
 
31
- FileUtils.cp(generator_dir + '/.gitignore', app_dir + '/.gitignore')
32
- FileUtils.cp(generator_dir + '/config.ru', app_dir + '/config.ru')
33
- FileUtils.cp(generator_dir + '/Procfile', app_dir + '/Procfile')
34
- FileUtils.cp(generator_dir + '/Rakefile', app_dir + '/Rakefile')
35
- FileUtils.cp(generator_dir + '/Gemfile', app_dir + '/Gemfile')
36
- FileUtils.cp(generator_dir + '/README.md', app_dir + '/README.md')
34
+ def copy_example_app
35
+ FileUtils.cp_r(example_dir, app_dir)
36
+ end
37
37
 
38
+ def create_dot_env
38
39
  FileUtils.touch(app_dir + '/.env')
39
40
  file = File.open(app_dir + '/.env', 'w')
40
41
  file.write("SHOPIFY_API_KEY=your_api_key\n")
41
42
  file.write("SHOPIFY_SHARED_SECRET=your_shared_secret\n")
43
+ file.write("SHOPIFY_REDIRECT_URI=your_redirect_uri\n")
42
44
  file.write("SECRET=random_string_to_encrypt_credentials_with\n")
43
45
  file.close
46
+ end
47
+
48
+ def sub_latest_version
49
+ file_name = "#{app_dir}/Gemfile"
50
+ text = File.read(file_name)
51
+ new_contents = text.gsub("gem 'shopify-sinatra-app', github: 'kevinhughes27/shopify-sinatra-app'", "gem 'shopify-sinatra-app', '~> #{spec.version}'")
52
+ File.open(file_name, "w") {|file| file.puts new_contents }
53
+ end
44
54
 
55
+ def bundle_install
45
56
  Dir.chdir(app_dir)
46
57
 
47
58
  pipe = IO.popen('bundle install')
48
59
  while (line = pipe.gets)
49
60
  print line
50
61
  end
62
+ end
63
+
64
+ def migrate_database
65
+ Dir.chdir(app_dir)
51
66
 
52
67
  pipe = IO.popen('bundle exec rake db:migrate')
53
68
  while (line = pipe.gets)
54
69
  print line
55
70
  end
71
+ end
56
72
 
57
- rescue Errno::EEXIST => e
58
- puts 'App directory alread exists, pick a new app name or delete the existing folder'
73
+ def log(msg)
74
+ puts msg
59
75
  end
60
76
  end
77
+
78
+ if ARGV.length < 2
79
+ puts "Usage:\nshopify-sinatra-app-generator new <app_name>"
80
+ else
81
+ app_name = ARGV[1]
82
+ Generator.new(app_name).run
83
+ end
File without changes
@@ -1,32 +1,29 @@
1
1
  source 'https://rubygems.org'
2
- ruby '2.0.0'
2
+ ruby "2.1.5"
3
3
 
4
- gem 'sinatra'
5
- gem 'sinatra-redis'
4
+ gem 'shopify-sinatra-app', github: 'kevinhughes27/shopify-sinatra-app', branch: 'master'
6
5
  gem 'sinatra-activerecord'
7
6
  gem 'sinatra-twitter-bootstrap', require: 'sinatra/twitter-bootstrap'
8
7
  gem 'rack-flash3', require: 'rack-flash'
9
- gem 'activesupport'
10
- gem 'attr_encrypted'
11
- gem 'foreman'
12
- gem 'rake'
13
-
14
- gem 'resque', '~> 1.22.0'
15
-
16
- gem 'shopify-sinatra-app'
17
- gem 'omniauth-shopify-oauth2'
18
- gem 'shopify_api'
19
8
 
20
9
  group :production do
21
10
  gem 'pg'
22
11
  end
23
12
 
24
- group :development do
13
+ group :development, :test do
25
14
  gem 'sqlite3'
26
- gem 'rack-test'
27
- gem 'minitest'
28
- gem 'fakeweb'
29
- gem 'mocha', require: false
30
15
  gem 'byebug'
16
+ end
17
+
18
+ group :development do
19
+ gem 'rake'
20
+ gem 'foreman'
31
21
  gem 'dotenv'
32
22
  end
23
+
24
+ group :test do
25
+ gem 'mocha', require: false
26
+ gem 'minitest'
27
+ gem 'rack-test'
28
+ gem 'fakeweb'
29
+ end
@@ -1,25 +1,42 @@
1
+ GIT
2
+ remote: git://github.com/kevinhughes27/shopify-sinatra-app.git
3
+ revision: fbc7e6e51ad48cf68fa4434ab34d80ec59e90b52
4
+ branch: master
5
+ specs:
6
+ shopify-sinatra-app (0.2.0)
7
+ activesupport (~> 4.1.1)
8
+ attr_encrypted (~> 1.3.2)
9
+ omniauth-shopify-oauth2 (~> 1.1.11)
10
+ rack-flash3 (~> 1.0.5)
11
+ resque (~> 1.25.2)
12
+ shopify_api (~> 4.0.2)
13
+ sinatra (~> 1.4.6)
14
+ sinatra-activerecord (~> 2.0.9)
15
+ sinatra-redis (~> 0.3.0)
16
+ sinatra-twitter-bootstrap (~> 2.3.3)
17
+
1
18
  GEM
2
19
  remote: https://rubygems.org/
3
20
  specs:
4
- activemodel (4.1.2)
5
- activesupport (= 4.1.2)
21
+ activemodel (4.1.14)
22
+ activesupport (= 4.1.14)
6
23
  builder (~> 3.1)
7
- activerecord (4.1.2)
8
- activemodel (= 4.1.2)
9
- activesupport (= 4.1.2)
24
+ activerecord (4.1.14)
25
+ activemodel (= 4.1.14)
26
+ activesupport (= 4.1.14)
10
27
  arel (~> 5.0.0)
11
28
  activeresource (4.0.0)
12
29
  activemodel (~> 4.0)
13
30
  activesupport (~> 4.0)
14
31
  rails-observers (~> 0.1.1)
15
- activesupport (4.1.2)
32
+ activesupport (4.1.14)
16
33
  i18n (~> 0.6, >= 0.6.9)
17
34
  json (~> 1.7, >= 1.7.7)
18
35
  minitest (~> 5.1)
19
36
  thread_safe (~> 0.1)
20
37
  tzinfo (~> 1.1)
21
38
  arel (5.0.1.20140414130214)
22
- attr_encrypted (1.3.2)
39
+ attr_encrypted (1.3.4)
23
40
  encryptor (>= 1.3.0)
24
41
  builder (3.2.2)
25
42
  byebug (3.1.2)
@@ -30,87 +47,76 @@ GEM
30
47
  dotenv (0.7.0)
31
48
  encryptor (1.3.0)
32
49
  fakeweb (1.3.0)
33
- faraday (0.9.0)
50
+ faraday (0.9.2)
34
51
  multipart-post (>= 1.2, < 3)
35
52
  foreman (0.64.0)
36
53
  dotenv (~> 0.7.0)
37
54
  thor (>= 0.13.6)
38
- hashie (2.1.2)
39
- i18n (0.6.11)
40
- json (1.8.1)
41
- jwt (1.0.0)
55
+ hashie (3.4.3)
56
+ i18n (0.7.0)
57
+ json (1.8.3)
58
+ jwt (1.5.2)
42
59
  metaclass (0.0.4)
43
- minitest (5.4.0)
60
+ minitest (5.8.3)
44
61
  mocha (1.1.0)
45
62
  metaclass (~> 0.0.1)
46
- multi_json (1.10.1)
63
+ mono_logger (1.1.0)
64
+ multi_json (1.11.2)
47
65
  multi_xml (0.5.5)
48
66
  multipart-post (2.0.0)
49
- oauth2 (0.9.4)
67
+ oauth2 (1.0.0)
50
68
  faraday (>= 0.8, < 0.10)
51
69
  jwt (~> 1.0)
52
70
  multi_json (~> 1.3)
53
71
  multi_xml (~> 0.5)
54
72
  rack (~> 1.2)
55
- omniauth (1.2.1)
56
- hashie (>= 1.2, < 3)
73
+ omniauth (1.2.2)
74
+ hashie (>= 1.2, < 4)
57
75
  rack (~> 1.0)
58
- omniauth-oauth2 (1.1.2)
59
- faraday (>= 0.8, < 0.10)
60
- multi_json (~> 1.3)
61
- oauth2 (~> 0.9.3)
76
+ omniauth-oauth2 (1.4.0)
77
+ oauth2 (~> 1.0)
62
78
  omniauth (~> 1.2)
63
- omniauth-shopify-oauth2 (1.1.7)
64
- omniauth-oauth2 (~> 1.1.1)
79
+ omniauth-shopify-oauth2 (1.1.11)
80
+ omniauth-oauth2 (~> 1.2)
65
81
  pg (0.17.1)
66
- rack (1.5.2)
82
+ rack (1.6.4)
67
83
  rack-flash3 (1.0.5)
68
84
  rack
69
85
  rack-protection (1.5.3)
70
86
  rack
71
- rack-test (0.6.2)
87
+ rack-test (0.6.3)
72
88
  rack (>= 1.0)
73
89
  rails-observers (0.1.2)
74
90
  activemodel (~> 4.0)
75
91
  rake (10.3.2)
76
- redis (3.1.0)
77
- redis-namespace (1.5.0)
92
+ redis (3.2.2)
93
+ redis-namespace (1.5.2)
78
94
  redis (~> 3.0, >= 3.0.4)
79
- resque (1.22.0)
95
+ resque (1.25.2)
96
+ mono_logger (~> 1.0)
80
97
  multi_json (~> 1.0)
81
- redis-namespace (~> 1.0)
98
+ redis-namespace (~> 1.3)
82
99
  sinatra (>= 0.9.2)
83
100
  vegas (~> 0.1.2)
84
- shopify-sinatra-app (0.1.0)
85
- activesupport
86
- attr_encrypted
87
- omniauth-shopify-oauth2
88
- rack-flash3
89
- resque (~> 1.22.0)
90
- shopify_api
91
- sinatra
92
- sinatra-activerecord
93
- sinatra-redis
94
- sinatra-twitter-bootstrap
95
- shopify_api (3.2.1)
96
- activeresource (>= 3.0.0)
97
- thor (>= 0.14.4)
98
- sinatra (1.4.5)
101
+ shopify_api (4.0.7)
102
+ activeresource
103
+ rack
104
+ sinatra (1.4.6)
99
105
  rack (~> 1.4)
100
106
  rack-protection (~> 1.4)
101
- tilt (~> 1.3, >= 1.3.4)
102
- sinatra-activerecord (2.0.2)
107
+ tilt (>= 1.3, < 3)
108
+ sinatra-activerecord (2.0.9)
103
109
  activerecord (>= 3.2)
104
110
  sinatra (~> 1.0)
105
111
  sinatra-redis (0.3.0)
106
112
  redis
107
113
  sinatra (>= 0.9.4)
108
- sinatra-twitter-bootstrap (2.3.3)
114
+ sinatra-twitter-bootstrap (2.3.4)
109
115
  sqlite3 (1.3.9)
110
116
  thor (0.19.1)
111
- thread_safe (0.3.4)
112
- tilt (1.4.1)
113
- tzinfo (1.2.1)
117
+ thread_safe (0.3.5)
118
+ tilt (2.0.1)
119
+ tzinfo (1.2.2)
114
120
  thread_safe (~> 0.1)
115
121
  vegas (0.1.11)
116
122
  rack (>= 1.0.0)
@@ -119,23 +125,20 @@ PLATFORMS
119
125
  ruby
120
126
 
121
127
  DEPENDENCIES
122
- activesupport
123
- attr_encrypted
124
128
  byebug
129
+ dotenv
125
130
  fakeweb
126
131
  foreman
127
132
  minitest
128
133
  mocha
129
- omniauth-shopify-oauth2
130
134
  pg
131
135
  rack-flash3
132
136
  rack-test
133
137
  rake
134
- resque (~> 1.22.0)
135
- shopify-sinatra-app
136
- shopify_api
137
- sinatra
138
+ shopify-sinatra-app!
138
139
  sinatra-activerecord
139
- sinatra-redis
140
140
  sinatra-twitter-bootstrap
141
141
  sqlite3
142
+
143
+ BUNDLED WITH
144
+ 1.10.6
File without changes
File without changes
@@ -1,5 +1,4 @@
1
1
  require 'sinatra/activerecord/rake'
2
- require 'resque/tasks'
3
2
  require 'rake/testtask'
4
3
  require './lib/app'
5
4
 
File without changes
@@ -1,8 +1,11 @@
1
1
  development:
2
2
  adapter: sqlite3
3
- database: db/shopify_app.sqlite3
3
+ database: db/development.sqlite3
4
4
  pool: 5
5
5
 
6
+ production:
7
+ url: <%= ENV['DATABASE_URL'] %>
8
+
6
9
  test:
7
10
  adapter: sqlite3
8
11
  database: "db/test.sqlite3"
File without changes
File without changes
File without changes
@@ -31,20 +31,23 @@ class SinatraApp < Sinatra::Base
31
31
  # This method gets called when your app is installed.
32
32
  # setup any webhooks or services you need on Shopify
33
33
  # inside here.
34
- def install
35
- shopify_session do
34
+ def after_shopify_auth
35
+ # shopify_session do
36
36
  # create an uninstall webhook, this webhook gets sent
37
37
  # when your app is uninstalled from a shop. It is good
38
38
  # practice to clean up any data from a shop when they
39
- # uninstall your app.
40
- uninstall_webhook = ShopifyAPI::Webhook.new(
41
- topic: 'app/uninstalled',
42
- address: "#{base_url}/uninstall",
43
- format: 'json'
44
- )
45
- uninstall_webhook.save
46
- end
39
+ # uninstall your app:
47
40
 
48
- redirect '/'
41
+ # uninstall_webhook = ShopifyAPI::Webhook.new(
42
+ # topic: 'app/uninstalled',
43
+ # address: "#{base_url}/uninstall",
44
+ # format: 'json'
45
+ # )
46
+ # begin
47
+ # uninstall_webhook.save!
48
+ # rescue => e
49
+ # raise unless uninstall_webhook.persisted?
50
+ # end
51
+ # end
49
52
  end
50
53
  end
@@ -1,4 +1,5 @@
1
1
  ENV['RACK_ENV'] = 'test'
2
+ ENV['SHOPIFY_REDIRECT_URI'] = 'http://localhost:4567'
2
3
  ENV['SECRET'] = 'secret'
3
4
 
4
5
  require 'minitest/autorun'
@@ -1,10 +1,5 @@
1
1
  <script type="text/javascript">
2
-
3
2
  ShopifyApp.ready(function(){
4
- ShopifyApp.Bar.initialize({
5
- icon: '<%= "#{base_url}/icon.png" %>'
6
- });
7
-
8
3
  <% if flash[:notice] %>
9
4
  ShopifyApp.flashNotice("<%= flash[:notice] %>");
10
5
  <% end %>
@@ -12,6 +7,5 @@
12
7
  <% if flash[:error] %>
13
8
  ShopifyApp.flashError("<%= flash[:error] %>");
14
9
  <% end %>
15
-
16
10
  });
17
11
  </script>
@@ -0,0 +1,7 @@
1
+ <script type="text/javascript">
2
+ ShopifyApp.ready(function(){
3
+ ShopifyApp.Bar.initialize({
4
+ icon: '<%= "#{base_url}/icon.png" %>'
5
+ });
6
+ });
7
+ </script>
@@ -0,0 +1,9 @@
1
+ <h3>Shopify Sinatra App</h3>
2
+ <p>Welcome!</p>
3
+
4
+ <h3>Products</h3>
5
+ <ul>
6
+ <% @products.each do |product| %>
7
+ <li><a href=<%="#{current_shop_url}/admin/products/#{product.id}"%> target="_blank"> <%= product.id %> </a></li>
8
+ <% end %>
9
+ </ul>
@@ -15,6 +15,8 @@
15
15
 
16
16
  <body>
17
17
  <div class="container">
18
+ <%= erb :'_top_bar', layout: false, locals: locals %>
19
+ <%= erb :'_flash_messages', layout: false, locals: locals %>
18
20
  <%= yield %>
19
21
  </div>
20
22
  </body>
@@ -14,8 +14,9 @@ require 'omniauth-shopify-oauth2'
14
14
  module Sinatra
15
15
  module Shopify
16
16
  module Methods
17
- def install
18
- fail NotImplementedError
17
+
18
+ # designed to be overriden
19
+ def after_shopify_auth
19
20
  end
20
21
 
21
22
  def logout
@@ -23,7 +24,7 @@ module Sinatra
23
24
  end
24
25
 
25
26
  def base_url
26
- @base_url ||= "https://#{request.env['HTTP_HOST']}"
27
+ @base_url ||= "#{request_protocol}://#{request.env['HTTP_HOST']}"
27
28
  end
28
29
 
29
30
  def current_shop
@@ -40,11 +41,13 @@ module Sinatra
40
41
  end
41
42
 
42
43
  def shopify_session(&blk)
44
+ return_to = request.env['sinatra.route'].split(' ').last
45
+
43
46
  if !session.key?(:shopify)
44
- get_session
47
+ authenticate(return_to)
45
48
  elsif params[:shop].present? && session[:shopify][:shop] != sanitize_shop_param(params)
46
49
  logout
47
- get_session
50
+ authenticate(return_to)
48
51
  else
49
52
  shop_name = session[:shopify][:shop]
50
53
  token = session[:shopify][:token]
@@ -80,20 +83,8 @@ module Sinatra
80
83
 
81
84
  private
82
85
 
83
- def get_session
84
- shop_name = sanitize_shop_param(params)
85
- shop = Shop.find_by(name: shop_name)
86
-
87
- return_to = request.env['sinatra.route'].split(' ').last
88
-
89
- if shop.present? && shop.token.present?
90
- session[:shopify] ||= {}
91
- session[:shopify][:shop] = shop.name
92
- session[:shopify][:token] = shop.token
93
- redirect return_to
94
- else
95
- authenticate(return_to)
96
- end
86
+ def request_protocol
87
+ request.secure? ? 'https' : 'http'
97
88
  end
98
89
 
99
90
  def authenticate(return_to = '/')
@@ -168,6 +159,7 @@ module Sinatra
168
159
 
169
160
  app.set :api_key, ENV['SHOPIFY_API_KEY']
170
161
  app.set :shared_secret, ENV['SHOPIFY_SHARED_SECRET']
162
+ app.set :redirect_uri, ENV['SHOPIFY_REDIRECT_URI']
171
163
  app.set :secret, ENV['SECRET']
172
164
 
173
165
  app.use Rack::Flash, sweep: true
@@ -189,6 +181,7 @@ module Sinatra
189
181
  provider :shopify,
190
182
  app.settings.api_key,
191
183
  app.settings.shared_secret,
184
+ redirect_uri: app.settings.redirect_uri,
192
185
 
193
186
  scope: app.settings.scope,
194
187
 
@@ -219,18 +212,16 @@ module Sinatra
219
212
  shop_name = params['shop']
220
213
  token = request.env['omniauth.auth']['credentials']['token']
221
214
 
222
- session[:shopify] ||= {}
223
- session[:shopify][:shop] = shop_name
224
- session[:shopify][:token] = token
215
+ shop = Shop.find_or_initialize_by(name: shop_name)
216
+ shop.token = token
217
+ shop.save!
225
218
 
226
- shop = Shop.find_by(name: shop_name)
219
+ session[:shopify] = {
220
+ shop: shop_name,
221
+ token: token
222
+ }
227
223
 
228
- if shop.nil?
229
- Shop.create(name: shop_name, token: token)
230
- install
231
- elsif
232
- shop.update_attributes(token: token)
233
- end
224
+ after_shopify_auth()
234
225
 
235
226
  return_to = env['omniauth.params']['return_to']
236
227
  redirect return_to
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'shopify-sinatra-app'
3
- s.version = '0.1.5'
3
+ s.version = '0.2.0'
4
4
 
5
5
  s.summary = 'A classy shopify app'
6
6
  s.description = 'A Sinatra extension for building Shopify Apps. Akin to the shopify_app gem but for Sinatra'
@@ -13,21 +13,22 @@ Gem::Specification.new do |s|
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.executables << 'shopify-sinatra-app-generator'
15
15
 
16
- s.add_runtime_dependency 'sinatra'
17
- s.add_runtime_dependency 'sinatra-redis'
18
- s.add_runtime_dependency 'sinatra-activerecord'
19
- s.add_runtime_dependency 'sinatra-twitter-bootstrap'
20
- s.add_runtime_dependency 'rack-flash3'
21
- s.add_runtime_dependency 'activesupport'
22
- s.add_runtime_dependency 'attr_encrypted'
16
+ s.add_runtime_dependency 'sinatra', '~> 1.4.6'
17
+ s.add_runtime_dependency 'sinatra-redis', '~> 0.3.0'
18
+ s.add_runtime_dependency 'sinatra-activerecord', '~> 2.0.9'
19
+ s.add_runtime_dependency 'sinatra-twitter-bootstrap', '~> 2.3.3'
20
+ s.add_runtime_dependency 'rack-flash3', '~> 1.0.5'
21
+ s.add_runtime_dependency 'activesupport', '~> 4.1.1'
22
+ s.add_runtime_dependency 'attr_encrypted', '~> 1.3.2'
23
23
 
24
- s.add_runtime_dependency 'resque', '~> 1.22.0'
24
+ s.add_runtime_dependency 'resque', '~> 1.25.2'
25
25
 
26
- s.add_runtime_dependency 'shopify_api'
27
- s.add_runtime_dependency 'omniauth-shopify-oauth2'
26
+ s.add_runtime_dependency 'shopify_api', '~> 4.0.2'
27
+ s.add_runtime_dependency 'omniauth-shopify-oauth2', '~> 1.1.11'
28
28
 
29
29
  s.add_development_dependency 'rake'
30
30
  s.add_development_dependency 'sqlite3'
31
+ s.add_development_dependency 'minitest'
31
32
  s.add_development_dependency 'rack-test'
32
33
  s.add_development_dependency 'fakeweb'
33
34
  s.add_development_dependency 'mocha'
data/test.sh CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
- cd lib/generator/test
3
+ cd example
4
4
 
5
+ bundle install
6
+ bundle exec rake db:migrate
5
7
  bundle exec rake test:prepare
6
8
  bundle exec rake test
7
9
 
metadata CHANGED
@@ -1,149 +1,163 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-sinatra-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Hughes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.4.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.4.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sinatra-redis
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sinatra-activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 2.0.9
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 2.0.9
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sinatra-twitter-bootstrap
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 2.3.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 2.3.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rack-flash3
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 1.0.5
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 1.0.5
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: activesupport
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 4.1.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 4.1.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: attr_encrypted
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 1.3.2
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 1.3.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: resque
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.22.0
117
+ version: 1.25.2
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.22.0
124
+ version: 1.25.2
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: shopify_api
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: 4.0.2
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: 4.0.2
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: omniauth-shopify-oauth2
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 1.1.11
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 1.1.11
153
+ - !ruby/object:Gem::Dependency
154
+ name: rake
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - ">="
144
158
  - !ruby/object:Gem::Version
145
159
  version: '0'
146
- type: :runtime
160
+ type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
@@ -151,7 +165,7 @@ dependencies:
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
- name: rake
168
+ name: sqlite3
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - ">="
@@ -165,7 +179,7 @@ dependencies:
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
- name: sqlite3
182
+ name: minitest
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - ">="
@@ -229,33 +243,36 @@ extensions: []
229
243
  extra_rdoc_files: []
230
244
  files:
231
245
  - ".gitignore"
246
+ - ".travis.yml"
247
+ - CHANGELOG
232
248
  - Gemfile
233
249
  - Gemfile.lock
234
250
  - LICENSE
235
251
  - README.md
236
252
  - bin/shopify-sinatra-app-generator
237
- - lib/generator/.gitignore
238
- - lib/generator/Gemfile
239
- - lib/generator/Gemfile.lock
240
- - lib/generator/Procfile
241
- - lib/generator/README.md
242
- - lib/generator/Rakefile
243
- - lib/generator/config.ru
244
- - lib/generator/config/database.yml
245
- - lib/generator/db/.keep
246
- - lib/generator/db/migrate/20140413221328_create_shops.rb
247
- - lib/generator/db/migrate/20140414042317_add_index_to_shops.rb
248
- - lib/generator/db/schema.rb
249
- - lib/generator/db/seeds.rb
250
- - lib/generator/lib/app.rb
251
- - lib/generator/public/icon.png
252
- - lib/generator/public/legend.gif
253
- - lib/generator/test/app_test.rb
254
- - lib/generator/test/test_helper.rb
255
- - lib/generator/views/_top_bar.erb
256
- - lib/generator/views/home.erb
257
- - lib/generator/views/install.erb
258
- - lib/generator/views/layouts/application.erb
253
+ - example/.gitignore
254
+ - example/Gemfile
255
+ - example/Gemfile.lock
256
+ - example/Procfile
257
+ - example/README.md
258
+ - example/Rakefile
259
+ - example/config.ru
260
+ - example/config/database.yml
261
+ - example/db/.keep
262
+ - example/db/migrate/20140413221328_create_shops.rb
263
+ - example/db/migrate/20140414042317_add_index_to_shops.rb
264
+ - example/db/schema.rb
265
+ - example/db/seeds.rb
266
+ - example/lib/app.rb
267
+ - example/public/icon.png
268
+ - example/public/legend.gif
269
+ - example/test/app_test.rb
270
+ - example/test/test_helper.rb
271
+ - example/views/_flash_messages.erb
272
+ - example/views/_top_bar.erb
273
+ - example/views/home.erb
274
+ - example/views/install.erb
275
+ - example/views/layouts/application.erb
259
276
  - lib/sinatra/shopify-sinatra-app.rb
260
277
  - shopify-sinatra-app.gemspec
261
278
  - test.sh
@@ -1,17 +0,0 @@
1
- <%= erb :'_top_bar', layout: false, locals: locals %>
2
-
3
- <h3>Shopify Sinatra App</h3>
4
- <p>Welcome!</p>
5
-
6
- <h3>Products</h3>
7
- <table class="table table-striped table-hover">
8
- <tbody>
9
- <% @products.each do |product| %>
10
- <tr>
11
- <td>
12
- <a href=<%="#{current_shop_url}/admin/products/#{product.id}"%> target="_blank"> <%= product.id %> </a>
13
- </td>
14
- </tr>
15
- <% end %>
16
- </tbody>
17
- </table>