preseason 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +95 -70
  3. data/README.md +6 -4
  4. data/lib/preseason.rb +9 -3
  5. data/lib/preseason/config/authentication.rb +1 -7
  6. data/lib/preseason/config/bitters.rb +19 -0
  7. data/lib/preseason/config/bourbon.rb +19 -0
  8. data/lib/preseason/config/templating.rb +25 -0
  9. data/lib/preseason/recipe/bitters.rb +15 -0
  10. data/lib/preseason/recipe/bourbon.rb +18 -0
  11. data/lib/preseason/recipe/gemfile.rb +34 -11
  12. data/lib/preseason/recipe/zeus_rspec.rb +20 -0
  13. data/lib/preseason/templates/spec/spec_helper.erb +30 -20
  14. data/lib/preseason/templates/zeus/custom_plan.erb +12 -0
  15. data/lib/preseason/version.rb +1 -1
  16. data/preseason.gemspec +5 -5
  17. metadata +21 -29
  18. data/lib/preseason/recipe/authlogic.rb +0 -50
  19. data/lib/preseason/recipe/playbook.rb +0 -70
  20. data/lib/preseason/recipe/spork_rspec.rb +0 -7
  21. data/lib/preseason/templates/authlogic/POST_INSTALL +0 -10
  22. data/lib/preseason/templates/authlogic/app/controllers/application_controller.rb +0 -40
  23. data/lib/preseason/templates/authlogic/app/controllers/user_session_controller.rb +0 -58
  24. data/lib/preseason/templates/authlogic/app/mailers/site_mailer.rb +0 -5
  25. data/lib/preseason/templates/authlogic/app/models/user.rb +0 -11
  26. data/lib/preseason/templates/authlogic/app/models/user_session.rb +0 -2
  27. data/lib/preseason/templates/authlogic/app/views/site_mailer/password_reset_instructions.html.erb +0 -22
  28. data/lib/preseason/templates/authlogic/app/views/user_session/acquire_password.html.erb +0 -14
  29. data/lib/preseason/templates/authlogic/app/views/user_session/forgot_password.html.erb +0 -11
  30. data/lib/preseason/templates/authlogic/app/views/user_session/new.html.erb +0 -17
  31. data/lib/preseason/templates/authlogic/config/routes.rb +0 -11
  32. data/lib/preseason/templates/authlogic/spec/factories/users.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: beaf8f721fc7a4133a63a9c372d6d76ec44a2ed2
4
- data.tar.gz: ecd5908c2f585e4d1de2be83591c04ecfbca20dc
3
+ metadata.gz: a245a4bb4e1bc52a413eedd03c2c89b818891286
4
+ data.tar.gz: 8a8931378fab634ad9d43f2d22a1798c39ce3657
5
5
  SHA512:
6
- metadata.gz: 17ec556d1d7a0faca7125b38712714099953e424945812a1f621825aeea7253fb51cf366e83c6719a55ce8956ac33256aea4966ede42f00f0e45edaf4e421661
7
- data.tar.gz: 43bc3094e1c1f2a4ff35c87124bd927b4af40fb04470f2586d77908e89e6ca3c2d8cfe91d3a78051f7a00a44bb2715476199fba1613312bba41881cff17b6912
6
+ metadata.gz: 81ef76b4d86f2445b20462b006e54a1cd29c6db13d3170b7dd0e572216c1c96df2db38fa979efefe7e616da6b23a141a8f99c354ba94608e0b75cd97ffe736a6
7
+ data.tar.gz: 9a3cca03757db2ba507fb2fd06416ed62bc4993cdc8ec4311fdd3e391ade60a2a391fdf4ca5dda9002ec90cf975a275e04128786dc36c138115976ce2915dce6
@@ -1,100 +1,125 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- preseason (0.0.1)
5
- rails (~> 4.0)
4
+ preseason (0.3.0)
5
+ rails (= 5.0.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionmailer (4.1.5)
11
- actionpack (= 4.1.5)
12
- actionview (= 4.1.5)
13
- mail (~> 2.5.4)
14
- actionpack (4.1.5)
15
- actionview (= 4.1.5)
16
- activesupport (= 4.1.5)
17
- rack (~> 1.5.2)
18
- rack-test (~> 0.6.2)
19
- actionview (4.1.5)
20
- activesupport (= 4.1.5)
10
+ actioncable (5.0.1)
11
+ actionpack (= 5.0.1)
12
+ nio4r (~> 1.2)
13
+ websocket-driver (~> 0.6.1)
14
+ actionmailer (5.0.1)
15
+ actionpack (= 5.0.1)
16
+ actionview (= 5.0.1)
17
+ activejob (= 5.0.1)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.0.1)
21
+ actionview (= 5.0.1)
22
+ activesupport (= 5.0.1)
23
+ rack (~> 2.0)
24
+ rack-test (~> 0.6.3)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ actionview (5.0.1)
28
+ activesupport (= 5.0.1)
21
29
  builder (~> 3.1)
22
30
  erubis (~> 2.7.0)
23
- activemodel (4.1.5)
24
- activesupport (= 4.1.5)
25
- builder (~> 3.1)
26
- activerecord (4.1.5)
27
- activemodel (= 4.1.5)
28
- activesupport (= 4.1.5)
29
- arel (~> 5.0.0)
30
- activesupport (4.1.5)
31
- i18n (~> 0.6, >= 0.6.9)
32
- json (~> 1.7, >= 1.7.7)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
33
+ activejob (5.0.1)
34
+ activesupport (= 5.0.1)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.0.1)
37
+ activesupport (= 5.0.1)
38
+ activerecord (5.0.1)
39
+ activemodel (= 5.0.1)
40
+ activesupport (= 5.0.1)
41
+ arel (~> 7.0)
42
+ activesupport (5.0.1)
43
+ concurrent-ruby (~> 1.0, >= 1.0.2)
44
+ i18n (~> 0.7)
33
45
  minitest (~> 5.1)
