Class: Rapid::App::Skeleton

Inherits:
Skeleton::Base
  • Object
show all
Defined in:
lib/rapid/app/skeleton.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Skeleton

Returns a new instance of Skeleton.



9
10
11
# File 'lib/rapid/app/skeleton.rb', line 9

def initialize options = {}
  super App::Settings.new, options.reverse_merge(:file => __FILE__)
end

Instance Method Details

#analyticsObject



193
194
195
196
# File 'lib/rapid/app/skeleton.rb', line 193

def analytics
  directory 'app/helpers/analytics', :if => 'analytics'
  template 'app/helpers/analytics/google_helper.rb', :if => 'analytics.google'
end

#assetsObject



55
56
57
58
59
60
# File 'lib/rapid/app/skeleton.rb', line 55

def assets
  gem 'sass-rails', :group => :assets, :if => 'assets'
  
  gem 'coffee-rails', :group => :assets, :if => 'assets'
  gem 'uglifier', :group => :assets, :if => 'assets'
end

#asyncObject



172
173
174
175
176
177
178
179
180
181
# File 'lib/rapid/app/skeleton.rb', line 172

def async
  gem 'delayed_job', :if => 'async.delayed_job'
  
  script 'script/delayed_job', :if => 'async.delayed_job'
  # migration 'create_jobs',     :if => 'async.delayed_job'
  
  gem 'delayed_job_active_record', :if => ['async.delayed_job', 'database.active_record']
  
  # TODO resque
end

#bonesObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rapid/app/skeleton.rb', line 13

def bones
  section :rails
  section :assets
  section :email
  section :database
  section :development
  section :test
  section :production
  section :exceptions
  section :deploy
  section :scheduler
  section :async
  section :other
  
  true
end

#coverageObject



143
144
145
# File 'lib/rapid/app/skeleton.rb', line 143

def coverage
  gem 'rcov', :group => :test, :if => 'test.coverage'
end

#cucumberObject



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/rapid/app/skeleton.rb', line 115

def cucumber
  gem 'cucumber-rails', :group => :test, :if => 'test.cucumber'
  gem 'capybara', :group => :test,       :if => 'test.cucumber'
  gem 'launchy', :group => :test,       :if => 'test.cucumber'
  
  template 'config/cucumber.yml', :if => 'test.cucumber'
  
  directory 'features', :if => 'test.cucumber'
  template 'features/step_definitions/email_steps.rb',              :if => ['test.cucumber', 'email']
  template 'features/step_definitions/web_steps/browsing_steps.rb', :if => 'test.cucumber'
  template 'features/step_definitions/web_steps/debug_steps.rb',    :if => 'test.cucumber'
  template 'features/step_definitions/web_steps/form_steps.rb',     :if => 'test.cucumber'
  template 'features/step_definitions/web_steps/step_scoper.rb',    :if => 'test.cucumber'
  
  template 'features/support/email.rb',      :if => ['test.cucumber', 'email']
  template 'features/support/env.rb',        :if => 'test.cucumber'
  template 'features/support/paths.rb',      :if => 'test.cucumber'
  template 'features/support/selectors.rb',  :if => 'test.cucumber'
  template 'features/support/with_scope.rb', :if => 'test.cucumber'
  
  template 'lib/tasks/cucumber.rake', :if => 'test.cucumber'
end

#databaseObject



70
71
72
73
74
75
76
77
78
79
# File 'lib/rapid/app/skeleton.rb', line 70

def database
  directory 'db/migrate', :if => 'database.active_record'
  
  gem 'sqlite3', :if => 'database.sqlite3'
  gem 'mysql',  :if => 'database.mysql'
  
  gem 'mongoid', :if => 'database.mongoid'
  gem 'bson_ext', :if => 'database.mongoid'
  gem 'SystemTimer', :if => 'database.mongoid'
end

#deployObject



157
158
159
160
161
162
163
164
165
# File 'lib/rapid/app/skeleton.rb', line 157

def deploy
  gem 'capistrano',     :group => :development, :if => 'deploy.capistrano'
  gem 'capistrano-ext', :group => :development, :if => 'deploy.capistrano'
  
  template 'config/deploy.rb',            :if => 'deploy.capistrano'
  template 'config/deploy/production.rb', :if => ['deploy', 'deploy.capistrano.production']
  
  directory 'config/deploy', :if => 'deploy.capistrano'
