prop_up 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26fa7676db4d07e830549ac71cff2b6661cc5dde
4
- data.tar.gz: 827b770736e54f8cfbd3509b8ae95cf51cdc2f13
3
+ metadata.gz: 6ec9381675e35753a7133ba825495fecddb55232
4
+ data.tar.gz: b9fe4f653e9f0832e8894b0a97398e160d6de4dd
5
5
  SHA512:
6
- metadata.gz: c530f378ddfd3e33130e9469e1e2f37882761902bffae38bd129a928138dbac0f7c5056d4349fd551f571f755792cd26f5de34baa731b5fa256e31355fbdcead
7
- data.tar.gz: 36c18eac9c1dc0190c9ce5e08b34171468d7ea655c37191aa884653574f2c5e55210e5f489474023981fbc37135ddef3301e3053de3b8d9d4bcd6f3d7aa06e8e
6
+ metadata.gz: c2d934d66718d44f22a8acc592e681a28229c3b421a8251e85167d44158ef3a516f8001911a7f863a5569cc85256936b72e8e8db56da9c6d35461d5412fac178
7
+ data.tar.gz: 8e2c7d67fd2899818057729f4d90750d0995b759d39abe0bb8c9e5e4550f12d10c87c7b88dda4856ac81c3d81ef903f6957467777118d5c620512b8ef076325f
@@ -0,0 +1,25 @@
1
+ Change Log
2
+ ===
3
+
4
+ **0.0.3**
5
+ - Add Devise
6
+ - Change app title
7
+
8
+ **0.0.2**
9
+ - Add figaro
10
+ - Add Backbone generator
11
+ - Add dependency on hub
12
+ - Add Google Places library
13
+ - Add Foundation
14
+ - Add Modernizr
15
+ - Add Leaflet Map
16
+
17
+ **0.0.1**
18
+ - Generate a Rails app
19
+ - Template a gemfile
20
+ - Initialize zeus
21
+ - Initialize guard
22
+ - Setup factory girl and factories
23
+ - Initialize readme
24
+ - Call prop from command line
25
+ - Setup shoulda-matchers
@@ -1,7 +1,13 @@
1
+ require 'travis'
1
2
  module Prop
2
3
  class AppBuilder < Rails::AppBuilder
3
4
  include Prop::Actions
4
5
 
6
+ def resolve_qt4_dependency
7
+ run 'brew install qt4'
8
+ run 'bundle'
9
+ end
10
+
5
11
  def readme
6
12
  template 'README.md.erb', 'README.md'
7
13
  end
@@ -151,6 +157,39 @@
151
157
  run 'rm bin/autospec'
152
158
  end
153
159
 
160
+ def generate_login_specs
161
+ empty_directory 'spec/features'
162
+ copy_file 'user_sign_up_spec.rb', 'spec/features/user_sign_up_spec.rb'
163
+ copy_file 'user_sign_in_spec.rb', 'spec/features/user_sign_in_spec.rb'
164
+ end
165
+
166
+ def clean_up_factories
167
+ remove_file 'spec/factories/users.rb'
168
+ remove_file 'spec/models/user_spec.rb'
169
+ remove_file 'app/views/devise/registrations/new.html.erb'
170
+ copy_file 'factories.rb', 'spec/factories/factories.rb'
171
+ end
172
+
173
+ def create_controller_for_sign_in
174
+ copy_file 'new_registration.html.erb', 'app/views/devise/registrations/new.html.erb'
175
+ replace_in_file 'config/routes.rb',
176
+ /Application\.routes\.draw do/,
177
+ "Application.routes.draw do\nroot to: 'application#index'\n"
178
+ remove_file 'app/controllers/application_controller.rb'
179
+ copy_file 'application_controller.rb', 'app/controllers/application_controller.rb'
180
+ copy_file 'root_index.html.erb', 'app/views/application/index.html.erb'
181
+ end
182
+
183
+ def enable_logout
184
+ empty_directory 'app/views/shared'
185
+ copy_file 'nav_bar.html.erb', 'app/views/shared/_nav_bar.html.erb'
186
+ replace_in_file 'config/initializers/devise.rb', /config\.sign_out_via = \:delete/, "config.sign_out_via = :get\n"
187
+ end
188
+
189
+ def migrate_test_db
190
+ run 'rake db:test:prepare'
191
+ end
192
+
154
193
  def configure_background_jobs_for_rspec
