bard 0.19.0 → 0.19.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.19.0
1
+ 0.19.1
@@ -6,11 +6,8 @@ Grit::Repo.class_eval do
6
6
  branches.reject! { |b| b == "HEAD" }
7
7
  end
8
8
 
9
- def submodules
10
- Grit::Submodule.config self, self.head.name
11
- end
12
-
13
9
  def find_common_ancestor(head1, head2)
14
10
  `git merge-base #{head1} #{head2}`.chomp
15
11
  end
16
12
  end
13
+
@@ -10,7 +10,6 @@ require 'bard/error'
10
10
  require 'bard/git'
11
11
  require 'bard/io'
12
12
 
13
- require 'bard/check'
14
13
  require 'bard/ssh_delegation'
15
14
 
16
15
  class Bard < Thor
@@ -46,22 +45,6 @@ EOF
46
45
  exec command
47
46
  end
48
47
 
49
- desc "create [PROJECT_NAME]", "create new project"
50
- def create(project_name)
51
- auto_update!
52
- template_path = File.expand_path(File.dirname(__FILE__) + "/bard/template.rb")
53
- command = "rails --template=#{template_path} #{project_name}"
54
- exec command
55
- end
56
-
57
- method_options %w( verbose -v ) => :boolean
58
- desc "check [PROJECT_PATH]", "check current project and environment for missing dependencies and common problems"
59
- def check(project_path = nil)
60
- project_path = "." if project_path.nil? and File.directory? ".git" and File.exist? "config/environment.rb"
61
- auto_update!
62
- check_project project_path if project_path
63
- end
64
-
65
48
  desc "data [FROM=production, TO=local]", "copy database and assets from FROM to TO"
66
49
  def data(from = "production", to = "local")
67
50
  ensure_sanity!(true)
@@ -96,8 +79,6 @@ EOF
96
79
  def push
97
80
  ensure_sanity!
98
81
 
99
- raise SubmoduleDirtyError if submodule_dirty?
100
- raise SubmoduleUnpushedError if submodule_unpushed?
101
82
  raise NonFastForwardError unless fast_forward_merge?("origin/#{current_branch}")
102
83
 
103
84
  run_crucial "git push origin #{current_branch}", true
@@ -217,4 +198,19 @@ EOF
217
198
  raise OnMasterBranchError if current_branch == "master"
218
199
  raise WorkingTreeDirtyError unless `git status`.include? "working directory clean" unless dirty_ok
219
200
  end
201
+
202
+ def auto_update!
203
+ match = `curl -s http://rubygems.org/api/v1/gems/bard.json`.match(/"version":"([0-9.]+)"/)
204
+ return unless match
205
+ required = match[1]
206
+ if Bard::VERSION != required
207
+ original_command = [ENV["_"], @_invocations[Bard].first, ARGV].flatten.join(" ")
208
+ puts "bard gem is out of date... updating to new version"
209
+ exec "gem install bard && #{original_command}"
210
+ end
211
+ if options.verbose?
212
+ puts green("#{"bard".ljust(9)} (#{Bard::VERSION})")
213
+ end
214
+ end
220
215
  end
216
+
@@ -1,7 +1,5 @@
1
1
  class Bard < Thor
