hoboken 0.0.1.beta3 → 0.0.1

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: 92e42c10869f91d6dd97bc1f6445bfc441ba7c3f
4
- data.tar.gz: 28fdbb0fd176c28fce090ab5c08694f579cbe3d6
3
+ metadata.gz: 5d2df9dfc9ecc21aa34c95ac8f7f3b91bd3149fd
4
+ data.tar.gz: fc960ac11680b88e5b037fb846bd39896a568227
5
5
  SHA512:
6
- metadata.gz: e9084680cea5d0f1a2cb8c9bb56187bfc16a6f769269aa7d196635fe94e49ada236894b74e3e69f3b94b10f3a3ccde046e262c16fdffbd702c83384f4e61eb65
7
- data.tar.gz: d4e6120ee3d411dff96b3c6cf8374571d79e2175591fc3b2f7ce8166dc9dfa60ae477758c73198f87371ad15a1439bc8060a4c64314c46fde9b5e0330b9ef724
6
+ metadata.gz: e53a838ca0fa1a12c87413deaee61100f4bf100bdda43a6f8fc7450b87b5bbdc81ae79cc7c44b8592d0d27c340674ecfbc34ab338223c78b5cc2962f00c3993a
7
+ data.tar.gz: 33401a4e2df9ae38bfc7618dddd4512a4eab11c9e460adcc87b0014528b8f8e83013f19b947f172f6758cd7ef1bbad29e971011d91d26a4c4c6499d061a1e319
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.0
5
+ - 2.1.1
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Bob Nadler
1
+ Copyright (c) 2013-2014 Bob Nadler
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/hoboken.png)](http://badge.fury.io/rb/hoboken)
4
4
  [![Dependency Status](https://gemnasium.com/bnadlerjr/hoboken.png)](https://gemnasium.com/bnadlerjr/hoboken)
5
+ [![Build Status](https://travis-ci.org/bnadlerjr/hoboken.png)](https://travis-ci.org/bnadlerjr/hoboken)
5
6
 
6
7
  Generate Sinatra project templates.
7
8
 
@@ -45,6 +46,7 @@ Additional generators are available for existing projects generated using Hoboke
45
46
  $ hoboken add:omniauth # OmniAuth authentication (allows you to select a provider)
46
47
  $ hoboken add:sequel # Database access via Sequel gem
47
48
  $ hoboken add:sprockets # Rack-based asset packaging system
49
+ $ hoboken add:travis # Basic Travis-CI YAML config
48
50
 
49
51
  ## Contributing
50
52
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake", "~> 10.1.0"
22
+ spec.add_development_dependency "rake", "~> 10.3.1"
23
23
 
24
- spec.add_dependency "thor", "~> 0.18.1"
24
+ spec.add_dependency "thor", "~> 0.19.1"
25
25
  end
@@ -15,204 +15,13 @@ module Hoboken
15
15
  end
16
16
  end
17
17
 
18
- class Sequel < Thor::Group
19
- include Thor::Actions
20
- include Hoboken::Actions
21
-
22
- def self.source_root
23
- File.dirname(__FILE__)
24
- end
25
-
26
- def add_gems
27
- gem "sequel", "4.6.0"
28
- gem "sqlite3", "1.3.8", group: [:development, :test]
29
- end
30
-
31
- def setup_directories
32
- empty_directory("db/migrate")
33
- empty_directory("tasks")
34
- end
35
-
36
- def copy_rake_task
37
- copy_file("hoboken/templates/sequel.rake", "tasks/sequel.rake")
38
- end
39
-
40
- def setup_database_connection_in_rackup_file
41
- insert_into_file("config.ru", after: /require "bundler\/setup"/) do
42
- "\nrequire \"logger\"\nrequire \"sequel\""
43
- end
44
-
45
- app_name = File.open("config.ru").grep(/run.+/).first.chomp.gsub("run ", "")
46
-
47
- gsub_file("config.ru", /run #{app_name}/) do
48
- <<CODE
49
-
50
- db = Sequel.connect(ENV["DATABASE_URL"], loggers: [Logger.new($stdout)])
51
- Sequel.extension :migration
52
- Sequel::Migrator.check_current(db, "db/migrate") if Dir.glob("db/migrate/*.rb").size > 0
53
-
54
- app = #{app_name}
55
- app.set :database, db
56
- run app
57
- CODE
58
- end
59
- end
60
-
61
- def add_database_test_helper_class
62
- insert_into_file("test/test_helper.rb", after: /require "test\/unit"/) do
63
- "\nrequire \"sequel\""
64
- end
65
-
66
- append_file("test/test_helper.rb") do
67
- <<CODE
68
-
69
- module Test::Database
70
- class TestCase < Test::Unit::TestCase
71
- def run(*args, &block)
72
- result = nil
73
- database.transaction(rollback: :always) { result = super }
74
- result
75
- end
76
-
77
- private
78
-
79
- def database
80
- @database ||= Sequel.sqlite.tap do |db|
81
- Sequel.extension :migration
82
- Sequel::Migrator.run(db, 'db/migrate') if Dir.glob("db/migrate/*.rb").size > 0
83
- end
84
- end
85
- end
86
- end
87
- CODE
88
- end
89
- end
90
-
91
- def reminders
92
- say "\nGemfile updated... don't forget to 'bundle install'"
93
- say <<TEXT
94
-
95
- Notes:
96
- * The sqlite3 gem has been installed for dev and test environments only. You will need to specify a gem to use for production.
97
- * You will need to specify an environment variable 'DATABASE_URL' (either add it to .env or export it)
98
- TEXT
99
- end
100
- end
101
-
102
- class OmniAuth < Thor::Group
103
- include Thor::Actions
104
- include Hoboken::Actions
105
-
106
- attr_reader :provider
107
-
108
- def self.source_root
109
- File.dirname(__FILE__)
110
- end
111
-
112
- def add_gem
113
- @provider = ask("Specify a provider (i.e. twitter, facebook. etc.): ").downcase
114
- provider_version = ask("Specify provider version: ")
115
- gem gem_name, provider_version
116
- end
117
-
118
- def setup_middleware
119
- insert_into_file("app.rb", after: /require "sinatra("|\/base")/) do
120
- "\nrequire \"#{gem_name}\""
121
- end
122
-
123
- snippet = <<-CODE
124
-
125
- use OmniAuth::Builder do
126
- provider :#{provider}, ENV["#{provider.upcase}_KEY"], ENV["#{provider.upcase}_SECRET"]
127
- end
128
-
129
- CODE
130
-
131
- text = modular? ? indent(snippet, 4) : snippet
132
- insert_into_file("app.rb", after: /use Rack::Session::Cookie.+\n/) { text }
133
- end
134
-
135
- def add_routes
136
- routes = <<-CODE
137
-
138
-
139
- get "/login" do
140
- '<a href="/auth/#{provider}">Login</a>'
141
- end
142
-
143
- get "/auth/:provider/callback" do
144
- # TODO: Insert real authentication logic...
145
- MultiJson.encode(request.env['omniauth.auth'])
146
- end
147
-
148
- get "/auth/failure" do
149
- # TODO: Insert real error handling logic...
150
- halt 401, params[:message]
151
- end
152
- CODE
153
-
154
- if modular?
155
- insert_into_file("app.rb", after: /get.+?end$/m) { indent(routes, 4) }
156
- else
157
- append_file("app.rb", routes)
158
- end
159
- end
160
-
161
- def add_tests
162
- inject_into_class("test/unit/app_test.rb", "AppTest") do
163
- <<-CODE
164
- setup do
165
- OmniAuth.config.test_mode = true
166
- end
167
-
168
- test "GET /login" do
169
- get "/login"
170
- assert_equal('<a href="/auth/#{provider}">Login</a>', last_response.body)
171
- end
172
-
173
- test "GET /auth/#{provider}/callback" do
174
- auth_hash = {
175
- "provider" => "#{provider}",
176
- "uid" => "123545",
177
- "info" => {
178
- "name" => "John Doe"
179
- }
180
- }
181
-
182
- OmniAuth.config.mock_auth[:#{provider}] = auth_hash
183
- get "/auth/fitbit/callback"
184
- assert_equal(MultiJson.encode(auth_hash), last_response.body)
185
- end
186
-
187
- test "GET /auth/failure" do
188
- OmniAuth.config.mock_auth[:#{provider}] = :invalid_credentials
189
- get "/auth/failure"
190
- assert_response :not_authorized
191
- end
192
-
193
- CODE
194
- end
195
- end
196
-
197
- def reminders
198
- say "\nGemfile updated... don't forget to 'bundle install'"
199
- end
200
-
201
- private
202
-
203
- def gem_name
204
- "omniauth-#{provider}"
205
- end
206
-
207
- def modular?
208
- @modular ||= File.readlines("app.rb").grep(/Sinatra::Base/).any?
209
- end
210
- end
211
-
212
18
  require_relative "hoboken/add_ons/metrics"
213
19
  require_relative "hoboken/add_ons/internationalization"
214
20
  require_relative "hoboken/add_ons/heroku"
21
+ require_relative "hoboken/add_ons/omniauth"
22
+ require_relative "hoboken/add_ons/sequel"
215
23
  require_relative "hoboken/add_ons/sprockets"
24
+ require_relative "hoboken/add_ons/travis"
216
25
 
217
26
  class CLI < Thor
218
27
  desc "version", "Print version and quit"
@@ -226,8 +35,9 @@ CODE
226
35
  register(AddOns::Metrics, "add:metrics", "add:metrics", "Add metrics (flog, flay, simplecov)")
227
36
  register(AddOns::Internationalization, "add:i18n", "add:i18n", "Internationalization support using sinatra-r18n")
228
37
  register(AddOns::Heroku, "add:heroku", "add:heroku", "Heroku deployment support")
229
- register(OmniAuth, "add:omniauth", "add:omniauth", "OmniAuth authentication (allows you to select a provider)")
38
+ register(AddOns::OmniAuth, "add:omniauth", "add:omniauth", "OmniAuth authentication (allows you to select a provider)")
230
39
  register(AddOns::Sprockets, "add:sprockets", "add:sprockets", "Rack-based asset packaging system")
231
- register(Sequel, "add:sequel", "add:sequel", "Database access via Sequel gem")
40
+ register(AddOns::Sequel, "add:sequel", "add:sequel", "Database access via Sequel gem")
41
+ register(AddOns::Travis, "add:travis", "add:travis", "Basic Travis-CI YAML config")
232
42
  end
233
43
  end
@@ -1,11 +1,12 @@
1
1
  module Hoboken
2
2
  module Actions
3
- def gem(name, version, opts={})
3
+ def gem(name, opts={})
4
4
  verbose = opts.has_key?(:verbose) ? opts.delete(:verbose) : true
5
+ version = opts.has_key?(:version) ? opts.delete(:version) : nil
5
6
 
6
- parts = [name.inspect, "~> #{version}".inspect]
7
+ parts = [name.inspect]
8
+ parts << "~> #{version}".inspect unless version.nil? || version.empty?
7
9
  opts.each { |k, v| parts << "#{k}: #{v.inspect}" }
8
-
9
10
  append_file("Gemfile", "\ngem #{parts.join(", ")}", verbose: verbose)
10
11
  end
11
12
 
@@ -2,7 +2,7 @@ module Hoboken
2
2
  module AddOns
3
3
  class Heroku < ::Hoboken::Group
4
4
  def add_gem
5
- gem "foreman", "0.63.0", group: :development
5
+ gem "foreman", version: "0.63.0", group: :development
6
6
  end
7
7
 
8
8
  def procfile
@@ -2,7 +2,7 @@ module Hoboken
2
2
  module AddOns
3
3
  class Internationalization < ::Hoboken::Group
4
4
  def add_gem
5
- gem "sinatra-r18n", "1.1.5"
5
+ gem "sinatra-r18n", version: "1.1.5"
6
6
  insert_into_file("app.rb", after: /require "sinatra("|\/base")/) do
7
7
  "\nrequire \"sinatra/r18n\""
8
8
  end
@@ -2,9 +2,9 @@ module Hoboken
2
2
  module AddOns
3
3
  class Metrics < ::Hoboken::Group
4
4
  def add_gems
5
- gem "flog", "2.5.3", group: :test
6
- gem "flay", "1.4.3", group: :test
7
- gem "simplecov", "0.7.1", require: false, group: :test
5
+ gem "flog", version: "2.5.3", group: :test
6
+ gem "flay", version: "1.4.3", group: :test
7
+ gem "simplecov", version: "0.7.1", require: false, group: :test
8
8
  end
9
9
 
10
10
  def copy_task_templates
@@ -0,0 +1,106 @@
1
+ module Hoboken
2
+ module AddOns
3
+ class OmniAuth < ::Hoboken::Group
4
+ attr_reader :provider
5
+
6
+ def add_gem
7
+ @provider = ask("Specify a provider (i.e. twitter, facebook. etc.): ").downcase
8
+ provider_version = ask("Specify provider version: ")
9
+ gem gem_name, version: provider_version
10
+ end
11
+
12
+ def setup_middleware
13
+ insert_into_file("app.rb", after: /require "sinatra("|\/base")/) do
14
+ "\nrequire \"#{gem_name}\""
15
+ end
16
+
17
+ snippet = <<-CODE
18
+
19
+ use OmniAuth::Builder do
20
+ provider :#{provider}, ENV["#{provider.upcase}_KEY"], ENV["#{provider.upcase}_SECRET"]
21
+ end
22
+
23
+ CODE
24
+
25
+ text = modular? ? indent(snippet, 4) : snippet
26
+ insert_into_file("app.rb", after: /use Rack::Session::Cookie.+\n/) { text }
27
+ end
28
+
29
+ def add_routes
30
+ routes = <<-CODE
31
+
32
+
33
+ get "/login" do
34
+ '<a href="/auth/#{provider}">Login</a>'
35
+ end
36
+
37
+ get "/auth/:provider/callback" do
38
+ # TODO: Insert real authentication logic...
39
+ MultiJson.encode(request.env['omniauth.auth'])
40
+ end
41
+
42
+ get "/auth/failure" do
43
+ # TODO: Insert real error handling logic...
44
+ halt 401, params[:message]
45
+ end
46
+ CODE
47
+
48
+ if modular?
49
+ insert_into_file("app.rb", after: /get.+?end$/m) { indent(routes, 4) }
50
+ else
51
+ append_file("app.rb", routes)
52
+ end
53
+ end
54
+
55
+ def add_tests
56
+ inject_into_class("test/unit/app_test.rb", "AppTest") do
57
+ <<-CODE
58
+ setup do
59
+ OmniAuth.config.test_mode = true
60
+ end
61
+
62
+ test "GET /login" do
63
+ get "/login"
64
+ assert_equal('<a href="/auth/#{provider}">Login</a>', last_response.body)
65
+ end
66
+
67
+ test "GET /auth/#{provider}/callback" do
68
+ auth_hash = {
69
+ "provider" => "#{provider}",
70
+ "uid" => "123545",
71
+ "info" => {
72
+ "name" => "John Doe"
73
+ }
74
+ }
75
+
76
+ OmniAuth.config.mock_auth[:#{provider}] = auth_hash
77
+ get "/auth/fitbit/callback"
78
+ assert_equal(MultiJson.encode(auth_hash), last_response.body)
79
+ end
80
+
81
+ test "GET /auth/failure" do
82
+ OmniAuth.config.mock_auth[:#{provider}] = :invalid_credentials
83
+ get "/auth/failure"
84
+ assert_response :not_authorized
85
+ end
86
+
87
+ CODE
88
+ end
89
+ end
90
+
91
+ def reminders
92
+ say "\nGemfile updated... don't forget to 'bundle install'"
93
+ end
94
+
95
+ private
96
+
97
+ def gem_name
98
+ "omniauth-#{provider}"
99
+ end
100
+
101
+ def modular?
102
+ @modular ||= File.readlines("app.rb").grep(/Sinatra::Base/).any?
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,80 @@
1
+ module Hoboken
2
+ module AddOns
3
+ class Sequel < ::Hoboken::Group
4
+ def add_gems
5
+ gem "sequel", version: "4.6.0"
6
+ gem "sqlite3", version: "1.3.8", group: [:development, :test]
7
+ end
8
+
9
+ def setup_directories
10
+ empty_directory("db/migrate")
11
+ empty_directory("tasks")
12
+ end
13
+
14
+ def copy_rake_task
15
+ copy_file("hoboken/templates/sequel.rake", "tasks/sequel.rake")
16
+ end
17
+
18
+ def setup_database_connection_in_rackup_file
19
+ insert_into_file("config.ru", after: /require "bundler\/setup"/) do
20
+ "\nrequire \"logger\"\nrequire \"sequel\""
21
+ end
22
+
23
+ app_name = File.open("config.ru").grep(/run.+/).first.chomp.gsub("run ", "")
24
+
25
+ gsub_file("config.ru", /run #{app_name}/) do
26
+ <<CODE
27
+
28
+ db = Sequel.connect(ENV["DATABASE_URL"], loggers: [Logger.new($stdout)])
29
+ Sequel.extension :migration
30
+ Sequel::Migrator.check_current(db, "db/migrate") if Dir.glob("db/migrate/*.rb").size > 0
31
+
32
+ app = #{app_name}
33
+ app.set :database, db
34
+ run app
35
+ CODE
36
+ end
37
+ end
38
+
39
+ def add_database_test_helper_class
40
+ insert_into_file("test/test_helper.rb", after: /require "test\/unit"/) do
41
+ "\nrequire \"sequel\""
42
+ end
43
+
44
+ append_file("test/test_helper.rb") do
45
+ <<CODE
46
+
47
+ module Test::Database
48
+ class TestCase < Test::Unit::TestCase
49
+ def run(*args, &block)
50
+ result = nil
51
+ database.transaction(rollback: :always) { result = super }
52
+ result
53
+ end
54
+
55
+ private
56
+
57
+ def database
58
+ @database ||= Sequel.sqlite.tap do |db|
59
+ Sequel.extension :migration
60
+ Sequel::Migrator.run(db, 'db/migrate') if Dir.glob("db/migrate/*.rb").size > 0
61
+ end
62
+ end
63
+ end
64
+ end
65
+ CODE
66
+ end
67
+ end
68
+
69
+ def reminders
70
+ say "\nGemfile updated... don't forget to 'bundle install'"
71
+ say <<TEXT
72
+
73
+ Notes:
74
+ * The sqlite3 gem has been installed for dev and test environments only. You will need to specify a gem to use for production.
75
+ * You will need to specify an environment variable 'DATABASE_URL' (either add it to .env or export it)
76
+ TEXT
77
+ end
78
+ end
79
+ end
80
+ end
@@ -8,9 +8,9 @@ module Hoboken
8
8
  end
9
9
 
10
10
  def add_gems
11
- gem "sprockets", "2.10.0", group: :assets
12
- gem "uglifier", "2.1.1", group: :assets
13
- gem "yui-compressor", "0.9.6", group: :assets
11
+ gem "sprockets", version: "2.10.0", group: :assets
12
+ gem "uglifier", version: "2.1.1", group: :assets
13
+ gem "yui-compressor", version: "0.9.6", group: :assets
14
14
  end
15
15
 
16
16
  def copy_sprockets_helpers
@@ -0,0 +1,11 @@
1
+ module Hoboken
2
+ module AddOns
3
+ class Travis < ::Hoboken::Group
4
+ def travis_yml
5
+ create_file(".travis.yml") do
6
+ "language: ruby"
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,4 @@
1
+ require "bundler/setup"
1
2
  require "sinatra"
2
3
  require "rack/csrf"
3
4
 
@@ -1,3 +1,4 @@
1
+ require "bundler/setup"
1
2
  require "sinatra/base"
2
3
  require "rack/csrf"
3
4
 
@@ -1,3 +1,3 @@
1
1
  module Hoboken
2
- VERSION = "0.0.1.beta3"
2
+ VERSION = "0.0.1"
3
3
  end
@@ -1,4 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
  ruby "2.0.0"
3
3
 
4
- gem "sinatra", "~> 1.4.4", require: false, group: [:test, :development]
4
+ gem "sinatra"
@@ -115,4 +115,128 @@ CODE
115
115
  )
116
116
  end
117
117
  end
118
+
119
+ def test_travis_add_on
120
+ run_hoboken(:generate) do
121
+ bin_path = File.expand_path("../../../bin/hoboken", __FILE__)
122
+ execute("#{bin_path} add:travis")
123
+ assert_file(".travis.yml", "language: ruby")
124
+ end
125
+ end
126
+
127
+ def test_sequel_add_on
128
+ run_hoboken(:generate) do
129
+ bin_path = File.expand_path("../../../bin/hoboken", __FILE__)
130
+ execute("#{bin_path} add:sequel")
131
+ assert_file("Gemfile", "sequel", "sqlite3")
132
+ assert_file("tasks/sequel.rake")
133
+
134
+ assert_file("config.ru", /require "logger"/)
135
+ assert_file("config.ru", /require "sequel"/)
136
+ assert_file("config.ru", <<CODE
137
+
138
+ db = Sequel.connect(ENV["DATABASE_URL"], loggers: [Logger.new($stdout)])
139
+ Sequel.extension :migration
140
+ Sequel::Migrator.check_current(db, "db/migrate") if Dir.glob("db/migrate/*.rb").size > 0
141
+
142
+ app = Sinatra::Application
143
+ app.set :database, db
144
+ run app
145
+ CODE
146
+ )
147
+
148
+ assert_file("test/test_helper.rb", /require "sequel"/)
149
+ assert_file("test/test_helper.rb", <<CODE
150
+
151
+ module Test::Database
152
+ class TestCase < Test::Unit::TestCase
153
+ def run(*args, &block)
154
+ result = nil
155
+ database.transaction(rollback: :always) { result = super }
156
+ result
157
+ end
158
+
159
+ private
160
+
161
+ def database
162
+ @database ||= Sequel.sqlite.tap do |db|
163
+ Sequel.extension :migration
164
+ Sequel::Migrator.run(db, 'db/migrate') if Dir.glob("db/migrate/*.rb").size > 0
165
+ end
166
+ end
167
+ end
168
+ end
169
+ CODE
170
+ )
171
+ end
172
+ end
173
+
174
+ def test_omniauth_add_on
175
+ run_hoboken(:generate) do
176
+ bin_path = File.expand_path("../../../bin/hoboken", __FILE__)
177
+ execute("(echo 'twitter' && echo '0.0.1') | #{bin_path} add:omniauth")
178
+ assert_file("Gemfile", "omniauth-twitter")
179
+ assert_file("app.rb", /require "omniauth-twitter"/)
180
+ assert_file("app.rb", <<CODE
181
+
182
+ use OmniAuth::Builder do
183
+ provider :twitter, ENV["TWITTER_KEY"], ENV["TWITTER_SECRET"]
184
+ end
185
+
186
+ CODE
187
+ )
188
+
189
+ assert_file("app.rb", <<CODE
190
+
191
+
192
+ get "/login" do
193
+ '<a href="/auth/twitter">Login</a>'
194
+ end
195
+
196
+ get "/auth/:provider/callback" do
197
+ # TODO: Insert real authentication logic...
198
+ MultiJson.encode(request.env['omniauth.auth'])
199
+ end
200
+
201
+ get "/auth/failure" do
202
+ # TODO: Insert real error handling logic...
203
+ halt 401, params[:message]
204
+ end
205
+ CODE
206
+ )
207
+ end
208
+
209
+ assert_file("test/unit/app_test.rb", <<-CODE
210
+ setup do
211
+ OmniAuth.config.test_mode = true
212
+ end
213
+
214
+ test "GET /login" do
215
+ get "/login"
216
+ assert_equal('<a href="/auth/twitter">Login</a>', last_response.body)
217
+ end
218
+
219
+ test "GET /auth/twitter/callback" do
220
+ auth_hash = {
221
+ "provider" => "twitter",
222
+ "uid" => "123545",
223
+ "info" => {
224
+ "name" => "John Doe"
225
+ }
226
+ }
227
+
228
+ OmniAuth.config.mock_auth[:twitter] = auth_hash
229
+ get "/auth/fitbit/callback"
230
+ assert_equal(MultiJson.encode(auth_hash), last_response.body)
231
+ end
232
+
233
+ test "GET /auth/failure" do
234
+ OmniAuth.config.mock_auth[:twitter] = :invalid_credentials
235
+ get "/auth/failure"
236
+ assert_response :not_authorized
237
+ end
238
+
239
+ CODE
240
+ )
241
+ end
118
242
  end
@@ -23,11 +23,11 @@ class GenerateTest < IntegrationTestCase
23
23
  end
24
24
  end
25
25
 
26
- def test_generate_classic_can_run_tests
27
- run_hoboken(:generate) do
28
- assert_match /1 tests, 1 assertions, 0 failures, 0 errors, 0 skips/, execute("rake test:all")
29
- end
30
- end
26
+ #def test_generate_classic_can_run_tests
27
+ #run_hoboken(:generate) do
28
+ #assert_match /1 tests, 1 assertions, 0 failures, 0 errors, 0 skips/, execute("rake test:all")
29
+ #end
30
+ #end
31
31
 
32
32
  def test_generate_modular
33
33
  run_hoboken(:generate, type: :modular) do
@@ -51,11 +51,11 @@ class GenerateTest < IntegrationTestCase
51
51
  end
52
52
  end
53
53
 
54
- def test_generate_modular_can_run_tests
55
- run_hoboken(:generate, type: :modular) do
56
- assert_match /1 tests, 1 assertions, 0 failures, 0 errors, 0 skips/, execute("rake test:all")
57
- end
58
- end
54
+ #def test_generate_modular_can_run_tests
55
+ #run_hoboken(:generate, type: :modular) do
56
+ #assert_match /1 tests, 1 assertions, 0 failures, 0 errors, 0 skips/, execute("rake test:all")
57
+ #end
58
+ #end
59
59
 
60
60
  def test_generate_with_ruby_version
61
61
  run_hoboken(:generate, ruby_version: "2.1.0") do
@@ -30,12 +30,10 @@ class IntegrationTestCase < Test::Unit::TestCase
30
30
  end
31
31
 
32
32
  def execute(command)
33
- current_path = Dir.pwd
34
- FileUtils.cd("#{DESTINATION}/#{$hoboken_counter}/sample")
35
- `bundle install` unless File.exists?("Gemfile.lock")
36
- `#{command}`
37
- ensure
38
- FileUtils.cd(current_path)
33
+ FileUtils.cd("#{DESTINATION}/#{$hoboken_counter}/sample") do
34
+ `bundle install` unless File.exists?("Gemfile.lock")
35
+ `#{command}`
36
+ end
39
37
  end
40
38
 
41
39
  def assert_file(filename, *contents)
@@ -48,7 +46,7 @@ class IntegrationTestCase < Test::Unit::TestCase
48
46
  read = File.read(full_path)
49
47
  contents.each do |content|
50
48
  assert_block("expected #{filename.inspect} to contain #{content}:\n#{read}") do
51
- pattern = content.is_a?(Regexp) ? content : /#{content}/
49
+ pattern = content.is_a?(Regexp) ? content : Regexp.new(Regexp.quote(content))
52
50
  read =~ pattern
53
51
  end
54
52
  end
@@ -19,7 +19,17 @@ module Hoboken
19
19
  end
20
20
 
21
21
  def test_gem_appends_to_gemfile
22
- target.gem "sinatra", "1.4.4", verbose: false
22
+ target.gem "sinatra", verbose: false
23
+ expected =
24
+ "source \"https://rubygems.org\"\n" +
25
+ "ruby \"2.0.0\"\n\n" +
26
+ "gem \"sinatra\""
27
+
28
+ assert_equal(expected, File.read(gemfile))
29
+ end
30
+
31
+ def test_gem_with_version
32
+ target.gem "sinatra", version: "1.4.4", verbose: false
23
33
  expected =
24
34
  "source \"https://rubygems.org\"\n" +
25
35
  "ruby \"2.0.0\"\n\n" +
@@ -28,8 +38,18 @@ module Hoboken
28
38
  assert_equal(expected, File.read(gemfile))
29
39
  end
30
40
 
41
+ def test_get_with_blank_version
42
+ target.gem "sinatra", version: "", verbose: false
43
+ expected =
44
+ "source \"https://rubygems.org\"\n" +
45
+ "ruby \"2.0.0\"\n\n" +
46
+ "gem \"sinatra\""
47
+
48
+ assert_equal(expected, File.read(gemfile))
49
+ end
50
+
31
51
  def test_gem_with_group
32
- target.gem "sinatra", "1.4.4", group: :test, verbose: false
52
+ target.gem "sinatra", version: "1.4.4", group: :test, verbose: false
33
53
  expected =
34
54
  "source \"https://rubygems.org\"\n" +
35
55
  "ruby \"2.0.0\"\n\n" +
@@ -39,7 +59,7 @@ module Hoboken
39
59
  end
40
60
 
41
61
  def test_gem_with_multiple_groups
42
- target.gem "sinatra", "1.4.4", group: [:test, :development], verbose: false
62
+ target.gem "sinatra", version: "1.4.4", group: [:test, :development], verbose: false
43
63
  expected =
44
64
  "source \"https://rubygems.org\"\n" +
45
65
  "ruby \"2.0.0\"\n\n" +
@@ -49,7 +69,7 @@ module Hoboken
49
69
  end
50
70
 
51
71
  def test_gem_with_require
52
- target.gem "sinatra", "1.4.4", require: false, verbose: false
72
+ target.gem "sinatra", version: "1.4.4", require: false, verbose: false
53
73
  expected =
54
74
  "source \"https://rubygems.org\"\n" +
55
75
  "ruby \"2.0.0\"\n\n" +
@@ -59,7 +79,7 @@ module Hoboken
59
79
  end
60
80
 
61
81
  def test_gem_with_require_and_group
62
- target.gem "sinatra", "1.4.4", require: false, group: :test, verbose: false
82
+ target.gem "sinatra", version: "1.4.4", require: false, group: :test, verbose: false
63
83
  expected =
64
84
  "source \"https://rubygems.org\"\n" +
65
85
  "ruby \"2.0.0\"\n\n" +
@@ -69,7 +89,7 @@ module Hoboken
69
89
  end
70
90
 
71
91
  def test_gem_with_require_and_multiple_groups
72
- target.gem "sinatra", "1.4.4", require: false, group: [:test, :development], verbose: false
92
+ target.gem "sinatra", version: "1.4.4", require: false, group: [:test, :development], verbose: false
73
93
  expected =
74
94
  "source \"https://rubygems.org\"\n" +
75
95
  "ruby \"2.0.0\"\n\n" +
@@ -79,8 +99,8 @@ module Hoboken
79
99
  end
80
100
 
81
101
  def test_gem_multiple
82
- target.gem "sinatra", "1.4.4", verbose: false
83
- target.gem "thin", "1.4.4", verbose: false
102
+ target.gem "sinatra", version: "1.4.4", verbose: false
103
+ target.gem "thin", version: "1.4.4", verbose: false
84
104
  expected =
85
105
  "source \"https://rubygems.org\"\n" +
86
106
  "ruby \"2.0.0\"\n\n" +
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoboken
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta3
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Nadler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-10 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 10.1.0
33
+ version: 10.3.1
34
34
  type: :development
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: 10.1.0
40
+ version: 10.3.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.18.1
47
+ version: 0.19.1
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.18.1
54
+ version: 0.19.1
55
55
  description: Sinatra project generator.
56
56
  email:
57
57
  - bnadlerjr@gmail.com
@@ -60,7 +60,8 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .gitignore
63
+ - ".gitignore"
64
+ - ".travis.yml"
64
65
  - Gemfile
65
66
  - LICENSE.txt
66
67
  - README.md
@@ -72,7 +73,10 @@ files:
72
73
  - lib/hoboken/add_ons/heroku.rb
73
74
  - lib/hoboken/add_ons/internationalization.rb
74
75
  - lib/hoboken/add_ons/metrics.rb
76
+ - lib/hoboken/add_ons/omniauth.rb
77
+ - lib/hoboken/add_ons/sequel.rb
75
78
  - lib/hoboken/add_ons/sprockets.rb
79
+ - lib/hoboken/add_ons/travis.rb
76
80
  - lib/hoboken/generate.rb
77
81
  - lib/hoboken/templates/Gemfile.erb.tt
78
82
  - lib/hoboken/templates/README.md.tt
@@ -113,17 +117,17 @@ require_paths:
113
117
  - lib
114
118
  required_ruby_version: !ruby/object:Gem::Requirement
115
119
  requirements:
116
- - - '>='
120
+ - - ">="
117
121
  - !ruby/object:Gem::Version
118
122
  version: '0'
119
123
  required_rubygems_version: !ruby/object:Gem::Requirement
120
124
  requirements:
121
- - - '>'
125
+ - - ">="
122
126
  - !ruby/object:Gem::Version
123
- version: 1.3.1
127
+ version: '0'
124
128
  requirements: []
125
129
  rubyforge_project:
126
- rubygems_version: 2.0.3
130
+ rubygems_version: 2.1.11
127
131
  signing_key:
128
132
  specification_version: 4
129
133
  summary: Sinatra project generator.