rapid-app 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/.gitignore +6 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +11 -0
  4. data/Rakefile +4 -0
  5. data/lib/rapid/app/settings.rb +259 -0
  6. data/lib/rapid/app/skeleton.rb +213 -0
  7. data/lib/rapid/app/version.rb +5 -0
  8. data/lib/rapid/app.rb +13 -0
  9. data/lib/rapid-app.rb +5 -0
  10. data/rapid-app.gemspec +33 -0
  11. data/spec/rapid/app/skeleton_spec.rb +50 -0
  12. data/spec/rapid/app_spec.rb +12 -0
  13. data/spec/spec_helper.rb +12 -0
  14. data/spec/support/more_string_matchers.rb +21 -0
  15. data/spec/support/rapid.rb +1 -0
  16. data/spec/templates/app/controllers/application_controller_spec.rb +32 -0
  17. data/spec/templates/app/helpers/application_helper_spec.rb +32 -0
  18. data/spec/templates/app/mailers/test_mailer_spec.rb +22 -0
  19. data/spec/templates/app/views/test_mailer/test_email.text.erb_spec.rb +36 -0
  20. data/spec/templates/config/application_spec.rb +168 -0
  21. data/spec/templates/config/boot_spec.rb +17 -0
  22. data/spec/templates/config/cucumber.yml_spec.rb +22 -0
  23. data/spec/templates/config/deploy/production_spec.rb +155 -0
  24. data/spec/templates/config/deploy_spec.rb +156 -0
  25. data/spec/templates/config/environment_spec.rb +22 -0
  26. data/spec/templates/config/environments/development_spec.rb +50 -0
  27. data/spec/templates/config/environments/production_spec.rb +50 -0
  28. data/spec/templates/config/environments/test_spec.rb +50 -0
  29. data/spec/templates/config/initializers/airbrake_spec.rb +70 -0
  30. data/spec/templates/config/initializers/backtrace_silencers_spec.rb +17 -0
  31. data/spec/templates/config/initializers/email_spec.rb +106 -0
  32. data/spec/templates/config/initializers/mime_types_spec.rb +17 -0
  33. data/spec/templates/config/initializers/secret_token_spec.rb +36 -0
  34. data/spec/templates/config/initializers/session_store_spec.rb +36 -0
  35. data/spec/templates/config/initializers/wrap_parameters_spec.rb +17 -0
  36. data/spec/templates/config/roodi.yml_spec.rb +92 -0
  37. data/spec/templates/config/routes_spec.rb +36 -0
  38. data/spec/templates/config/schedule_spec.rb +22 -0
  39. data/spec/templates/config.ru_spec.rb +22 -0
  40. data/spec/templates/db/migrate/create_jobs_spec.rb +17 -0
  41. data/spec/templates/features/step_definitions/email_steps_spec.rb +17 -0
  42. data/spec/templates/features/step_definitions/web_steps/browsing_steps_spec.rb +17 -0
  43. data/spec/templates/features/step_definitions/web_steps/debug_steps_spec.rb +17 -0
  44. data/spec/templates/features/step_definitions/web_steps/form_steps_spec.rb +17 -0
  45. data/spec/templates/features/step_definitions/web_steps/step_scoper_spec.rb +17 -0
  46. data/spec/templates/features/support/email_spec.rb +17 -0
  47. data/spec/templates/features/support/env_spec.rb +56 -0
  48. data/spec/templates/features/support/paths_spec.rb +22 -0
  49. data/spec/templates/features/support/selectors_spec.rb +22 -0
  50. data/spec/templates/features/support/with_scope_spec.rb +17 -0
  51. data/spec/templates/lib/tasks/cucumber.rake_spec.rb +17 -0
  52. data/spec/templates/lib/tasks/test.rake_spec.rb +147 -0
  53. data/spec/templates/lib/tasks/test_mailer.rake_spec.rb +17 -0
  54. data/spec/templates/rspec_spec.rb +17 -0
  55. data/spec/templates/script/delayed_job_spec.rb +17 -0
  56. data/spec/templates/script/rails_spec.rb +17 -0
  57. data/spec/templates/spec/factories_spec.rb +27 -0
  58. data/spec/templates/spec/spec_helper_spec.rb +56 -0
  59. data/spec/templates/test/test_helper_spec.rb +17 -0
  60. data/templates/app/controllers/application_controller.rb +3 -0
  61. data/templates/app/helpers/application_helper.rb +2 -0
  62. data/templates/app/mailers/test_mailer.rb +7 -0
  63. data/templates/app/views/test_mailer/test_email.text.erb +4 -0
  64. data/templates/config/application.rb +32 -0
  65. data/templates/config/boot.rb +6 -0
  66. data/templates/config/cucumber.yml +8 -0
  67. data/templates/config/deploy/production.rb +37 -0
  68. data/templates/config/deploy.rb +43 -0
  69. data/templates/config/environment.rb +5 -0
  70. data/templates/config/environments/development.rb +35 -0
  71. data/templates/config/environments/production.rb +64 -0
  72. data/templates/config/environments/test.rb +46 -0
  73. data/templates/config/initializers/airbrake.rb +9 -0
  74. data/templates/config/initializers/backtrace_silencers.rb +7 -0
  75. data/templates/config/initializers/email.rb +10 -0
  76. data/templates/config/initializers/mime_types.rb +5 -0
  77. data/templates/config/initializers/secret_token.rb +7 -0
  78. data/templates/config/initializers/session_store.rb +8 -0
  79. data/templates/config/initializers/wrap_parameters.rb +14 -0
  80. data/templates/config/roodi.yml +13 -0
  81. data/templates/config/routes.rb +3 -0
  82. data/templates/config/schedule.rb +1 -0
  83. data/templates/config.ru +4 -0
  84. data/templates/db/migrate/create_jobs.rb +22 -0
  85. data/templates/features/step_definitions/email_steps.rb +194 -0
  86. data/templates/features/step_definitions/web_steps/browsing_steps.rb +82 -0
  87. data/templates/features/step_definitions/web_steps/debug_steps.rb +3 -0
  88. data/templates/features/step_definitions/web_steps/form_steps.rb +210 -0
  89. data/templates/features/step_definitions/web_steps/step_scoper.rb +9 -0
  90. data/templates/features/support/email.rb +2 -0
  91. data/templates/features/support/env.rb +55 -0
  92. data/templates/features/support/paths.rb +27 -0
  93. data/templates/features/support/selectors.rb +24 -0
  94. data/templates/features/support/with_scope.rb +6 -0
  95. data/templates/lib/tasks/cucumber.rake +65 -0
  96. data/templates/lib/tasks/test.rake +49 -0
  97. data/templates/lib/tasks/test_mailer.rake +10 -0
  98. data/templates/rspec +2 -0
  99. data/templates/script/delayed_job +5 -0
  100. data/templates/script/rails +6 -0
  101. data/templates/spec/factories.rb +1 -0
  102. data/templates/spec/spec_helper.rb +47 -0
  103. data/templates/test/test_helper.rb +13 -0
  104. metadata +316 -0
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .rvmrc
3
+ .bundle
4
+ Gemfile.lock
5
+ pkg/*
6
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in rapid-app.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem "rake"
8
+ gem "rspec"
9
+ gem "cucumber"
10
+ gem "rcov"
11
+ end
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new('spec')
@@ -0,0 +1,259 @@
1
+ module Rapid
2
+ module App
3
+
4
+ class Settings
5
+ include Rapid::Settings
6
+
7
+ setting.string 'name'
8
+ setting.string 'secret_token'
9
+ setting.string 'session_cookie_name'
10
+ setting.string 'timezone'
11
+
12
+ setting.code 'controllers.application.body'
13
+ setting.code 'helpers.application.body'
14
+ setting.code 'config.body'
15
+ setting.code 'routes.body'
16
+
17
+ setting.namespace 'database', :default => true
18
+ setting.namespace 'database.sqlite', :default => true
19
+ setting.namespace 'database.mysql', :default => false
20
+ setting.namespace 'database.mongoid', :default => false
21
+
22
+ setting.namespace 'development', :default => true
23
+ setting.string 'development.domain', :default => "localhost"
24
+ setting.integer 'development.port'
25
+
26
+ setting.namespace 'test', :default => true
27
+ setting.string 'test.domain', :default => "www.example.com"
28
+ setting.integer 'test.port'
29
+
30
+ setting.integer 'test.coverage.threshold', :default => 90
31
+ setting.namespace 'test.unit', :default => true
32
+
33
+ setting.namespace 'test.rspec', :default => false
34
+ setting.code 'test.rspec.factories.body'
35
+
36
+ setting.namespace 'test.cucumber', :default => true
37
+ setting.integer 'test.cucumber.wip.max', :default => 20
38
+ setting.code 'test.cucumber.selectors.body'
39
+ setting.code 'test.cucumber.paths.body'
40
+
41
+ setting.namespace 'test.roodi', :default => true
42
+ setting.integer 'test.roodi.method.complexity', :default => 8
43
+ setting.integer 'test.roodi.method.lines.max', :default => 40
44
+ setting.integer 'test.roodi.block.complexity', :default => 4
45
+ setting.integer 'test.roodi.klass.lines.max', :default => 300
46
+ setting.integer 'test.roodi.module.lines.max', :default => 300
47
+ setting.integer 'test.roodi.parameters.max', :default => 5
48
+
49
+ setting.namespace 'production', :default => true
50
+ setting.string 'production.domain'
51
+ setting.integer 'production.port'
52
+
53
+ setting.namespace 'assets', :default => true
54
+ setting.namespace 'paginate', :default => true
55
+ setting.namespace 'net', :default => true
56
+ setting.namespace 'net.http', :default => true
57
+
58
+ setting.namespace 'i18n', :default => false
59
+ setting.namespace 'breadcrumbs', :default => false
60
+ setting.namespace 'upload', :default => false
61
+ setting.boolean 'upload.private', :default => false
62
+
63
+ setting.namespace 'import', :default => false
64
+ setting.namespace 'import.logs', :default => false
65
+
66
+ setting.namespace 'exceptions', :default => false
67
+ setting.namespace 'exceptions.airbrake', :default => false
68
+ setting.string 'exceptions.airbrake.api_key'
69
+ setting.string 'exceptions.airbrake.host'
70
+ setting.boolean 'exceptions.airbrake.secure'
71
+
72
+ setting.namespace 'deploy', :default => false
73
+ setting.string 'deploy.repository.url'
74
+
75
+ setting.namespace 'deploy.production', :default => false
76
+ setting.string 'deploy.production.domain'
77
+ setting.string 'deploy.production.path'
78
+ setting.string 'deploy.production.branch'
79
+ setting.string 'deploy.production.user'
80
+ setting.integer 'deploy.production.keep', :default => 5
81
+ setting.string 'deploy.production.server', :default => 'passenger'
82
+ setting.string 'deploy.production.bin'
83
+ setting.string 'deploy.production.rvm.type'
84
+ setting.string 'deploy.production.rvm.ruby'
85
+ setting.string 'deploy.production.rvm.gemset'
86
+
87
+
88
+ setting.namespace 'email', :default => false
89
+ setting.string 'email.smtp.provider'
90
+ setting.string 'email.smtp.address'
91
+ setting.string 'email.smtp.domain'
92
+ setting.string 'email.smtp.username'
93
+ setting.string 'email.smtp.password'
94
+ setting.integer 'email.smtp.port', :default => 587
95
+ setting.string 'email.smtp.authentication', :default => "plain"
96
+ setting.boolean 'email.smtp.tls', :default => true
97
+
98
+ setting.string 'email.test.subject', :default => "Test Email"
99
+ setting.string 'email.test.message', :default => "Emails are configured correctly!"
100
+
101
+ setting.namespace 'scheduler', :default => false
102
+ setting.code 'scheduler.body'
103
+
104
+ setting.namespace 'async', :default => false
105
+ setting.namespace 'async.delayed_job', :default => false
106
+
107
+ validates_presence_of 'name'
108
+ validates_presence_of 'upload', :if => :import?
109
+ validates_presence_of 'async', :if => :import?
110
+ validates_presence_of 'net.http', :if => 'root.exceptions.airbrake?'
111
+
112
+ validates_inclusion_of 'timezone', :in => ActiveSupport::TimeZone.all.collect {|z| z.name}, :allow_nil => true
113
+ validates_inclusion_of 'deploy.production.server', :in => %w(passenger heroku), :allow_nil => true
114
+ validates_inclusion_of 'email.smtp.provider', :in => %w(google sendgrid), :allow_nil => true
115
+ validates_inclusion_of 'deploy.production.rvm.type', :in => %w(system user), :allow_nil => true
116
+
117
+ def module_name
118
+ name.camelize if name
119
+ end
120
+
121
+ def module_name= name
122
+ self.name = name ? name.underscore : nil
123
+ end
124
+
125
+ def rails_all?
126
+ database.active_record? && assets? && test.unit?
127
+ end
128
+
129
+ def rails_all= bool
130
+ if bool
131
+ database.active_record = true
132
+ assets = true
133
+ test.unit = true
134
+ end
135
+
136
+ bool
137
+ end
138
+
139
+ setting.class_eval 'database' do
140
+
141
+ def active_record?
142
+ sqlite? || mysql?
143
+ end
144
+
145
+ end
146
+
147
+ setting.class_eval 'test' do
148
+
149
+ def tasks
150
+ tasks = []
151
+ tasks.push 'db:migrate' if root.database.active_record?
152
+ tasks.push 'rapid:check'
153
+ tasks.push 'roodi' if roodi?
154
+ tasks.push 'test' if unit?
155
+ tasks.push 'spec' if rspec?
156
+ tasks.push 'cucumber' if cucumber?
157
+
158
+ %(%w(#{tasks.join(' ')}))
159
+ end
160
+
161
+ def tasks=
162
+ # TODO infer the roodi, spec, cucumber settings
163
+ end
164
+
165
+ def tasks_description
166
+ tasks = []
167
+ tasks.push 'rapid:check'
168
+ tasks.push 'roodi' if roodi?
169
+ tasks.push 'test' if unit?
170
+ tasks.push 'spec' if rspec?
171
+ tasks.push 'cucumber' if cucumber?
172
+
173
+ if tasks.length > 2
174
+ last = tasks.pop
175
+ tasks.push "and #{last}"
176
+ end
177
+
178
+ "Test the application using #{tasks.join(', ')}"
179
+ end
180
+
181
+ def tasks_description= descr
182
+ # TODO
183
+ end
184
+
185
+ end
186
+
187
+ setting.class_eval 'deploy' do
188
+
189
+ def rvm?
190
+ production.rvm?
191
+ end
192
+
193
+ def rvm= bool
194
+ production.rvm = bool
195
+ end
196
+
197
+ def symlink?
198
+ root.database.active_record? || root.upload.private?
199
+ end
200
+
201
+ def symlink= bool
202
+ root.database.active_record = bool
203
+ root.upload.private = bool
204
+ end
205
+
206
+ def stages
207
+
208
+ end
209
+
210
+ def stages= s
211
+ # TODO infer stages
212
+ end
213
+
214
+ end
215
+
216
+ setting.class_eval 'deploy.production' do
217
+
218
+ def scheduler?
219
+ bin? && root.scheduler?
220
+ end
221
+
222
+ def scheduler= s
223
+ # TODO
224
+ end
225
+
226
+ end
227
+
228
+ setting.class_eval 'email.smtp' do
229
+
230
+ def address
231
+ case provider
232
+ when 'google'
233
+ "smtp.gmail.com"
234
+ when 'sendgrid'
235
+ "smtp.sendgrid.net"
236
+ else
237
+ self[:address]
238
+ end
239
+ end
240
+
241
+ def address= address
242
+ self.provider = case address
243
+ when 'smtp.gmail.com'
244
+ 'google'
245
+ when 'smtp.sendgrid.net'
246
+ 'sendgrid'
247
+ else
248
+ nil
249
+ end
250
+
251
+ self[:address] = address
252
+ end
253
+
254
+ end
255
+
256
+ end
257
+
258
+ end
259
+ end
@@ -0,0 +1,213 @@
1
+ module Rapid
2
+ module App
3
+
4
+ class Skeleton < Rapid::Skeleton::Base
5
+
6
+ validate :validate_gemfile_exists
7
+ validate :validate_routes_file_exists
8
+
9
+ def initialize options = {}
10
+ super App::Settings.new, options.reverse_merge(:file => __FILE__)
11
+ end
12
+
13
+ def bones
14
+ section :rails
15
+ section :assets
16
+ section :email
17
+ section :database
18
+ section :development
19
+ section :test
20
+ section :production
21
+ section :exceptions
22
+ section :deploy
23
+ section :scheduler
24
+ section :async
25
+ section :other
26
+
27
+ true
28
+ end
29
+
30
+ def rails
31
+ gem 'rails', '3.2.1'
32
+
33
+ template 'app/controllers/application_controller.rb'
34
+ template 'app/helpers/application_helper.rb'
35
+ template 'config/application.rb'
36
+ template 'config/boot.rb'
37
+ template 'config/environment.rb'
38
+ template 'config/routes.rb'
39
+ template 'config.ru'
40
+
41
+ template 'config/initializers/backtrace_silencers.rb'
42
+ template 'config/initializers/mime_types.rb'
43
+ template 'config/initializers/secret_token.rb'
44
+ template 'config/initializers/session_store.rb'
45
+ template 'config/initializers/wrap_parameters.rb'
46
+
47
+ script 'script/rails'
48
+
49
+ directory 'doc'
50
+ directory 'lib/tasks'
51
+ directory 'log'
52
+ directory 'tmp'
53
+ end
54
+
55
+ def assets
56
+ gem 'sass-rails', :group => :assets, :if => 'assets'
57
+
58
+ if settings.assets?
59
+ gem 'coffee-rails', :group => :assets
60
+ gem 'uglifier', :group => :assets
61
+ end
62
+ end
63
+
64
+ def email
65
+ template 'config/initializers/email.rb', :if => 'email'
66
+
67
+ template 'app/mailers/test_mailer.rb', :if => 'email.test'
68
+ if settings.email.test?
69
+ template 'lib/tasks/test_mailer.rake'
70
+ view 'test_mailer/test_email.text.erb'
71
+ end
72
+ end
73
+
74
+ def database
75
+ directory 'db/migrate', :if => 'database.active_record'
76
+
77
+ gem 'mongoid', :if => 'database.mongoid'
78
+ if settings.database.mongoid?
79
+ gem 'bson_ext'
80
+ gem 'SystemTimer'
81
+ end
82
+ end
83
+
84
+ def development
85
+ template 'config/environments/development.rb', :if => 'development'
86
+ end
87
+
88
+ def test
89
+ template 'config/environments/test.rb', :if => 'test'
90
+ if settings.test?
91
+ gem 'rapid-core', :groups => [:development, :test]
92
+ gem 'rapid-app', :groups => [:development, :test]
93
+
94
+ section :test_unit
95
+ section :rspec
96
+ section :cucumber
97
+ section :roodi
98
+
99
+ template 'lib/tasks/test.rake'
100
+ gem 'fakeweb', :group => :test, :if => 'settings.net.http'
101
+ end
102
+ end
103
+
104
+ def test_unit
105
+ template 'test/test_helper.rb', :if => 'test.unit'
106
+ end
107
+
108
+ def rspec
109
+ gem "rspec-rails", :group => :test, :if => 'test.rspec'
110
+
111
+ if settings.test.rspec?
112
+ gem 'database_cleaner', :group => :test if settings.database?
113
+ gem 'factory_girl_rails', :group => :test if settings.database?
114
+
115
+ template 'rspec', :to => ".rspec"
116
+ template 'spec/factories.rb' if settings.database?
117
+ template 'spec/spec_helper.rb'
118
+ directory 'spec/support'
119
+ end
120
+ end
121
+
122
+ def cucumber
123
+ gem 'cucumber-rails', :group => :test, :if => 'test.cucumber'
124
+
125
+ if settings.test.cucumber?
126
+ gem 'capybara', :group => :test
127
+ gem 'launchy', :group => :test
128
+
129
+ template 'config/cucumber.yml'
130
+ template 'features/step_definitions/email_steps.rb' if settings.email?
131
+ template 'features/step_definitions/web_steps/browsing_steps.rb'
132
+ template 'features/step_definitions/web_steps/debug_steps.rb'
133
+ template 'features/step_definitions/web_steps/form_steps.rb'
134
+ template 'features/step_definitions/web_steps/step_scoper.rb'
135
+
136
+ template 'features/support/email.rb' if settings.email?
137
+ template 'features/support/env.rb'
138
+ template 'features/support/paths.rb'
139
+ template 'features/support/selectors.rb'
140
+ template 'features/support/with_scope.rb'
141
+
142
+ template 'lib/tasks/cucumber.rake'
143
+ end
144
+ end
145
+
146
+ def roodi
147
+ template 'config/roodi.yml', :if => 'test.roodi'
148
+
149
+ if settings.test.roodi?
150
+ gem 'roodi', :group => :test
151
+ end
152
+ end
153
+
154
+ def coverage
155
+ gem 'rcov', :group => :test, :if => 'test.coverage'
156
+ end
157
+
158
+ def production
159
+ template 'config/environments/production.rb', :if => 'production'
160
+ end
161
+
162
+ def exceptions
163
+ gem 'airbrake', :if => 'exceptions.airbrake'
164
+
165
+ if settings.exceptions.airbrake?
166
+ template 'config/initializers/airbrake.rb'
167
+ end
168
+ end
169
+
170
+ def deploy
171
+ gem 'capistrano', :group => :development, :if => 'deploy'
172
+
173
+ if settings.deploy?
174
+ gem 'capistrano-ext', :group => :development
175
+
176
+ template 'config/deploy.rb'
177
+ template 'config/deploy/production.rb' if settings.deploy.production?
178
+ end
179
+ end
180
+
181
+ def scheduler
182
+ gem 'whenever', :if => 'scheduler'
183
+ if settings.scheduler?
184
+ template 'config/schedule.rb'
185
+ end
186
+ end
187
+
188
+ def async
189
+ gem 'delayed_job', :if => 'async.delayed_job'
190
+
191
+ if settings.async.delayed_job?
192
+ script 'script/delayed_job'
193
+
194
+ if settings.database.active_record?
195
+ migration 'create_jobs'
196
+ gem 'delayed_job_active_record'
197
+ end
198
+ end
199
+
200
+ # TODO resque
201
+ end
202
+
203
+ def other
204
+ gem 'kaminari', :if => 'paginate'
205
+ gem 'net_http_exception_fix', :if => 'net.http'
206
+ gem 'crummy', :if => 'breadcrumbs'
207
+ gem 'carrierwave', :if => 'upload'
208
+ end
209
+
210
+ end
211
+
212
+ end
213
+ end
@@ -0,0 +1,5 @@
1
+ module Rapid
2
+ module App
3
+ VERSION = "0.1"
4
+ end
5
+ end
data/lib/rapid/app.rb ADDED
@@ -0,0 +1,13 @@
1
+ module Rapid
2
+ module App
3
+
4
+ class << self
5
+
6
+ def check options = {}
7
+ Rapid::App::Skeleton.new(options).pull
8
+ end
9
+
10
+ end
11
+
12
+ end
13
+ end
data/lib/rapid-app.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'rapid'
2
+ require "rapid/app"
3
+ require "rapid/app/version"
4
+ require "rapid/app/settings"
5
+ require "rapid/app/skeleton"
data/rapid-app.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rapid/app/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rapid-app"
7
+ s.version = Rapid::App::VERSION
8
+ s.authors = ["Dan Cunning"]
9
+ s.email = ["dancunning@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Rapidly maintain and modify your Rails application}
12
+ s.description = %q{Rapidly maintain and modify your Rails application}
13
+
14
+ s.rubyforge_project = "rapid-app"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ s.add_dependency 'rapid-core'
25
+ s.add_dependency 'tzinfo'
26
+
27
+ # TODO inherit these from rapid
28
+ s.add_dependency("activesupport", ">= 3.0")
29
+ s.add_dependency("activemodel", ">= 3.0")
30
+ s.add_dependency("i18n")
31
+ s.add_dependency("erubis")
32
+ s.add_development_dependency "railties"
33
+ end
@@ -0,0 +1,50 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Rapid::App::Skeleton do
4
+
5
+ def new_rails_app version
6
+ FileUtils.rm_rf @skeleton.project_path
7
+ `cd tmp ; rails _#{version}_ new hello_world --skip-bundle`
8
+ end
9
+
10
+ def project_file path
11
+ full_path = File.join @skeleton.project_path, path
12
+ file full_path
13
+ end
14
+
15
+ def template_file path
16
+ full_path = File.join @skeleton.templates_path, path
17
+ file full_path
18
+ end
19
+
20
+ def file path
21
+ File.open(path) {|f| f.read }
22
+ end
23
+
24
+ before do
25
+ @skeleton = Rapid::App::Skeleton.new(:project_path => 'tmp/hello_world')
26
+ end
27
+
28
+ after do
29
+ # FileUtils.rm_rf @skeleton.project_path
30
+ end
31
+
32
+ it "should require a name to push" do
33
+ lambda { @skeleton.push! }.should raise_error(Rapid::InvalidSkeletonError)
34
+ end
35
+
36
+ it "should work for rails 3.2.1" do
37
+ new_rails_app "3.2.1"
38
+
39
+ @skeleton.settings.name = "HelloWorld"
40
+ @skeleton.settings.test.rspec = true
41
+ @skeleton.push!
42
+
43
+ project_file('config.ru').should == %(# This file is used by Rack-based servers to start the application.\n\nrequire ::File.expand_path('../config/environment', __FILE__)\nrun HelloWorld::Application\n)
44
+ project_file('config/cucumber.yml').should include(%(wip: --tags @wip:20 --wip features))
45
+ project_file("Gemfile").should include("gem 'rspec-rails', :group => :test")
46
+ project_file("Gemfile").should include("gem 'rapid-app', :groups => [:development, :test]")
47
+ project_file(".rspec").should == "--color\n--format documentation\n"
48
+ end
49
+
50
+ end
@@ -0,0 +1,12 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Rapid::App do
4
+
5
+ it "should provide a check helper" do
6
+ @skeleton = mock('skeleton')
7
+ Rapid::App::Skeleton.should_receive(:new).and_return(@skeleton)
8
+ @skeleton.should_receive(:pull)
9
+ Rapid::App.check
10
+ end
11
+
12
+ end
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'rspec'
5
+ require 'rapid-app'
6
+ require 'rapid/spec'
7
+
8
+ Dir["spec/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ config.include(MoreStringMatchers)
12
+ end
@@ -0,0 +1,21 @@
1
+ module MoreStringMatchers
2
+
3
+ class EndWith
4
+
5
+ def initialize(expected)
6
+ @expected = expected
7
+ end
8
+
9
+ def matches?(target)
10
+ len = @expected.length
11
+ actual = target[target.length - len..-1]
12
+ actual.should == @expected
13
+ end
14
+
15
+ end
16
+
17
+ def end_with(expected)
18
+ EndWith.new(expected)
19
+ end
20
+
21
+ end
@@ -0,0 +1 @@
1
+ Rapid::Spec::Template.skeleton_class = Rapid::App::Skeleton