155
194
  copy_file 'background_jobs_rspec.rb', 'spec/support/background_jobs.rb'
156
195
  run 'rails g delayed_job:active_record'
@@ -260,6 +299,29 @@
260
299
  run "#{path_addition} hub create #{repo_name}"
261
300
  end
262
301
 
302
+ def setup_travis_ci
303
+ path_addition = override_path_for_tests
304
+ run "#{path_addition} travis login --org --auto"
305
+ run "#{path_addition} travis sync"
306
+ run "#{path_addition} travis enable"
307
+ copy_file '.travis.yml', '.travis.yml'
308
+ end
309
+
310
+ def self.github_username
311
+ `travis login --org --auto`
312
+ tk = `travis token`
313
+ token = tk.split(' ').pop
314
+ client = ::Travis::Client.new(access_token: "#{token}")
315
+ client.user.login
316
+ end
317
+
318
+ def initial_commit_and_push
319
+ path_addition = override_path_for_tests
320
+ run "#{path_addition} git add ."
321
+ run "#{path_addition} git commit -m 'Initial Commit'"
322
+ run "#{path_addition} git push -u origin master"
323
+ end
324
+
263
325
  def copy_miscellaneous_files
264
326
  copy_file 'errors.rb', 'config/initializers/errors.rb'
265
327
  end
@@ -33,6 +33,7 @@ module Prop
33
33
  end
34
34
 
35
35
  def prop_customizations
36
+ invoke :resolve_qt4_dependency
36
37
  invoke :remove_garbage_files
37
38
  invoke :customize_gemfile
38
39
  invoke :setup_database
@@ -56,13 +57,20 @@ module Prop
56
57
  invoke :create_guard_file
57
58
  invoke :initialize_zeus
58
59
  invoke :setup_devise
60
+ invoke :generate_specs
59
61
  invoke :setup_git
60
62
  invoke :create_heroku_apps
61
63
  invoke :create_github_repo
64
+ invoke :setup_travis_ci
65
+ invoke :initial_commit_and_push
62
66
  invoke :start_zeus
63
67
  invoke :outro
64
68
  end
65
69
 
70
+ def resolve_qt4_dependency
71
+ build :resolve_qt4_dependency
72
+ end
73
+
66
74
  def remove_garbage_files
67
75
  build :remove_public_index
68
76
  build :remove_rails_logo_image
@@ -115,6 +123,15 @@ module Prop
115
123
  build :setup_devise
116
124
  end
117
125
 
126
+ def generate_specs
127
+ say 'Generating specs'
128
+ build :clean_up_factories
129
+ build :generate_login_specs
130
+ build :create_controller_for_sign_in
131
+ build :enable_logout
132
+ build :migrate_test_db
133
+ end
134
+
118
135
  def create_prop_views
119
136
  say 'Creating prop views'
120
137
  build :create_partials_directory
@@ -181,6 +198,16 @@ module Prop
181
198
  build :create_github_repo, "#{app_name}"
182
199
  end
183
200
 
201
+ def setup_travis_ci
202
+ say 'Setting up Travis CI'
203
+ build :setup_travis_ci
204
+ end
205
+
206
+ def initial_commit_and_push
207
+ say 'Performing initial commit and pushing to Github'
208
+ build :initial_commit_and_push
209
+ end
210
+
184
211
  def setup_gitignore
185
212
  build :gitignore_files
186
213
  end
@@ -1,3 +1,3 @@
1
1
  module Prop
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -8,6 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.add_dependency 'bundler', '~> 1.3'
9
9
  spec.add_dependency 'rails', '4.0.0'