34
- thread_safe (~> 0.1)
35
46
  tzinfo (~> 1.1)
36
- arel (5.0.1.20140414130214)
37
- builder (3.2.2)
38
- coderay (1.1.0)
47
+ arel (7.1.4)
48
+ builder (3.2.3)
49
+ coderay (1.1.1)
50
+ concurrent-ruby (1.0.4)
39
51
  erubis (2.7.0)
40
- hike (1.2.3)
41
- i18n (0.6.11)
42
- json (1.8.1)
43
- mail (2.5.4)
44
- mime-types (~> 1.16)
45
- treetop (~> 1.4.8)
52
+ globalid (0.3.7)
53
+ activesupport (>= 4.1.0)
54
+ i18n (0.8.0)
55
+ loofah (2.0.3)
56
+ nokogiri (>= 1.5.9)
57
+ mail (2.6.4)
58
+ mime-types (>= 1.16, < 4)
46
59
  method_source (0.8.2)
47
- mime-types (1.25.1)
48
- minitest (5.4.0)
49
- multi_json (1.10.1)
50
- polyglot (0.3.5)
51
- pry (0.10.1)
60
+ mime-types (3.1)
61
+ mime-types-data (~> 3.2015)
62
+ mime-types-data (3.2016.0521)
63
+ mini_portile2 (2.1.0)
64
+ minitest (5.10.1)
65
+ nio4r (1.2.1)
66
+ nokogiri (1.7.0.1)
67
+ mini_portile2 (~> 2.1.0)
68
+ pry (0.10.4)
52
69
  coderay (~> 1.1.0)
53
70
  method_source (~> 0.8.1)
54
71
  slop (~> 3.4)
55
- rack (1.5.2)
56
- rack-test (0.6.2)
72
+ rack (2.0.1)
73
+ rack-test (0.6.3)
57
74
  rack (>= 1.0)
58
- rails (4.1.5)
59
- actionmailer (= 4.1.5)
60
- actionpack (= 4.1.5)
61
- actionview (= 4.1.5)
62
- activemodel (= 4.1.5)
63
- activerecord (= 4.1.5)
64
- activesupport (= 4.1.5)
75
+ rails (5.0.1)
76
+ actioncable (= 5.0.1)
77
+ actionmailer (= 5.0.1)
78
+ actionpack (= 5.0.1)
79
+ actionview (= 5.0.1)
80
+ activejob (= 5.0.1)
81
+ activemodel (= 5.0.1)
82
+ activerecord (= 5.0.1)
83
+ activesupport (= 5.0.1)
65
84
  bundler (>= 1.3.0, < 2.0)
66
- railties (= 4.1.5)
67
- sprockets-rails (~> 2.0)
68
- railties (4.1.5)
69
- actionpack (= 4.1.5)
70
- activesupport (= 4.1.5)
85
+ railties (= 5.0.1)
86
+ sprockets-rails (>= 2.0.0)
87
+ rails-dom-testing (2.0.2)
88
+ activesupport (>= 4.2.0, < 6.0)
89
+ nokogiri (~> 1.6)
90
+ rails-html-sanitizer (1.0.3)
91
+ loofah (~> 2.0)
92
+ railties (5.0.1)
93
+ actionpack (= 5.0.1)
94
+ activesupport (= 5.0.1)
95
+ method_source
71
96
  rake (>= 0.8.7)
72
97
  thor (>= 0.18.1, < 2.0)
73
98
  rake (0.9.6)
74
99
  slop (3.6.0)
75
- sprockets (2.12.1)
76
- hike (~> 1.2)
77
- multi_json (~> 1.0)
78
- rack (~> 1.0)
79
- tilt (~> 1.1, != 1.3.0)
80
- sprockets-rails (2.1.3)
81
- actionpack (>= 3.0)
82
- activesupport (>= 3.0)
83
- sprockets (~> 2.8)
84
- thor (0.19.1)
85
- thread_safe (0.3.4)
86
- tilt (1.4.1)
87
- treetop (1.4.15)
88
- polyglot
89
- polyglot (>= 0.3.1)
100
+ sprockets (3.7.1)
101
+ concurrent-ruby (~> 1.0)
102
+ rack (> 1, < 3)
103
+ sprockets-rails (3.2.0)
104
+ actionpack (>= 4.0)
105
+ activesupport (>= 4.0)
106
+ sprockets (>= 3.0.0)
107
+ thor (0.19.4)
108
+ thread_safe (0.3.5)
90
109
  tzinfo (1.2.2)
91
110
  thread_safe (~> 0.1)
111
+ websocket-driver (0.6.5)
112
+ websocket-extensions (>= 0.1.0)
113
+ websocket-extensions (0.1.2)
92
114
 
93
115
  PLATFORMS
94
116
  ruby
95
117
 
96
118
  DEPENDENCIES
97
- bundler (~> 1.3)
119
+ bundler (~> 1.14)
98
120
  preseason!
99
- pry (~> 0)
100
- rake (~> 0)
121
+ pry (~> 0.10)
122
+ rake (~> 0.9)
123
+
124
+ BUNDLED WITH
125
+ 1.14.4
data/README.md CHANGED
@@ -8,7 +8,7 @@ ways to DRY things up. This project is intended to serve as a launching
8
8
  pad for new Rails applications. Perhaps most importantly, it is **NOT** supposed to cover everything that every Rails app will ever need, but to be a good starting place.
