This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
forked from RoxasShadow/devise_invitations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
magic.sh
executable file
·83 lines (61 loc) · 1.96 KB
/
magic.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
##
# Hello, I'm a magical little girl in aid of CI-kun.
# I'll create and setup a new Rails application from scratch so CI-kun
# can test it. Bye-chi!
##
gem install rails
rails new test_app
cd test_app
echo "gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'letter_opener'
gem 'faker'
gem 'devise'
gem 'devise_invitable'
gem 'devise_invitations', path: '../'
" >> Gemfile
echo "`sed '45d' Gemfile`" > Gemfile # spring a shit
bundle install
rails g rspec:install
# we need a root_path
rails g controller welcome index
contents="root 'welcome#index'"
echo "`sed \"8s/^/$contents/\" config/routes.rb`" > config/routes.rb
rails g model user
rails g mailer UserMailer # we need an ApplicationMailer too
rails g devise:install
rails g devise user
rails g devise_invitable:install
rails g devise_invitable user
## Uncomment these to check the diff later
# git init
# git add .
# git commit -m "Initial commit"
rails g devise_invitations:install
rails g devise_invitations:specs
rake db:migrate
# Enable FactoryGirl and Shoulda
echo "
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
" >> spec/rails_helper.rb
echo "FactoryGirl.define do
factory :user do
email { Faker::Internet.safe_email }
password { Faker::Internet.password(8) }
end
end
" > spec/factories/users.rb
contents="config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }"
echo "`sed \"39s/^/$contents/\" config/environments/test.rb`" > config/environments/test.rb
contents="config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }"
echo "`sed \"38s/^/$contents/\" config/environments/development.rb`" > config/environments/development.rb
contents="config.action_mailer.delivery_method = :letter_opener"
echo "`sed \"33s/^/$contents/\" config/environments/development.rb`" > config/environments/development.rb