end

#developmentObject



81
82
83
# File 'lib/rapid/app/skeleton.rb', line 81

def development
  template 'config/environments/development.rb', :if => 'development'
end

#emailObject



62
63
64
65
66
67
68
# File 'lib/rapid/app/skeleton.rb', line 62

def email
  template 'config/initializers/email.rb', :if => 'email.smtp'
  
  template 'app/mailers/test_mailer.rb', :if => 'email.test'
  template 'lib/tasks/test_mailer.rake', :if => 'email.test'
  view     'test_mailer/test_email.text.erb', :if => 'email.test'
end

#exceptionsObject



151
152
153
154
155
# File 'lib/rapid/app/skeleton.rb', line 151

def exceptions
  gem 'airbrake', :if => 'exceptions.airbrake'
  
  template 'config/initializers/airbrake.rb', :if => 'exceptions.airbrake'
end

#otherObject



183
184
185
186
187
188
189
190
191
# File 'lib/rapid/app/skeleton.rb', line 183

def other
  gem 'kaminari', :if => 'paginate'
  gem 'net_http_exception_fix', :if => 'net.http'
  gem 'fakeweb', :group => :test, :if => ['net.http', 'test']
  gem 'crummy', :if => 'breadcrumbs'
  gem 'carrierwave', :if => 'upload'
  gem 'haml', :if => 'haml'
  analytics
end

#productionObject



147
148
149
# File 'lib/rapid/app/skeleton.rb', line 147

def production
  template 'config/environments/production.rb', :if => 'production'
end

#railsObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rapid/app/skeleton.rb', line 30

def rails
  gem 'rails', '3.2.1'
  
  template 'app/controllers/application_controller.rb'
  template 'app/helpers/application_helper.rb'
  template 'config/application.rb'
  template 'config/boot.rb'
  template 'config/environment.rb'
  template 'config/routes.rb'
  template 'config.ru'
  
  template 'config/initializers/backtrace_silencers.rb'
  template 'config/initializers/mime_types.rb'
  template 'config/initializers/secret_token.rb'
  template 'config/initializers/session_store.rb'
  template 'config/initializers/wrap_parameters.rb'
  
  script   'script/rails'
  
  directory 'doc'
  directory 'lib/tasks'
  directory 'log'
  directory 'tmp'
end

#roodiObject



138
139
140
141
# File 'lib/rapid/app/skeleton.rb', line 138

def roodi
  template 'config/roodi.yml',  :if => 'test.roodi'
  gem 'roodi', :group => :test, :if => 'test.roodi'
end

#rspecObject



102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/rapid/app/skeleton.rb', line 102

def rspec
  gem "rspec-rails", :group => :test, :if => 'test.rspec'
  
  gem 'database_cleaner', :group => :test,   :if => ['test.rspec', 'database']
  gem 'factory_girl_rails', :group => :test, :if => ['test.rspec', 'database']
  
  template 'rspec', :to => '.rspec', :if => 'test.rspec'
  template 'spec/factories.rb',      :if => ['test.rspec', 'database']
  template 'spec/spec_helper.rb',    :if => 'test.rspec'
  directory 'spec/support',          :if => 'test.rspec'
  directory 'spec',                  :if => 'test.rspec'
end

#schedulerObject



167
168
169
170
# File 'lib/rapid/app/skeleton.rb', line 167

def scheduler
  gem 'whenever', :if => 'scheduler'
  template 'config/schedule.rb', :if => 'scheduler'
end

#testObject



85
86
87
88
89
90
91
92
93
94
95
# File 'lib/rapid/app/skeleton.rb', line 85

def test
  template 'config/environments/test.rb', :if => 'test'
  
  section :test_unit
  section :rspec
  section :cucumber
  section :roodi
  section :coverage
  
  template 'lib/tasks/test.rake', :if => 'test.rake.all'
end

#test_unitObject



97
98
99
100
# File 'lib/rapid/app/skeleton.rb', line 97

def test_unit
  directory 'test', :if => 'test.unit'
  template 'test/test_helper.rb', :if => 'test.unit'
end