9
9
 
10
10
  ### How
11
- N.B. This project assumes you have a development environment setup that is capable of installing Rails projects. If not, start with the [Rails Guides](http://guides.rubyonrails.org/getting_started.html "Rails Guides"). You must also have the rvm gem installed. It also assumes that you are using SSH if you plan to make your project a Github repo.
11
+ N.B. This project assumes you have a development environment setup that is capable of installing Rails projects. If not, start with the [Rails Guides](http://guides.rubyonrails.org/getting_started.html "Rails Guides"). You must also have the rvm gem installed. It also assumes that you are using SSH if you plan to make your project a Github repo. This project will use your currently installed version of Rails. While we have had good experience with recent prior versions, we recommend using Rails 5+.
12
12
 
13
13
  0. Install the `rvm` gem if you don't already have it installed
14
14
 
@@ -56,7 +56,7 @@ If you need to write a template that executes ERB in the context of the running
56
56
  + installs rspec
57
57
  * You will see a message about spring stopping. This is to allow the
58
58
  `rspec:install` generator to run.
59
- + installs and sets up bourbon and neat
59
+ + installs and sets up bourbon, neat and bitters (optionally)
60
60
  + creates a template for your whiskey_disk deploy in config/deploy.yml (for non-Heroku apps)
61
61
  + creates Procfile for foreman
62
62
  + starts guard
@@ -70,7 +70,7 @@ If you need to write a template that executes ERB in the context of the running
70
70
 
71
71
  + Either postgresql, mysql2, or sqlite3
72
72
  + [factory_girl](https://github.com/thoughtbot/factory_girl)
73
- + [authlogic](https://github.com/binarylogic/authlogic), [devise](https://github.com/plataformatec/devise), or [activeadmin](http://www.activeadmin.info/) (with devise)
73
+ + [devise](https://github.com/plataformatec/devise), or [activeadmin](http://www.activeadmin.info/) (with devise)
74
74
  + [rvm](https://rvm.io/)
75
75
  + [whiskey_disk](https://github.com/flogic/whiskey_disk) (for embarrassingly fast deployments)
76
76
  + [lograge](https://github.com/roidrage/lograge)
@@ -90,7 +90,9 @@ If you need to write a template that executes ERB in the context of the running
90
90
  + [simplecov](https://github.com/colszowka/simplecov)
91
91
  + [bourbon](http://bourbon.io/)
92
92
  + [neat](http://neat.bourbon.io/)
93
- + [bitters](http://bitters.bourbon.io)
93
+ + [bitters](http://bitters.bourbon.io/)
94
+ + [slim](http://slim-lang.com/)
95
+ + [haml](http://haml.info/)
94
96
 
95
97
  ### Who
96
98
 
@@ -20,6 +20,9 @@ class Preseason
20
20
  @config = OpenStruct.new(
21
21
  :database => Preseason::Config::Database.new,
22
22
  :factory => Preseason::Config::Factory.new,
23
+ :bourbon => Preseason::Config::Bourbon.new,
24
+ :bitters => Preseason::Config::Bitters.new,
25
+ :templating => Preseason::Config::Templating.new,
23
26
  :authentication => Preseason::Config::Authentication.new,
24
27
  :ie8 => Preseason::Config::IE8.new,
25
28
  :heroku => Preseason::Config::Heroku.new,
@@ -37,6 +40,9 @@ class Preseason
37
40
  def ask_for_config
38
41
  config.database.ask_user
39
42
  config.factory.ask_user
43
+ config.bourbon.ask_user
44
+ config.bitters.ask_user
45
+ config.templating.ask_user
40
46
  config.authentication.ask_user
41
47
  config.heroku.ask_user if config.database.postgres?
42
48
  config.whiskey_disk.ask_user
@@ -67,15 +73,15 @@ class Preseason
67
73
  Rspec
68
74
  WhiskeyDisk
69
75
  Foreman
70
- Authlogic
71
76
  Devise
72
77
  ActiveAdmin
73
78
  CustomErrorPages
74
79
  Guard
75
- SporkRspec
76
- Playbook
80
+ ZeusRspec
77
81
  Initializer
78
82
  IE8
83
+ Bourbon
84
+ Bitters
79
85
  Routes
80
86
  Git
81
87
  Heroku
@@ -6,19 +6,13 @@ class Preseason
6
6
  attr_accessor :library
7
7
 
8
8
  def ask_user
9
- if yes? "Will you be using Authlogic? [y/n]"
10
- self.library = :authlogic
11
- elsif yes? "Will you be using ActiveAdmin? [y/n]"
9
+ if yes? "Will you be using ActiveAdmin? [y/n]"
12
10
  self.library = :active_admin
13
11
  elsif yes? "Ok then, how about Devise? [y/n]"
14
12
  self.library = :devise
15
13
  end
16
14
  end
17
15
 
18
- def authlogic?
19
- library == :authlogic
20
- end
21
-
22
16
  def active_admin?
23
17
  library == :active_admin
24
18
  end
@@ -0,0 +1,19 @@
1
+ class Preseason
2
+ module Config
3
+ class Bitters
4
+ include Config
5
+
6
+ attr_accessor :library
7
+
8
+ def ask_user
9
+ if yes? "Would you like to use Bourbon's predefined styles: Bitters? [y/n]"
10
+ self.library = :bitters
11
+ end
12
+ end
13
+
14
+ def bitters?
15
+ library == :bitters
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ class Preseason
2
+ module Config
3
+ class Bourbon
4
+ include Config
5
+
6
+ attr_accessor :library
7
+
8
+ def ask_user
9
+ if yes? "Would you like to use Bourbon and Neat? [y/n]"
10
+ self.library = :bourbon
11
+ end
12
+ end
13
+
14
+ def bourbon?
15
+ library == :bourbon
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,25 @@
1
+ class Preseason
2
+ module Config
3
+ class Templating
4
+ include Config
5
+
6
+ attr_accessor :library
7
+
8
+ def ask_user
9
+ if yes? "Would you like to use Slim templating language? [y/n]"
10
+ self.library = :slim
11
+ elsif yes? "Would you like to use HAML instead? [y/n]"
12
+ self.library = :haml
13
+ end
14
+ end
15
+
16
+ def slim?
17
+ library == :slim
18
+ end
19
+
20
+ def haml?
21
+ library == :haml
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,15 @@
1
+ class Preseason::Recipe::Bitters < Preseason::Recipe
2
+ def prepare
3
+ install_bitters
4
+ end
5
+
6
+ def install_bitters
7
+ inside 'app/assets/stylesheets' do
8
+ run 'bundle exec bitters install'
9
+ end
10
+
11
+ insert_into_file 'app/assets/stylesheets/application.scss', after: "@import 'neat';\n" do
12
+ "@import 'base/base';\n"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ class Preseason::Recipe::Bourbon < Preseason::Recipe
2
+ def prepare
3
+ configure_bourbon
4
+ add_neat
5
+ end
6
+
7
+ def configure_bourbon
8
+ remove_file 'app/assets/stylesheets/application.css'
9
+ create_file 'app/assets/stylesheets/application.scss'
10
+ append_to_file 'app/assets/stylesheets/application.scss', "@import 'bourbon';\n"
11
+ end
12
+
13
+ def add_neat
14
+ insert_into_file 'app/assets/stylesheets/application.scss', after: "@import 'bourbon';\n" do
15
+ "@import 'neat';\n"
16
+ end
17
+ end
18
+ end
@@ -12,6 +12,9 @@ class Preseason::Recipe::Gemfile < Preseason::Recipe
12
12
  add_development_test_gems
13
13
  add_test_gems
14
14
  add_factory_gem
15
+ add_bourbon_gems
16
+ add_bitters_gem
17
+ add_templating_gem
15
18
  add_active_admin_gem
16
19
  add_authentication_gem
17
20
  add_modernizr_gem
@@ -47,8 +50,6 @@ class Preseason::Recipe::Gemfile < Preseason::Recipe
47
50
  %w(
48
51
  whiskey_disk
49
52
  jquery-rails
50
- bourbon
51
- neat
52
53
  ).map { |gem_name| "gem '#{gem_name}'" }.join("\n") << "\n"
53
54
  end
54
55
  end
@@ -90,7 +91,6 @@ class Preseason::Recipe::Gemfile < Preseason::Recipe
90
91
  gem 'foreman'
91
92
  gem 'guard-bundler'
92
93
  gem 'guard-rspec'
93
- gem 'guard-spork'
94
94
  gem 'rb-fsevent', :require => false
95
95
  end
96
96
  end
@@ -100,14 +100,13 @@ class Preseason::Recipe::Gemfile < Preseason::Recipe
100
100
  gem 'pry-rails'
101
101
  gem 'pry-nav'
102
102
  gem 'awesome_print'
103
- gem 'quiet_assets'
104
103
  gem 'rspec-rails'
105
104
  end
106
105
  end
107
106
 
108
107
  def add_test_gems
109
108
  gem_group :test do
110
- gem 'spork-rails'
109
+ gem 'zeus'
111
110
  gem 'database_cleaner'
112
111
  gem 'shoulda-matchers'
113
112
  gem 'capybara-webkit'
@@ -119,12 +118,40 @@ class Preseason::Recipe::Gemfile < Preseason::Recipe
119
118
 
120
119
  def add_factory_gem
121
120
  if config.factory.factory_girl?
122
- insert_into_file 'Gemfile', :after => "group :development, :test do\n" do
121
+ insert_into_file 'Gemfile', :after => "gem 'rspec-rails'\n" do
123
122
  " gem 'factory_girl_rails'\n"
124
123
  end
125
124
  end
126
125
  end
127
126
 
127
+ def add_bourbon_gems
128
+ if config.bourbon.bourbon?
129
+ insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do
130
+ "gem 'bourbon', '~> 4.2', '>= 4.2.6'\ngem 'neat', '~> 2.0.0'\n"
131
+ end
132
+ end
133
+ end
134
+
135
+ def add_bitters_gem
136
+ if config.bitters.bitters?
137
+ insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do
138
+ "gem 'bitters', '1.1.0'\n"
139
+ end
140
+ end
141
+ end
142
+
143
+ def add_templating_gem
144
+ if config.templating.slim?
145
+ insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do
146
+ "gem 'slim-rails'\n"
147
+ end
148
+ elsif config.templating.haml?
149
+ insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do
150
+ "gem 'haml-rails'\n"
151
+ end
152
+ end
153
+ end
154
+
128
155
  def add_active_admin_gem
129
156
  if config.authentication.active_admin?
130
157
  insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do
@@ -134,11 +161,7 @@ class Preseason::Recipe::Gemfile < Preseason::Recipe
134
161
  end
135
162
 
136
163
  def add_authentication_gem
137
- if config.authentication.authlogic?
138
- insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do
139
- "gem 'authlogic'\n"
140
- end
141
- elsif config.authentication.devise?
164
+ if config.authentication.devise?
142
165
  insert_into_file 'Gemfile', :after => "gem 'jquery-rails'\n" do
143
166
  "gem 'devise'\n"
144
167
  end
@@ -0,0 +1,20 @@
1
+ class Preseason::Recipe::ZeusRspec < Preseason::Recipe
2
+ def prepare
3
+ configure_zeus
4
+ create_spec_helper
5
+ end
6
+
7
+ def configure_zeus
8
+ run 'bundle exec zeus init'
9
+
10
+ insert_into_file 'custom_plan.rb', after: "class CustomPlan < Zeus::Rails\n" do
11
+ parse_template('zeus/custom_plan.erb')
12
+ end
13
+ end
14
+
15
+ def create_spec_helper
16
+ remove_file 'spec/spec_helper.rb'
17
+ create_file 'spec/spec_helper.rb', parse_template('spec/spec_helper.erb')
18
+ remove_file 'test'
19
+ end
20
+ end
@@ -1,29 +1,14 @@
1
1
  require 'rubygems'
2
- require 'spork'
3
2
 
4
- if(ENV["SIMPLECOV"])
5
- require 'simplecov'
6
- SimpleCov.start 'rails' do
7
- add_filter "/spec/"
8
- end
9
- puts "Running coverage tool\n"
10
- end
11
-
12
- Spork.prefork do
13
- ENV["RAILS_ENV"] ||= 'test'
3
+ prefork = lambda {
4
+ ENV["RAILS_ENV"] = 'test'
14
5
  <% if config.authentication.devise? %>
15
6
  require 'rails/application'
16
- Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
7
+ <!-- Spork.trap_method(Rails::Application::RoutesReloader, :reload!) -->
17
8
  <% end %>
18
9
 
19
10
  require File.expand_path("../../config/environment", __FILE__)
20
11
  require 'rspec/rails'
21
- <% if config.authentication.authlogic? %>
22
-
23
- require 'authlogic/test_case'
24
-
25
- include Authlogic::TestCase
26
- <% end %>
27
12
 
28
13
  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
29
14
 
@@ -53,9 +38,34 @@ Spork.prefork do
53
38
  end
54
39
  end
55
40
  end
41
+ }
56
42
 
43
+ each_run = lambda {
44
+ <%= "FactoryGirl.reload" if config.factory.factory_girl? %>
45
+ }
46
+
47
+ if defined?(Zeus)
48
+ prefork.call
49
+ $each_run = each_run
50
+ class << Zeus.plan
51
+ def after_fork_with_test
52
+ after_fork_without_test
53
+ $each_run.call
54
+ end
55
+ alias_method_chain :after_fork, :test
56
+ end
57
+ else
58
+ prefork.call
59
+ each_run.call
57
60
  end
58
61
 
59
- Spork.each_run do
60
- <%= "FactoryGirl.reload" if config.factory.factory_girl? %>
62
+ # this part is optional, but it gets SimpleCov working when running
63
+ # specs without zeus (as long as zeus is not running)
64
+ def zeus_running?
65
+ File.exists? '.zeus.sock'
66
+ end
67
+
68
+ if !zeus_running?
69
+ require 'simplecov'
70
+ SimpleCov.start
61
71
  end
@@ -0,0 +1,12 @@
1
+
2
+ def test
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ # SimpleCov.start 'rails' if using RoR
6
+
7
+ # require all ruby files
8
+ Dir["#{Rails.root}/app/**/*.rb"].each { |f| load f }
9
+
10
+ # run the tests
11
+ super
12
+ end
@@ -1,3 +1,3 @@
1
1
  class Preseason
2
- VERSION = "0.3.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'preseason/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.required_ruby_version = '>= 2.0.0'
7
+ spec.required_ruby_version = '>= 2.4.0'
8
8
  spec.name = "preseason"
9
9
  spec.version = Preseason::VERSION
10
10
  spec.authors = ["Centresource Interactive Agency"]
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency 'rails', '~> 4.0'
22
+ spec.add_dependency 'rails', '5.0.1'
23
23
 
24
- spec.add_development_dependency 'pry', '~> 0'
25
- spec.add_development_dependency 'bundler', '~> 1.3'
26
- spec.add_development_dependency 'rake', '~> 0'
24
+ spec.add_development_dependency 'pry', '~> 0.10'
25
+ spec.add_development_dependency 'bundler', '~> 1.14'
26
+ spec.add_development_dependency 'rake', '~> 0.9'
27
27
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: preseason
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Centresource Interactive Agency
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-25 00:00:00.000000000 Z
11
+ date: 2017-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: 5.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: 5.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.10'
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: '0'
40
+ version: '0.10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '1.14'
48
48
  type: :development
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: '1.3'
54
+ version: '1.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.9'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.9'
69
69
  description: An opinionated Rails application starter kit
70
70
  email:
71
71
  - dev@centresource.com
@@ -89,16 +89,20 @@ files:
89
89
  - lib/preseason/colorize.rb
90
90
  - lib/preseason/config.rb
91
91
  - lib/preseason/config/authentication.rb
92
+ - lib/preseason/config/bitters.rb
93
+ - lib/preseason/config/bourbon.rb
92
94
  - lib/preseason/config/database.rb
93
95
  - lib/preseason/config/factory.rb
94
96
  - lib/preseason/config/heroku.rb
95
97
  - lib/preseason/config/ie8.rb
98
+ - lib/preseason/config/templating.rb
96
99
  - lib/preseason/config/whiskey_disk.rb
97
100
  - lib/preseason/generator_context.rb
98
101
  - lib/preseason/recipe.rb
99
102
  - lib/preseason/recipe/active_admin.rb
100
103
  - lib/preseason/recipe/application.rb
101
- - lib/preseason/recipe/authlogic.rb
104
+ - lib/preseason/recipe/bitters.rb
105
+ - lib/preseason/recipe/bourbon.rb
102
106
  - lib/preseason/recipe/bundle.rb
103
107
  - lib/preseason/recipe/custom_error_pages.rb
104
108
  - lib/preseason/recipe/database.rb
@@ -112,26 +116,13 @@ files:
112
116
  - lib/preseason/recipe/heroku.rb
113
117
  - lib/preseason/recipe/ie8.rb
114
118
  - lib/preseason/recipe/initializer.rb
115
- - lib/preseason/recipe/playbook.rb
116
119
  - lib/preseason/recipe/production.rb
117
120
  - lib/preseason/recipe/routes.rb
118
121
  - lib/preseason/recipe/rspec.rb
119
122
  - lib/preseason/recipe/rvm.rb
120
123
  - lib/preseason/recipe/schedule.rb
121
- - lib/preseason/recipe/spork_rspec.rb
122
124
  - lib/preseason/recipe/whiskey_disk.rb
123
- - lib/preseason/templates/authlogic/POST_INSTALL
124
- - lib/preseason/templates/authlogic/app/controllers/application_controller.rb
125
- - lib/preseason/templates/authlogic/app/controllers/user_session_controller.rb
126
- - lib/preseason/templates/authlogic/app/mailers/site_mailer.rb
127
- - lib/preseason/templates/authlogic/app/models/user.rb
128
- - lib/preseason/templates/authlogic/app/models/user_session.rb
129
- - lib/preseason/templates/authlogic/app/views/site_mailer/password_reset_instructions.html.erb
130
- - lib/preseason/templates/authlogic/app/views/user_session/acquire_password.html.erb
131
- - lib/preseason/templates/authlogic/app/views/user_session/forgot_password.html.erb
132
- - lib/preseason/templates/authlogic/app/views/user_session/new.html.erb
133
- - lib/preseason/templates/authlogic/config/routes.rb
134
- - lib/preseason/templates/authlogic/spec/factories/users.rb
125
+ - lib/preseason/recipe/zeus_rspec.rb
135
126
  - lib/preseason/templates/custom_error_pages/app/views/errors/application_error.html.erb
136
127
  - lib/preseason/templates/custom_error_pages/app/views/errors/not_found.html.erb
137
128
  - lib/preseason/templates/custom_error_pages/app/views/errors/unprocessable_entity.html.erb
@@ -146,6 +137,7 @@ files:
146
137
  - lib/preseason/templates/spec/spec_helper.erb
147
138
  - lib/preseason/templates/sqlite/config/database.yml
148
139
  - lib/preseason/templates/whiskey_disk/config/deploy.yml
140
+ - lib/preseason/templates/zeus/custom_plan.erb
149
141
  - lib/preseason/version.rb
150
142
  - preseason.gemspec
151
143
  homepage: https://github.com/centresource/preseason
@@ -160,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
152
  requirements:
161
153
  - - ">="
162
154
  - !ruby/object:Gem::Version
163
- version: 2.0.0
155
+ version: 2.4.0
164
156
  required_rubygems_version: !ruby/object:Gem::Requirement
165
157
  requirements:
166
158
  - - ">="
@@ -168,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
160
  version: '0'
169
161
  requirements: []
170
162
  rubyforge_project:
171
- rubygems_version: 2.4.5
163
+ rubygems_version: 2.6.10
172
164
  signing_key:
173
165
  specification_version: 4
174
166
  summary: We start a lot of new Rails projects; this gem is intended to reduce that
@@ -1,50 +0,0 @@
1
- class Preseason::Recipe::Authlogic < Preseason::Recipe
2
- def prepare
3
- return unless config.authentication.authlogic?
4
-
5
- setup_model
6
- setup_factory
7
- setup_routes
8
- setup_controllers
9
- setup_views
10
- setup_mailer
11
- end
12
-
13
- def post_install_hook
14
- 'POST_INSTALL' if config.authentication.authlogic?
15
- end
16
-
17
- private
18
- def setup_model
19
- # if you edit this, mirror your changes in the user_factory
20
- generate 'model user first_name:string last_name:string email:string crypted_password:string password_salt:string persistence_token:string perishable_token:string'
21
-
22
- insert 'app/models/user.rb', :before => /^end$/
23
- mirror_file 'app/models/user_session.rb'
24
- end
25
-
26
- def setup_factory
27
- mirror_file 'spec/factories/users.rb'
28
- end
29
-
30
- def setup_routes
31
- insert 'config/routes.rb', :before => /^end$/
32
- end
33
-
34
- def setup_controllers
35
- mirror_file 'app/controllers/user_session_controller.rb'
36
- insert 'app/controllers/application_controller.rb', :after => 'protect_from_forgery'
37
- end
38
-
39
- def setup_views
40
- %w(new forgot_password acquire_password).each do |file_name|
41
- mirror_file "app/views/user_session/#{file_name}.html.erb"
42
- end
43
- end
44
-
45
- def setup_mailer
46
- generate 'mailer SiteMailer'
47
- insert 'app/mailers/site_mailer.rb', :before => /^end$/
48
- mirror_file 'app/views/site_mailer/password_reset_instructions.html.erb'
49
- end
50
- end
@@ -1,70 +0,0 @@
1
- require 'find'
2
-
3
- class Preseason::Recipe::Playbook < Preseason::Recipe
4
- def prepare
5
- download_playbook_repo
6
- copy_playbook_assets
7
- clean_playbook_assets
8
- add_normalize_import
9
- integrate_playbook
10
- remove_unwanted_files
11
- end
12
-
13
- private
14
-
15
- def exclude_rules
16
- # exclude:
17
- # => files and directories beginning with "."
18
- # => "README.md" files
19
- # => "application.coffee" file
20
- [/^\./, /^(?:readme.md|application\.coffee|syntax\.scss)$/]
21
- end
22
-
23
- def download_playbook_repo
24
- version = '1.1.3.1'
25
- get "https://github.com/centresource/playbook/archive/v#{version}.tar.gz", '/tmp/playbook.tar.gz'
26
- remove_dir "/tmp/playbook-#{version}" if Dir.exist? "/tmp/playbook-#{version}"
27
- remove_dir '/tmp/playbook-css' if Dir.exist? '/tmp/playbook-css'
28
- `tar -zxvf /tmp/playbook.tar.gz -C /tmp 2> /dev/null`
29
- `mv /tmp/playbook-#{version}/styles /tmp/playbook-css`
30
- end
31
-
32
- def copy_playbook_assets
33
- Find.find('/tmp/playbook-css/') do |path|
34
- if exclude_rules.none? { |regex| regex =~ File.basename(path) }
35
- style_path = path.gsub('/tmp/playbook-css/', 'app/assets/stylesheets/')
36
- if File.directory? path
37
- FileUtils.makedirs style_path
38
- else
39
- copy_file path, style_path
40
- end
41
- else
42
- Find.prune
43
- end
44
- end
45
- end
46
-
47
- def clean_playbook_assets
48
- gsub_file 'app/assets/stylesheets/screen.scss', 'bourbon/app/assets/stylesheets/bourbon', 'bourbon'
49
- gsub_file 'app/assets/stylesheets/screen.scss', 'neat/app/assets/stylesheets/neat-helpers', 'neat-helpers'
50
- gsub_file 'app/assets/stylesheets/screen.scss', 'neat/app/assets/stylesheets/neat', 'neat'
51
- end
52
-
53
- def add_normalize_import
54
- insert_into_file 'app/assets/stylesheets/screen.scss', "@import \"normalize-rails/normalize\";\n", :before => '@import "bourbon";'
55
- end
56
-
57
- def integrate_playbook
58
- mirror_file 'app/views/layouts/application.html.erb'
59
- gsub_file 'app/views/layouts/application.html.erb', /Preseason by Centresource/, app_name
60
- end
61
-
62
- def remove_unwanted_files
63
- remove_file 'app/assets/stylesheets/application.css'
64
- remove_file 'public/index.html'
65
- remove_file 'app/assets/images/rails.png'
66
- remove_dir '/tmp/centresource-generator-playbook*'
67
- remove_dir '/tmp/playbook-css'
68
- remove_file '/tmp/playbook.tar.gz'
69
- end
70
- end
@@ -1,7 +0,0 @@
1
- class Preseason::Recipe::SporkRspec < Preseason::Recipe
2
- def prepare
3
- remove_file 'spec/spec_helper.rb'
4
- create_file 'spec/spec_helper.rb', parse_template('spec/spec_helper.erb')
5
- remove_file 'test'
6
- end
7
- end
@@ -1,10 +0,0 @@
1
-
2
- Authlogic Post-Install
3
- ======================
4
-
5
- Authlogic has been installed and configured. Next steps:
6
-
7
- - Update the login form with your preferred markup (app/views/user_session/new.html.erb)
8
- - Update the default "from" address in the site mailer for password reset emails (app/mailers/site_mailer.rb)
9
- - Update the password reset email to your needs (app/views/site_mailer/password_reset_instructions.html.erb)
10
- - Update the reset password pages with your preferred markup (app/views/user_session/{acquire_password,forgot_password}.html.erb)
@@ -1,40 +0,0 @@
1
-
2
-
3
- private
4
-
5
- def current_user_session
6
- return @current_user_session if defined?(@current_user_session)
7
- @current_user_session = UserSession.find
8
- end
9
-
10
- def current_user
11
- return @current_user if defined?(@current_user)
12
- @current_user = current_user_session && current_user_session.user
13
- end
14
-
15
- def require_user
16
- unless current_user
17
- store_location
18
- flash[:notice] = 'You must be logged in to access this page'
19
- redirect_to login_url
20
- return false
21
- end
22
- end
23
-
24
- def require_no_user
25
- if current_user
26
- store_location
27
- flash[:notice] = 'You must be logged out to access this page'
28
- redirect_to root_url
29
- return false
30
- end
31
- end
32
-
33
- def store_location
34
- session[:return_to] = request.request_uri
35
- end
36
-
37
- def redirect_back_or_default(default)
38
- redirect_to(session[:return_to] || default)
39
- session[:return_to] = nil
40
- end
@@ -1,58 +0,0 @@
1
- class UserSessionController < ApplicationController
2
- before_filter :find_user_by_perishable_token, :only => [:acquire_password, :reset_password]
3
-
4
- def new
5
- @user_session = UserSession.new
6
- end
7
-
8
- def create
9
- @user_session = UserSession.new(params[:user_session])
10
-
11
- if @user_session.save
12
- redirect_back_or_default root_url
13
- else
14
- flash.now[:error] = 'Username or password are incorrect.'
15
- render :action => :new
16
- end
17
- end
18
-
19
- def destroy
20
- current_user_session.destroy
21
- redirect_to login_url
22
- end
23
-
24
- def send_reset_password_link
25
- @user = User.where('LOWER(email) = ?', params[:email].downcase).first
26
- if @user.blank?
27
- flash.now[:error] = "No user found with that email address."
28
- render :forgot_password
29
- else
30
- begin
31
- @user.send_password_reset_instructions!
32
- rescue Net::SMTPFatalError
33
- end
34
- flash[:notice] = "An email has been sent with a link to reset your password. Please check your inbox."
35
- redirect_to root_url
36
- end
37
- end
38
-
39
- def reset_password
40
- if @user.update_attributes(params[:user])
41
- flash[:success] = "Your password has been changed. Please login to continue."
42
- redirect_to root_url
43
- else
44
- flash.now[:error] = "There was an error updating your password."
45
- render :acquire_password
46
- end
47
- end
48
-
49
- private
50
- def find_user_by_perishable_token
51
- @user = User.find_by_perishable_token(params[:token])
52
-
53
- if @user.blank?
54
- flash[:error] = "There was a problem finding your account. The reset password link may have expired. Please try again."
55
- redirect_to forgot_password_url
56
- end
57
- end
58
- end
@@ -1,5 +0,0 @@
1
-
2
- def password_reset_instructions(user)
3
- @user = user
4
- mail(:to => user.email, :subject => 'Password Reset Instructions')
5
- end
@@ -1,11 +0,0 @@
1
-
2
- acts_as_authentic do |c|
3
- # because RSpec has problems with Authlogic's session maintenance
4
- # see https://github.com/binarylogic/authlogic/issues/262#issuecomment-1804988
5
- c.maintain_sessions = false
6
- end
7
-
8
- def send_password_reset_instructions!
9
- reset_perishable_token!
10
- SiteMailer.password_reset_instructions(self).deliver
11
- end
@@ -1,2 +0,0 @@
1
- class UserSession < Authlogic::Session::Base
2
- end
@@ -1,22 +0,0 @@
1
- <table width="600">
2
- <tbody>
3
- <tr>
4
- <td style="padding:15px;">
5
- <%= @user.first_name %>,
6
-
7
- <p>A request to reset your <a href="CHANGEME.com">CHANGEME.com</a> password has been made.</p>
8
-
9
- <p>If you did not make this request, please ignore this email.</p>
10
-
11
- <p>If you did make this request, please click the following link to choose a new password:</p>
12
-
13
- <p><%= link_to 'Reset Your Password', reset_password_url(:host => 'CHANGEME.com', :token => @user.perishable_token) %></p>
14
-
15
- <p>
16
- Thank you,<br />
17
- CHANGEME staff
18
- </p>
19
- </td>
20
- </tr>
21
- </tbody>
22
- </table>
@@ -1,14 +0,0 @@
1
- <%= form_for :user, :url => reset_password_path(:token => @user.perishable_token), :html => {:method => 'post'} do |f| %>
2
- <fieldset>
3
- <legend>Reset your password</legend>
4
-
5
- <%= f.label :password %>
6
- <%= f.password_field :password %>
7
-
8
- <%= f.label :password_confirmation, 'Password (again)' %>
9
- <%= f.password_field :password_confirmation %>
10
-
11
- <%= f.submit 'Update' %>
12
- <%= link_to 'Cancel', root_path %>
13
- </fieldset>
14
- <% end %>
@@ -1,11 +0,0 @@
1
- <%= form_tag forgot_password_path do %>
2
- <fieldset>
3
- <legend>Forgot Password</legend>
4
-
5
- <%= label_tag :email, 'Enter the email you used to register' %>
6
- <%= email_field_tag :email, params[:email] %>
7
-
8
- <%= submit_tag 'Submit' %>
9
- <%= link_to 'Cancel', login_path %>
10
- </fieldset>
11
- <% end %>
@@ -1,17 +0,0 @@
1
- <%= form_for @user_session do |f| %>
2
- <fieldset>
3
- <legend>Sign In</legend>
4
-
5
- <%= f.label :email %>
6
- <%= f.text_field :email %></div>
7
-
8
- <%= f.label :password %>
9
- <%= f.password_field :password %>
10
-
11
- <%= f.check_box :remember_me %> <label for="signin_remember_me">Remember Me</label>
12
-
13
- <%= f.button 'Sign In' %>
14
- </fieldset>
15
- <% end %>
16
-
17
- <p><%= link_to "Forgot Password?", forgot_password_path %>
@@ -1,11 +0,0 @@
1
-
2
- # authentication routes
3
- get :login, :to => 'user_session#new', :as => :login
4
- post :login, :to => 'user_session#create', :as => :login
5
- delete :logout, :to => 'user_session#destroy', :as => :logout
6
- get :forgot_password, :to => 'user_session#forgot_password', :as => :forgot_password
7
- post :forgot_password, :to => 'user_session#send_reset_password_link', :as => :forgot_password
8
- get '/reset_password/:token', :to => 'user_session#acquire_password', :as => :reset_password
9
- post '/reset_password/:token', :to => 'user_session#reset_password', :as => :reset_password
10
- get :register, :to => 'users#new', :as => :register
11
- post :register, :to => 'users#create', :as => :register
@@ -1,11 +0,0 @@
1
- # Read about factories at https://github.com/thoughtbot/factory_girl
2
-
3
- FactoryGirl.define do
4
- factory :user do
5
- first_name 'Test'
6
- last_name 'User'
7
- email 'testuser@example.com'
8
- password 'test1234'
9
- password_confirmation 'test1234'
10
- end
11
- end