10
10
  spec.add_dependency 'hub'
11
+ spec.add_dependency 'travis'
11
12
  spec.authors = ['Nathaniel Wroblewski']
12
13
  spec.date = Date.today.strftime('%Y-%m-%d')
13
14
 
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ env:
5
+ - DB=postgresql
6
+ script:
7
+ - bundle exec rake db:migrate
8
+ - bundle exec rake db:test:prepare
9
+ - bundle exec rake spec
10
+ before_script:
11
+ - bundle exec rake db:create RAILS_ENV=test
@@ -19,6 +19,7 @@ gem 'rack-timeout'
19
19
  gem 'recipient_interceptor'
20
20
  gem 'sass-rails'
21
21
  gem 'simple_form'
22
+ gem 'travis'
22
23
  gem 'uglifier'
23
24
  gem 'unicorn'
24
25
  gem 'zurb-foundation'
@@ -1,5 +1,6 @@
1
1
  You're being propped up
2
2
  ============================
3
+ [![Build Status](https://travis-ci.org/<%= "#{Prop::AppBuilder::github_username}" %>/<%= "#{app_name}" %>.png)](https://travis-ci.org/<%= "#{Prop::AppBuilder::github_username}" %>/<%= "#{app_name}" %>)
3
4
 
4
5
  Consult the following repo for best practices and workflow protocol:
5
6
 
@@ -0,0 +1,9 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+
6
+ def index
7
+
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ FactoryGirl.define do
2
+ sequence :email do |n|
3
+ "test#{n}@example.com"
4
+ end
5
+
6
+ sequence :password do |n|
7
+ "1234567#{n}"
8
+ end
9
+
10
+ factory :user do
11
+ email
12
+ password
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ <% if user_signed_in? %>
2
+ <%= link_to 'Sign out', destroy_user_session_path %>
3
+ <% end %>
@@ -0,0 +1,16 @@
1
+ <h2>Sign up</h2>
2
+
3
+ <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
+ <%= f.error_notification %>
5
+
6
+ <div class="form-inputs">
7
+ <%= f.input :email, required: true, autofocus: true %>
8
+ <%= f.input :password, required: true %>
9
+ </div>
10
+
11
+ <div class="form-actions">
12
+ <%= f.button :submit, "Sign up" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "devise/shared/links" %>
@@ -21,6 +21,7 @@
21
21
  </head>
22
22
  <body class="<%%= body_class %>">
23
23
  <%= render 'flashes' -%>
24
+ <%= render 'shared/nav_bar' %>
24
25
  <%= yield %>
25
26
  <%= render 'javascript' %>
26
27
  <%= javascript_include_tag 'http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false' %>
File without changes
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'An existing user', js: true do
4
+ it 'can log in' do
5
+ email = generate(:email)
6
+ password = generate(:password)
7
+ user = create(:user, email: email, password: password)
8
+
9
+ visit new_user_session_path
10
+
11
+ fill_in 'Email', with: email
12
+ fill_in 'Password', with: password
13
+ click_on 'Sign in'
14
+
15
+ expect(page).to have_content('success')
16
+ end
17
+
18
+ it 'cannot log in if a field is ommitted' do
19
+ email = generate(:email)
20
+ password = generate(:password)
21
+ user = create(:user, email: email, password: password)
22
+
23
+ visit new_user_session_path
24
+
25
+ fill_in 'Email', with: email
26
+ click_on 'Sign in'
27
+
28
+ expect(page).to_not have_content('success')
29
+ expect(page).to have_content('Invalid email or password.')
30
+ end
31
+
32
+ it 'can sign out if they are signed in' do
33
+ email = generate(:email)
34
+ password = generate(:password)
35
+ user = create(:user, email: email, password: password)
36
+
37
+ visit new_user_session_path
38
+
39
+ fill_in 'Email', with: email
40
+ fill_in 'Password', with: password
41
+ click_on 'Sign in'
42
+
43
+ expect(page).to have_content('success')
44
+
45
+ click_link 'Sign out'
46
+
47
+ expect(page).to have_content('success')
48
+ end
49
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'A visitor', js: true do
4
+ it 'can create a new user' do
5
+ email = generate(:email)
6
+ password = generate(:password)
7
+ visit new_user_registration_path
8
+
9
+ fill_in 'Email', with: email
10
+ fill_in 'Password', with: password
11
+
12
+ click_button 'Sign up'
13
+
14
+ expect(page).to have_content I18n.t('devise.registrations.signed_up')
15
+
16
+ user = User.find_by(email: email)
17
+ expect(user).to be
18
+ end
19
+
20
+ it 'can not create a new user if they omit a field' do
21
+ email = generate(:email)
22
+ visit new_user_registration_path
23
+
24
+ fill_in 'Email', with: email
25
+
26
+ click_button 'Sign up'
27
+
28
+ expect(page).to have_content 'Sign up'
29
+ expect(page).to_not have_content 'success'
30
+ end
31
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prop_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Wroblewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-26 00:00:00.000000000 Z
11
+ date: 2013-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: travis
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: |
56
70
  Prop is a base Rails project that you can upgrade.
57
71
  It is used to get a jump start on a working app.
@@ -65,6 +79,7 @@ extra_rdoc_files:
65
79
  - LICENSE
66
80
  files:
67
81
  - .gitignore
82
+ - CHANGELOG.md
68
83
  - Gemfile
69
84
  - LICENSE
70
85
  - README.md
@@ -76,6 +91,7 @@ files:
76
91
  - lib/prop/version.rb
77
92
  - peg-leg-bates.jpg
78
93
  - prop.gemspec
94
+ - templates/.travis.yml
79
95
  - templates/Gemfile_clean
80
96
  - templates/Guardfile
81
97
  - templates/Procfile
@@ -84,6 +100,7 @@ files:
84
100
  - templates/_javascript.html.erb
85
101
  - templates/application.css.scss
86
102
  - templates/application.js
103
+ - templates/application_controller.rb
87
104
  - templates/backbone.js
88
105
  - templates/background_jobs_rspec.rb
89
106
  - templates/bin_setup
@@ -91,22 +108,28 @@ files:
91
108
  - templates/database_cleaner_rspec.rb
92
109
  - templates/disable_xml_params.rb
93
110
  - templates/errors.rb
111
+ - templates/factories.rb
94
112
  - templates/factories_spec.rb
95
113
  - templates/factories_spec_rake_task.rb
96
114
  - templates/factory_girl_syntax_rspec.rb
97
115
  - templates/javascripts/prefilled_input.js
98
116
  - templates/leaflet_map.js
99
117
  - templates/modernizr.js
118
+ - templates/nav_bar.html.erb
119
+ - templates/new_registration.html.erb
100
120
  - templates/places.coffee
101
121
  - templates/postgresql_database.yml.erb
102
122
  - templates/prop_gitignore
103
123
  - templates/prop_layout.html.erb.erb
104
124
  - templates/rack_timeout.rb
125
+ - templates/root_index.html.erb
105
126
  - templates/sample.env
106
127
  - templates/smtp.rb
107
128
  - templates/spec_helper.rb
108
129
  - templates/underscore.js
109
130
  - templates/unicorn.rb
131
+ - templates/user_sign_in_spec.rb
132
+ - templates/user_sign_up_spec.rb
110
133
  homepage: https://github.com/NathanielWroblewski/prop
111
134
  licenses:
112
135
  - MIT
@@ -128,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
151
  version: '0'
129
152
  requirements: []
130
153
  rubyforge_project:
131
- rubygems_version: 2.0.5
154
+ rubygems_version: 2.0.3
132
155
  signing_key:
133
156
  specification_version: 4
134
157
  summary: Generate a Rails app using pre-configured best practices