2
2
  {
3
- "SubmoduleDirtyError" => "You have uncommitted changes to a submodule!\n Please see Micah about this.",
4
- "SubmoduleUnpushedError" => "You have unpushed changes to a submodule!\n Please see Micah about this.",
5
3
  "NonFastForwardError" => "Someone has pushed some changes since you last pulled.\n Kindly run bard pull, ensure that your your changes still work, and try again",
6
4
  "MasterNonFastForwardError" => "The master branch has advanced since last deploy, probably due to a bugfix.\n Rebase your integration branch on top of it, and check for breakage.",
7
5
  "NotInProjectRootError" => "You are not in the project's root directory!",
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: bard
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.19.0
5
+ version: 0.19.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Micah Geisel
@@ -190,21 +190,10 @@ files:
190
190
  - features/support/io.rb
191
191
  - lib/bard.rb
192
192
  - lib/bard/capistrano.rb
193
- - lib/bard/check.rb
194
193
  - lib/bard/error.rb
195
194
  - lib/bard/git.rb
196
195
  - lib/bard/io.rb
197
196
  - lib/bard/ssh_delegation.rb
198
- - lib/bard/template.rb
199
- - lib/bard/template/adva.rb
200
- - lib/bard/template/authlogic.rb
201
- - lib/bard/template/compass.rb
202
- - lib/bard/template/exception_notifier.rb
203
- - lib/bard/template/gems.rb
204
- - lib/bard/template/helper.rb
205
- - lib/bard/template/initial.rb
206
- - lib/bard/template/static_pages.rb
207
- - lib/bard/template/testing.rb
208
197
  - spec/bard_spec.rb
209
198
  - spec/spec_helper.rb
210
199
  homepage: https://github.com/botandrose/bard
@@ -1,52 +0,0 @@
1
- class Bard < Thor
2
- private
3
- def auto_update!
4
- match = `curl -s http://rubygems.org/api/v1/gems/bard.json`.match(/"version":"([0-9.]+)"/)
5
- return unless match
6
- required = match[1]
7
- if Bard::VERSION != required
8
- original_command = [ENV["_"], @_invocations[Bard].first, ARGV].flatten.join(" ")
9
- puts "bard gem is out of date... updating to new version"
10
- exec "gem install bard && #{original_command}"
11
- end
12
- if options.verbose?
13
- puts green("#{"bard".ljust(9)} (#{Bard::VERSION})")
14
- end
15
- end
16
-
17
- def check_project(project)
18
- errors = []
19
- Dir.chdir project do
20
- status, stdout, stderr = systemu "rake db:abort_if_pending_migrations"
21
- errors << "missing config/database.yml, adapt from config/database.sample.yml." if stderr.include? "config/database.yml"
22
- errors << "missing config/database.sample.yml, please complain to micah" if not File.exist? "config/database.sample.yml"
23
- errors << "missing database, please run `rake db:create db:migrate" if stderr.include? "Unknown database"
24
- errors << "pending migrations, please run `rake db:migrate`" if stdout.include? "pending migrations"
25
-
26
- errors << "missing submodule, please run git submodule update --init" if `git submodule status` =~ /^-/
27
- errors << "submodule has a detached head, please complain to micah" unless system 'git submodule foreach "git symbolic-ref HEAD 1>/dev/null 2>/dev/null"'
28
-
29
- errors << "missing gems, please run `rake gems:install`" if `rake gems` =~ /\[ \]/
30
-
31
- errors << "missing integration branch, please complain to micah" if `git branch` !~ /\bintegration\b/
32
- unless ENV['RAILS_ENV'] == "staging"
33
- errors << "integration branch isnt tracking the remote integration branch, please run `grb track integration`" if `git config branch.integration.merge` !~ %r%\brefs/heads/integration\b%
34
- end
35
- errors << "you shouldn't be working on the master branch, please work on the integration branch" if current_branch == "master"
36
-
37
- errors << "Capfile should not be gitignored" if File.read(".gitignore") =~ /\bCapfile\b/
38
- errors << "config/deploy.rb should not be gitignored" if File.read(".gitignore") =~ /\bconfig\/deploy\.rb\b/
39
- errors << "missing bard rake tasks, please complain to micah" if File.read("Rakefile") !~ /\bbard\/rake\b/
40
- errors << "missing bard capistrano tasks, please complain to micah" if File.read("Capfile") !~ /\bbard\/capistrano\b/
41
- end
42
-
43
- if not errors.empty?
44
- fatal "#{errors.length} problems detected:\n #{errors.join("\n ")}"
45
- else
46
- puts green("No problems detected in project: #{project}")
47
- unless ENV['RAILS_ENV'] == "staging"
48
- puts "please run it on the staging server by typing `cap shell` and then `bard check [PROJECT_NAME]`"
49
- end
50
- end
51
- end
52
- end
@@ -1,9 +0,0 @@
1
- # bard.rb
2
- # bot and rose design rails template
3
- require "bard/template/helper"
4
-
5
- %w(initial gems compass testing exception_notifier static_pages adva).each do |template_file|
6
- bard_load_template template_file
7
- end
8
- system "cd #{project_name}"
9
- puts "Project #{project_name} created! Ask Micah to set up staging server."
@@ -1,59 +0,0 @@
1
- require "bard/template/helper"
2
-
3
- # Download and install Adva CMS
4
- file "script/test-adva-cms", <<-src
5
- #!/usr/bin/env ruby
6
- paths = ARGV.clone
7
- load 'vendor/adva/script/test'
8
- src
9
-
10
- file_inject 'config/environment.rb',
11
- "require File.join(File.dirname(__FILE__), 'boot')",
12
- "require File.join(File.dirname(__FILE__), '../vendor/adva/engines/adva_cms/boot')"
13
-
14
- git :submodule => "add -b bard git@git.botandrose.com:adva.git vendor/adva # this might take a bit, grab a coffee meanwhile :)"
15
- git :submodule => "update --init"
16
- inside("vendor/adva") do
17
- run "git remote add github git://github.com/svenfuchs/adva_cms.git"
18
- run "git checkout -b #{project_name}/integration"
19
- end
20
-
21
- rake "adva:install:core -R vendor/adva/engines/adva_cms/lib/tasks"
22
- rake "adva:assets:install"
23
-
24
- # Use application layout in CMS
25
- inside "app/views/layouts" do
26
- run "ln -s application.html.haml default.html.haml"
27
- end
28
-
29
- # Install FCKEditor plugin
30
- rake "adva:install plugins=adva_fckeditor"
31
- file "config/initializers/fckeditor.rb", <<-src
32
- Fckeditor.load!
33
- src
34
- run "cp public/javascripts/adva_fckeditor/config.js public/javascripts/fck_config.js"
35
- file_append "public/javascripts/fck_config.js", <<-src
36
- FCKConfig.CustomStyles = {};
37
- FCKConfig.StylesXmlPath = '/stylesheets/fck_styles.xml';
38
-
39
- FCKConfig.EditorAreaCSS = '/stylesheets/fck_editor.css';
40
- FCKConfig.BodyClass = '';
41
-
42
- FCKConfig.FirefoxSpellChecker = true;
43
- FCKConfig.BrowserContextMenuOnCtrl = true;
44
- FCKConfig.ForcePasteAsPlainText = true;
45
- src
46
- run "cp public/javascripts/adva_fckeditor/fckeditor/fckstyles.xml public/stylesheets/fck_styles.xml"
47
- file "public/stylesheets/fck_editor.css"
48
-
49
- # Setup FCKEditor upload connector
50
- run "mkdir public/userfiles"
51
- run "chmod 777 public/userfiles"
52
- file "public/userfiles/.gitignore", ""
53
- file_append ".gitignore", <<-src
54
- public/userfiles/*
55
- !public/userfiles/.gitignore
56
- src
57
-
58
- git :add => "."
59
- git :commit => "-m'added adva cms.'"
@@ -1,492 +0,0 @@
1
- require "bard/template/helper"
2
-
3
- # GEMS
4
- #gem 'bcrypt-ruby', :lib => 'bcrypt' # used by authlogic
5
- gem 'authlogic'
6
-
7
- rake "gems:install"
8
- #rake("gems:unpack")
9
-
10
- # APPCTRL/HELPER/FLASH
11
- file_inject 'app/controllers/application_controller.rb',
12
- "class ApplicationController < ActionController::Base", <<-END
13
- filter_parameter_logging :password, :password_confirmation
14
- helper_method :current_user_session, :current_user
15
-
16
- private
17
- def current_user_session
18
- return @current_user_session if defined?(@current_user_session)
19
- @current_user_session = UserSession.find
20
- end
21
-
22
- def current_user
23
- return @current_user if defined?(@current_user)
24
- @current_user = current_user_session && current_user_session.user
25
- end
26
-
27
- def require_user
28
- unless current_user
29
- store_location
30
- flash[:notice] = "You must be logged in!"
31
- redirect_to new_user_session_url
32
- return false
33
- end
34
- end
35
-
36
- def require_no_user
37
- if current_user
38
- store_location
39
- flash[:notice] = "You must be logged out!"
40
- redirect_to account_url
41
- return false
42
- end
43
- end
44
-
45
- def store_location
46
- session[:return_to] = request.request_uri
47
- end
48
-
49
- def redirect_back_or_default(default)
50
- redirect_to(session[:return_to] || default)
51
- session[:return_to] = nil
52
- end
53
-
54
- END
55
-
56
- # AUTHLOGIC
57
- log 'authlogic', 'setup'
58
- generate :session, 'user_session'
59
-
60
- # ROUTES
61
- route %q(map.resources :password_resets)
62
- route %q(map.resources :users)
63
- route %q(map.resource :user_session, :except => [:edit, :update])
64
- route %q(map.login "login", :controller => "user_sessions", :action => "new")
65
- route %q(map.logout "logout", :controller => "user_sessions", :action => "destroy")
66
- route %q(map.register '/register/:activation_code', :controller => 'activations', :action => 'new')
67
- route %q(map.activate '/activate/:id', :controller => 'activations', :action => 'create')
68
- route %q(map.resource :account, :controller => "users")
69
-
70
- # CONTROLLERS
71
- file 'app/controllers/user_sessions_controller.rb', <<-END
72
- class UserSessionsController < ResourceController::Base
73
- actions :new, :create, :destroy
74
-
75
- before_filter :require_no_user, :only => [:new, :create]
76
- before_filter :require_user, :only => :destroy
77
-
78
- create do
79
- flash "Successfully logged in."
80
- wants.html { redirect_back_or_default account_url }
81
-
82
- failure.flash "Bad email or password!"
83
- end
84
-
85
- def destroy
86
- @user_session = UserSession.find
87
- @user_session.destroy
88
- flash[:notice] = "Successfully logged out."
89
- redirect_to root_url
90
- end
91
- end
92
- END
93
-
94
-
95
- file 'app/controllers/users_controller.rb', <<-END
96
- class UsersController < ResourceController::Base
97
- actions :new, :create, :show, :edit, :update
98
-
99
- before_filter :require_no_user, :only => [:new, :create]
100
- before_filter :require_user, :only => [:show, :edit, :update]
101
-
102
- def create
103
- @user = User.new
104
-
105
- if @user.signup!(params)
106
- @user.deliver_activation_instructions!
107
- flash[:notice] = "Thanks for signing up! Please check your email for activation instructions."
108
- redirect_to root_url
109
- else
110
- render :action => :new
111
- end
112
- end
113
-
114
- update.wants.html { redirect_to account_path }
115
-
116
- private
117
- def object
118
- @object ||= current_user
119
- end
120
- end
121
- END
122
-
123
- file 'app/controllers/activations_controller.rb', <<-END
124
- class ActivationsController < ApplicationController
125
- before_filter :require_no_user, :only => [:new, :create]
126
-
127
- def new
128
- @user = User.find_using_perishable_token(params[:activation_code], 1.week) || (raise Exception)
129
- raise Exception if @user.active?
130
- end
131
-
132
- def create
133
- @user = User.find(params[:id])
134
-
135
- raise Exception if @user.active?
136
-
137
- if @user.activate!(params)
138
- @user.deliver_activation_confirmation!
139
- flash[:notice] = "Your account has been activated!"
140
- redirect_to account_url
141
- else
142
- render :action => :new
143
- end
144
- end
145
-
146
- end
147
- END
148
-
149
- file 'app/controllers/password_resets_controller.rb', <<-END
150
- class PasswordResetsController < ApplicationController
151
- before_filter :load_user_using_perishable_token, :only => [:edit, :update]
152
- before_filter :require_no_user
153
-
154
- def new
155
- render
156
- end
157
-
158
- def create
159
- @user = User.find_by_email(params[:email])
160
- if @user
161
- @user.deliver_password_reset_instructions!
162
- flash[:notice] = "Check your email for password reset instructions."
163
- redirect_to root_url
164
- else
165
- flash[:notice] = "No account found for \#{params[:email]}."
166
- render :action => :new
167
- end
168
- end
169
-
170
- def edit
171
- render
172
- end
173
-
174
- def update
175
- @user.password = params[:user][:password]
176
- @user.password_confirmation = params[:user][:password_confirmation]
177
- if @user.save
178
- flash[:notice] = "Your password has been reset!"
179
- redirect_to account_url
180
- else
181
- render :action => :edit
182
- end
183
- end
184
-
185
- private
186
- def load_user_using_perishable_token
187
- @user = User.find_using_perishable_token(params[:id])
188
- unless @user
189
- flash[:notice] = "Bad key."
190
- redirect_to root_url
191
- end
192
- end
193
- end
194
-
195
- END
196
-
197
-
198
- # MIGRATIONS
199
- file "db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_create_users.rb", <<-END
200
- class CreateUsers < ActiveRecord::Migration
201
- def self.up
202
- create_table :users, :force => true do |t|
203
- t.string :email, :null => false
204
- t.string :crypted_password, :default => nil, :null => true
205
- t.string :password_salt, :default => nil, :null => true
206
- t.string :perishable_token, :default => "", :null => false
207
- t.string :persistence_token, :null => false
208
- t.integer :login_count, :default => 0, :null => false
209
- t.datetime :last_request_at
210
- t.datetime :last_login_at
211
- t.datetime :current_login_at
212
- t.string :last_login_ip
213
- t.string :current_login_ip
214
- t.boolean :active, :default => false
215
- t.timestamps
216
- end
217
-
218
- add_index :users, :email
219
- add_index :users, :persistence_token
220
- add_index :users, :perishable_token
221
- add_index :users, :last_request_at
222
- end
223
-
224
- def self.down
225
- drop_table :users
226
- end
227
- end
228
- END
229
-
230
- file "app/models/user.rb", <<-END
231
- class User < ActiveRecord::Base
232
- attr_accessible :email, :password, :password_confirmation
233
-
234
- acts_as_authentic do |c|
235
- c.validates_length_of_password_field_options = {:on => :update, :minimum => 4, :if => :has_no_credentials?}
236
- c.validates_length_of_password_confirmation_field_options = {:on => :update, :minimum => 4, :if => :has_no_credentials?}
237
- end
238
-
239
- def has_no_credentials?
240
- self.crypted_password.blank? && self.openid_identifier.blank?
241
- end
242
-
243
- # User creation/activation
244
- def signup!(params)
245
- self.email = params[:user][:email]
246
- save_without_session_maintenance
247
- end
248
-
249
- def activate!(params)
250
- self.active = true
251
- self.password = params[:user][:password]
252
- self.password_confirmation = params[:user][:password_confirmation]
253
- save
254
- end
255
-
256
- # Email notifications
257
- def deliver_password_reset_instructions!
258
- reset_perishable_token!
259
- UserNotifier.deliver_password_reset_instructions(self)
260
- end
261
-
262
- def deliver_activation_instructions!
263
- reset_perishable_token!
264
- UserNotifier.deliver_activation_instructions(self)
265
- end
266
-
267
- def deliver_activation_confirmation!
268
- reset_perishable_token!
269
- UserNotifier.deliver_activation_confirmation(self)
270
- end
271
-
272
- # Helper methods
273
- def active?
274
- active
275
- end
276
-
277
- end
278
- END
279
-
280
- # VIEWS
281
- file 'app/views/activations/new.html.haml', <<-END
282
- %h1 Activate your account
283
- - form_for @user, :url => activate_path(@user.id), :html => { :method => :post} do |form|
284
- = form.error_messages
285
- = render :partial => "form", :locals => { :form => form }
286
- = form.submit "Activate"
287
- END
288
-
289
- file 'app/views/activations/_form.html.haml', <<-END
290
- = form.label :email
291
- %br
292
- =h @user.email
293
- %br
294
- %br
295
- = form.label :password, "Choose a password"
296
- %br
297
- = form.password_field :password
298
- %br
299
- %br
300
- = form.label :password_confirmation
301
- %br
302
- = form.password_field :password_confirmation
303
- %br
304
- %br
305
- END
306
-
307
- file 'app/views/user_sessions/new.html.haml', <<-END
308
- %h1 Login
309
- - form_for @user_session, :url => user_session_path do |f|
310
- = f.error_messages
311
- = f.label :email
312
- %br
313
- = f.text_field :email
314
- %br
315
- %br
316
- = f.label :password
317
- %br
318
- = f.password_field :password
319
- %br
320
- %br
321
- = f.check_box :remember_me
322
- = f.label :remember_me
323
- %br
324
- %br
325
- = f.submit "Login"
326
-
327
- = link_to "Sign up", new_account_path
328
- END
329
-
330
- file 'app/views/password_resets/new.html.haml', <<-END
331
- %h1 Forgot your password?
332
-
333
- - form_tag password_resets_path do
334
- %label Email address
335
- %br
336
- = text_field_tag :email
337
- %br
338
- = submit_tag "Reset"
339
- END
340
-
341
- file 'app/views/password_resets/edit.html.haml', <<-END
342
- %h1 Choose a new password
343
-
344
- - form_for @user, :url => password_reset_path, :method => :put do |f|
345
- = f.error_messages
346
- %br
347
- = f.label :password
348
- %br
349
- = f.password_field :password
350
- %br
351
- %br
352
- = f.label :password_confirmation
353
- %br
354
- = f.password_field :password_confirmation
355
- %br
356
- %br
357
- = f.submit "Save new password"
358
- END
359
-
360
-
361
- file 'app/views/users/_form.html.haml', <<-END
362
- = form.label :email
363
- %br
364
- = form.text_field :email
365
- %br
366
- %br
367
- - unless form.object.new_record?
368
- = form.label :password, form.object.new_record? ? nil : "Change password"
369
- %br
370
- = form.password_field :password
371
- %br
372
- %br
373
- = form.label :password_confirmation
374
- %br
375
- = form.password_field :password_confirmation
376
- %br
377
- %br
378
- END
379
-
380
- file 'app/views/users/edit.html.haml', <<-END
381
- %h1 My Account
382
-
383
- - form_for @user, :url => account_path do |f|
384
- = f.error_messages
385
- = render :partial => "form", :object => f
386
- = f.submit "Update"
387
- %br
388
- = link_to "My account", account_path
389
- END
390
-
391
- file 'app/views/users/new.html.haml', <<-END
392
- %h1 Sign Up
393
-
394
- - form_for @user, :url => account_path do |f|
395
- = f.error_messages
396
- = render :partial => "form", :object => f
397
- = f.submit "Sign Up"
398
- END
399
-
400
- file 'app/views/users/show.html.haml', <<-END
401
- %p
402
- %b
403
- Email:
404
- = h @user.email
405
- %p
406
- %b
407
- Login count:
408
- = h @user.login_count
409
- %p
410
- %b
411
- Last request at:
412
- = h @user.last_request_at
413
- %p
414
- %b
415
- Last login at:
416
- = h @user.last_login_at
417
- %p
418
- %b
419
- Current login at:
420
- = h @user.current_login_at
421
- %p
422
- %b
423
- Last login ip:
424
- = h @user.last_login_ip
425
- %p
426
- %b
427
- Current login ip:
428
- = h @user.current_login_ip
429
- = link_to 'Edit', edit_account_path
430
-
431
- END
432
-
433
- # AUTHLOGIC Email Notifier
434
- generate :mailer, "user_notifier"
435
- file 'app/models/user_notifier.rb', <<-END
436
- class UserNotifier < ActionMailer::Base
437
-
438
- default_url_options[:host] = "localhost:3000"
439
-
440
- def activation_confirmation(user)
441
- setup_email user
442
- subject "[#{project_name}] Account activated!"
443
- body :root_url => root_url
444
- end
445
-
446
- def activation_instructions(user)
447
- setup_email user
448
- subject "[#{project_name}] Welcome!"
449
- body :account_activation_url => register_url(user.perishable_token)
450
- end
451
-
452
- def password_reset_instructions(user)
453
- setup_email user
454
- subject "[#{project_name}] Forgot your password?"
455
- body :edit_password_reset_url => edit_password_reset_url(user.perishable_token)
456
- end
457
-
458
-
459
- protected
460
- def setup_email(user)
461
- recipients user.email
462
- from "#{project_name} Notifier <noreply@#{project_name}>"
463
- sent_on Time.now
464
- body :user => user
465
- end
466
- end
467
- END
468
-
469
- # Authlogic mailer views (RO)
470
- file 'app/views/user_notifier/activation_instructions.erb', <<-END
471
- Thanks for signing up!
472
-
473
- Please visit the following link to activate your account: <%= @account_activation_url %>
474
- END
475
-
476
- file 'app/views/user_notifier/activation_confirmation.erb', <<-END
477
- Your account has been activated!
478
-
479
- You may log in here: <%= @root_url %>
480
- END
481
-
482
- file 'app/views/user_notifier/password_reset_instructions.erb', <<-END
483
- Forgot your password?
484
-
485
- Visit the following link to change it to something new: <%= @edit_password_reset_url %>
486
- END
487
-
488
- # DATABASE & MIGRATIONS
489
- rake "db:migrate"
490
-
491
- git :add => "."
492
- git :commit => "-am'added authentication.'"
@@ -1,140 +0,0 @@
1
- run "compass init rails . --sass-dir=app/stylesheets --css-dir public/stylesheets"
2
-
3
- file "app/stylesheets/application.sass", <<-END
4
- @import "constant"
5
-
6
- @import "blueprint"
7
- @import "compass/reset"
8
- @import "compass/utilities"
9
- @import "compass/layout"
10
-
11
- =blueprint($body_selector = "body")
12
- +blueprint-typography($body_selector)
13
- +blueprint-utilities
14
- +blueprint-debug
15
- +blueprint-interaction
16
- +blueprint-colors
17
-
18
- @import "general"
19
- END
20
-
21
- file "app/stylesheets/_constant.sass", <<-END
22
- $blueprint_grid_columns: 24
23
- $blueprint_grid_width: 30px
24
- $blueprint_grid_margin: 10px
25
-
26
- $primaryColor: blue
27
-
28
- =box-shadow( $blur, $color )
29
- -moz-box-shadow: 0px 0px $blur $color
30
- -webkit-box-shadow: 0px 0px $blur $color
31
- =text-shadow($px, $color)
32
- text-shadow: 0px 0px $px $color
33
- =border-radius( $radius )
34
- -moz-border-radius: $radius
35
- -webkit-border-radius: $radius
36
- border-radius: $radius
37
- =border-radius-specific( $location1, $location2, $radius )
38
- -moz-border-radius-\#{$location1}\#{$location2}: $radius
39
- -webkit-border-\#{$location1}-\#{$location2}-radius: $radius
40
- border-\#{$location1}-\#{$location2}-radius: $radius
41
- END
42
-
43
- file "app/stylesheets/_general.sass", <<-END
44
- body
45
- font: 13px normal Arial, sans-serif
46
- color: #373737
47
-
48
- .bold, b, strong
49
- font-weight: bold
50
-
51
- a
52
- text-decoration: none
53
- color: $primaryColor
54
- img
55
- border: 1px solid transparent
56
-
57
- p
58
- margin: 12px 0
59
- line-height: 1.4
60
- text-align: justify
61
-
62
- ul, ol, li
63
- margin: 0
64
- padding: 0
65
-
66
- h1, h2, h3, h4, h5, h6
67
- margin: 0
68
- padding: 0
69
-
70
- h2, h3, h4
71
- text-transform: uppercase
72
-
73
- h2, h3
74
- color: black
75
-
76
- h2
77
- font: 2em bold "Arial Black"
78
- line-height: 1
79
- a
80
- color: black
81
- &:hover
82
- color: $primaryColor
83
-
84
- h3
85
- font-weight: bold
86
- font-size: 1.1em
87
-
88
- h4
89
- font-size: 0.9em
90
- border-bottom: 1px solid #3f3f3f
91
- color: #3f3f3f
92
- margin-bottom: 9px
93
-
94
- // tables
95
-
96
- table
97
- border-collapse: none
98
- margin-bottom: 6px
99
- tr.even
100
- background: #ebebeb
101
- td
102
- line-height: 1.25
103
- vertical-align: top
104
-
105
- // forms
106
-
107
- .field
108
- margin: 0px 0 10px
109
-
110
- label
111
- display: inline-block
112
- width: 120px
113
- text-align: right
114
- margin-right: 9px
115
- &.reqd
116
- font-weight: bold
117
- font-style: normal
118
- &.opt
119
- color: #666666
120
-
121
- select
122
- width: 130px
123
-
124
- input, select
125
- &.sm
126
- width: 60px
127
- &.lg
128
- width: 407px
129
- &+label
130
- width: auto
131
- margin-left: 9px
132
- &.radio
133
- &+label
134
- font-size: 1em
135
- text-transform: inherit
136
- color: #242424
137
- margin-left: 0
138
- END
139
-
140
- run "compass compile"
@@ -1,21 +0,0 @@
1
- require "bard/template/helper"
2
-
3
- git :clone => "git://github.com/rails/exception_notification.git vendor/plugins/exception_notification"
4
- inside "vendor/plugins/exception_notification" do
5
- run "git checkout origin/2-3-stable"
6
- run "rm -rf .git"
7
- end
8
-
9
- file_inject "app/controllers/application_controller.rb",
10
- "class ApplicationController < ActionController::Base", <<-END
11
- include ExceptionNotification::Notifiable
12
-
13
- END
14
-
15
- file_append "config/environment.rb", <<-END
16
-
17
- ExceptionNotification::Notifier.exception_recipients = %w(micah@botandrose.com)
18
- END
19
-
20
- git :add => "."
21
- git :commit => "-m'added exception notifier.'"
@@ -1,83 +0,0 @@
1
- # Install .rvmrc
2
- run "rvm use ree-1.8.7-2010.02@#{project_name} --rvmrc --create"
3
- begin
4
- require "rvm"
5
- RVM.gemset_use! project_name
6
- rescue LoadError
7
- end
8
-
9
- # Install bundler files
10
- file "Gemfile", <<-END
11
- source "http://gemcutter.org"
12
-
13
- gem "rails", "2.3.5"
14
- gem "ruby-mysql"
15
- gem "bard-rake", :require => false
16
- gem "ruby-debug", :group => [:development, :test, :cucumber]
17
-
18
- gem "haml", "~>3.0"
19
- gem "compass", "~>0.10"
20
-
21
- group :test, :cucumber do
22
- gem "autotest-rails"
23
- gem "rspec-rails", "~>1.3", :require => false
24
- gem "machinist"
25
- gem "faker"
26
- end
27
-
28
- group :cucumber do
29
- gem "cucumber-rails", :require => false
30
- gem "webrat"
31
- gem "database_cleaner"
32
- gem "pickle"
33
- gem "email_spec"
34
- end
35
- END
36
- run "bundle install --relock"
37
-
38
- file_inject "config/boot.rb",
39
- "# All that for this:", <<-END, :before
40
- class Rails::Boot
41
- def run
42
- load_initializer
43
-
44
- Rails::Initializer.class_eval do
45
- def load_gems
46
- @bundler_loaded ||= Bundler.require :default, Rails.env
47
- end
48
- end
49
-
50
- Rails::Initializer.run(:set_load_path)
51
- end
52
- end
53
-
54
- END
55
-
56
- file "config/preinitializer.rb", <<-END
57
- begin
58
- require "rubygems"
59
- require "bundler"
60
- rescue LoadError
61
- raise "Could not load the bundler gem. Install it with `gem install bundler`."
62
- end
63
-
64
- if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
65
- raise RuntimeError, "Your bundler version is too old." +
66
- "Run `gem install bundler` to upgrade."
67
- end
68
-
69
- begin
70
- # Install dependencies if needed
71
- `bundle check`
72
- system "bundle install" if not $?.success?
73
- # Set up load paths for all bundled gems
74
- ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
75
- Bundler.setup
76
- rescue Bundler::GemNotFound
77
- raise RuntimeError, "Bundler couldn't find some gems." +
78
- "Did you run `bundle install`?"
79
- end
80
- END
81
-
82
- file "config/setup_load_paths.rb", ""
83
-
@@ -1,28 +0,0 @@
1
- module Rails
2
- class TemplateRunner
3
-
4
- def project_name
5
- @root.split("/").last
6
- end
7
-
8
- def file_append(file, data)
9
- log 'file_append', file
10
- append_file(file, "\n#{data}")
11
- end
12
-
13
- def file_inject(file_name, sentinel, string, before_after=:after)
14
- log 'file_inject', file_name
15
- gsub_file file_name, /(#{Regexp.escape(sentinel)})/mi do |match|
16
- if :after == before_after
17
- "#{match}\n#{string}"
18
- else
19
- "#{string}\n#{match}"
20
- end
21
- end
22
- end
23
-
24
- def bard_load_template(template_file)
25
- load_template Gem.required_location "bard", "bard/template/#{template_file}.rb"
26
- end
27
- end
28
- end
@@ -1,141 +0,0 @@
1
- # delete unnecessary files
2
- run "rm README"
3
- run "rm public/index.html"
4
- run "rm public/favicon.ico"
5
- run "rm public/robots.txt"
6
- run "rm -f public/javascripts/*"
7
- run "rm -rf test"
8
- run "rm -rf doc"
9
-
10
- # Install plugins
11
- plugin "limerick_rake", :git => "git://github.com/botandrose/limerick_rake.git"
12
- plugin "acts_as_list", :git => "git://github.com/rails/acts_as_list.git"
13
- plugin 'asset_packager', :git => 'git://github.com/sbecker/asset_packager.git'
14
- #plugin 'fckeditor', :git => 'git://github.com/originofstorms/fckeditor.git'
15
-
16
- # Set up databases
17
- file "config/database.sample.yml", <<-END
18
- login: &login
19
- adapter: mysql
20
- database: #{project_name}
21
- username: root
22
- password:
23
- socket: /var/run/mysqld/mysqld.sock
24
-
25
- development:
26
- <<: *login
27
-
28
- test:
29
- <<: *login
30
- database: #{project_name}_test
31
-
32
- staging:
33
- <<: *login
34
-
35
- production:
36
- <<: *login
37
- END
38
- run "cp config/database.sample.yml config/database.yml"
39
-
40
- rake "db:create"
41
- rake "db:migrate"
42
-
43
- # Staging Environment
44
- run "cp config/environments/development.rb config/environments/staging.rb"
45
-
46
- # application.html.haml
47
- file "app/views/layouts/application.html.haml", <<-END
48
- !!!
49
- %html{html_attrs('en-US')}
50
- %head
51
- %meta(http-equiv="Content-Type" content="text/html; charset=utf-8")
52
- %title
53
- #{project_name}
54
- = yield :title
55
- %meta(name="keywords" content="")
56
- %meta(name="description" content="")
57
-
58
- = stylesheet_link_merged :base
59
- = yield :css
60
- /[if lte IE 7]
61
- = stylesheet_link_merged :ie
62
-
63
- %link(rel="shortcut icon" href="\#{image_path("/favicon.png")}" type="image/png")
64
-
65
- %body
66
- #container
67
- = yield
68
- - if flash[:notice]
69
- #flash_notice= flash[:notice]
70
- - if flash[:error]
71
- #flash_error= flash[:error]
72
-
73
- = javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
74
- = javascript_include_merged :base
75
- = yield :js
76
- END
77
-
78
- file "public/javascripts/application.js", <<-END
79
- $(function() {
80
- });
81
- END
82
-
83
- file "config/asset_packages.yml", <<-END
84
- ---
85
- javascripts:
86
- - base:
87
- - application
88
- stylesheets:
89
- - base:
90
- - screen
91
- - application
92
- - ie:
93
- - ie
94
- END
95
-
96
- plugin "input_css", :git => "git://github.com/rpheath/input_css.git"
97
-
98
- # Set up git repository
99
- run "touch tmp/.gitignore log/.gitignore vendor/.gitignore"
100
- run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore}
101
- file '.gitignore', <<-END
102
- .bundle
103
- log/*.log
104
- tmp/*
105
- !tmp/.gitignore
106
- .DS_Store
107
- public/cache/**/*
108
- doc/api
109
- doc/app
110
- doc/spec/*
111
- db/data.*
112
- db/*.sqlite3
113
- config/database.yml
114
- converage/**/*
115
- public/stylesheets/*.css
116
- *[~]
117
- END
118
-
119
- # Deployment and staging setup
120
- file_append "Rakefile", <<-END
121
-
122
- require 'bard/rake'
123
- END
124
-
125
- file "Capfile", <<-END
126
- Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
127
- require 'bard/capistrano'
128
- load 'config/deploy'
129
- END
130
-
131
- file "config/deploy.rb", <<-END
132
- set :application, "#{project_name}"
133
- END
134
-
135
- git :init
136
- git :add => "."
137
- git :commit => "-m'initial commit.'"
138
- git :checkout => "-b integration"
139
-
140
- git :remote => "add origin git@git.botandrose.com:#{project_name}.git"
141
- # run "cap staging:bootstrap"
@@ -1,29 +0,0 @@
1
- require "bard/template/helper"
2
-
3
- # Set up static controller
4
- file "app/controllers/static_controller.rb", <<-END
5
- class StaticController < ApplicationController
6
- def dispatch
7
- view_template_path = "/static/"+params[:path].join("/")
8
- begin
9
- render view_template_path, :layout => true
10
- rescue ActionView::MissingTemplate
11
- begin
12
- render view_template_path+"/index", :layout => true
13
- rescue ActionView::MissingTemplate
14
- raise ActiveRecord::RecordNotFound
15
- end
16
- end
17
- end
18
- end
19
- END
20
-
21
- route "map.connect '*path', :controller => 'static', :action => 'dispatch'"
22
- route "map.root :controller => 'static', :action => 'dispatch', :path => ['index']"
23
-
24
- file "app/views/static/index.html.haml", <<-END
25
- %h1 #{project_name}
26
- END
27
-
28
- git :add => "."
29
- git :commit => "-m'static controller.'"
@@ -1,44 +0,0 @@
1
- require "bard/template/helper"
2
-
3
- plugin "cucumber_rails_debug", :git => "git://github.com/mischa/cucumber_rails_debug"
4
-
5
- generate "rspec"
6
- generate "cucumber"
7
- generate "email_spec"
8
- generate "pickle"
9
-
10
- file "features/support/blueprints.rb", <<-END
11
- require "machinist/active_record"
12
- require "faker"
13
-
14
- Sham.name { Faker::Name.name }
15
- Sham.email { Faker::Internet.email }
16
- Sham.sentence { Faker::Lorem.sentence }
17
- Sham.paragraph { Faker::Lorem.paragraph }
18
- Sham.url { "http://\#{Faker::Internet.domain_name}/\#{Faker::Lorem.words(3).join('_').downcase}" }
19
-
20
- Sham.address { Faker::Address.street_address }
21
- Sham.city { Faker::Address.city }
22
- Sham.zip { Faker::Address.zip_code }
23
- Sham.phone { Faker::PhoneNumber.phone_number }
24
- END
25
- run "ln -s features/support/blueprints.rb spec/blueprints.rb"
26
-
27
- file "features/support/debug.rb", <<-END
28
- require "ruby-debug"
29
- require "cucumber_rails_debug/steps"
30
- END
31
-
32
- file "features/support/email.rb", <<-END
33
- # Email testing helpers
34
- require "email_spec"
35
- require "email_spec/cucumber"
36
- END
37
-
38
- run "rake db:create RAILS_ENV=test"
39
-
40
- git :add => "."
41
- git :commit => "-m'added rspec and cucumber setups.'"
42
-
43
- # run "cap stage"
44
- # run "cap staging:bootstrap:ci"