prop_up 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -221
- data/lib/prop/app_builder.rb +45 -28
- data/lib/prop/generators/app_generator.rb +40 -1
- data/lib/prop/version.rb +1 -1
- data/prop.gemspec +1 -0
- data/templates/Gemfile_clean +3 -0
- data/templates/application.js +9 -0
- data/templates/backbone.js +1586 -0
- data/templates/leaflet_map.js +50 -0
- data/templates/modernizr.js +834 -0
- data/templates/places.coffee +6 -0
- data/templates/prop_layout.html.erb.erb +20 -6
- data/templates/underscore.js +1282 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9144a765fc45d69c8991dd18ad1bd62aefdc81b1
|
4
|
+
data.tar.gz: 2771885b7b5d99583ee203d5ee1fcd0f544d138d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42a804cdca34fe37631b55c344d80fad53d5c61e35a5b9500cb4d521c3850c3a6d51eb0b13e13ce6069b8654ac8b7ee934856260ab738551dc7dc878e359c96f
|
7
|
+
data.tar.gz: 0abba4c7ab3f0e8877d970e48bea9cb59c6ab10a06c999a38a57b77b314f2873cd3c4b1985c1bbc0278adc179c8e2675dd5ccca3b9935eca69568030ddbd92d7
|
data/README.md
CHANGED
@@ -1,228 +1,9 @@
|
|
1
1
|
Prop
|
2
2
|
===
|
3
|
-
![Peg Leg Bates Photo](https://raw.github.com/NathanielWroblewski/prop/master/
|
3
|
+
![Peg Leg Bates Photo](https://raw.github.com/NathanielWroblewski/prop/master/peg-leg-bates.jpg)
|
4
4
|
|
5
5
|
Description
|
6
6
|
---
|
7
7
|
Prop is a Rails 4 app generator with customized defaults and an opinionated workflow.
|
8
8
|
|
9
|
-
|
10
|
-
---
|
11
|
-
First, install [hub](https://github.com/github/hub) if you don't have it.
|
12
|
-
```bash
|
13
|
-
brew install hub
|
14
|
-
```
|
15
|
-
Install Prop.
|
16
|
-
```bash
|
17
|
-
gem install prop
|
18
|
-
```
|
19
|
-
Let Prop prop your app up.
|
20
|
-
```bash
|
21
|
-
prop up <my-app-name>
|
22
|
-
```
|
23
|
-
Get all up inside your new app.
|
24
|
-
```bash
|
25
|
-
cd <my-app-name>
|
26
|
-
```
|
27
|
-
Open four tabs in your terminal. In the first, start [zeus](https://github.com/burke/zeus).
|
28
|
-
```bash
|
29
|
-
zeus start
|
30
|
-
```
|
31
|
-
Zeus pre-loads your Rails app making specs, rake tasks, and generators run much faster. Common tasks run through zeus include:
|
32
|
-
```bash
|
33
|
-
zeus g migration <name of migration>
|
34
|
-
zeus d migration <name of migration>
|
35
|
-
zeus rake db:create
|
36
|
-
zeus rake db:migrate
|
37
|
-
zeus rake db:test:prepare
|
38
|
-
zeus c
|
39
|
-
zeus s
|
40
|
-
```
|
41
|
-
In general, anything that would normally be `rails blah` is now `zeus blah`, and anything that would be `rake blah` is now `zeus rake blah`. Ctrl+c will exit.
|
42
|
-
|
43
|
-
In the next tab, start the zeus server.
|
44
|
-
```bash
|
45
|
-
zeus s
|
46
|
-
```
|
47
|
-
Use Ctrl+c to exit.
|
48
|
-
|
49
|
-
In the third tab, run [guard](https://github.com/guard/guard).
|
50
|
-
```bash
|
51
|
-
guard
|
52
|
-
```
|
53
|
-
Guard watches your spec files so that anytime you make a change, your specs will run. You can also hit your enter/return key to run all your specs. `exit` will exit guard.
|
54
|
-
|
55
|
-
I use the final tab as my normal terminal window/git branching/for entering `zeus c` when necessary.
|
56
|
-
|
57
|
-
Finally, create your database.
|
58
|
-
|
59
|
-
```bash
|
60
|
-
zeus rake db:create
|
61
|
-
```
|
62
|
-
|
63
|
-
Workflow
|
64
|
-
---
|
65
|
-
At a high level, have a `production` branch, a `master` branch for staging, and your development branches which are prefixed with your initials. Use continuous integration/continuous deployment so that when you push to master, your tests are run and your app is deployed to staging. When you push to production, your tests are run and the app is deployed to production. Rollbar is used to monitor errors, and Codeship is used for CI. The following git practices were inspired by [Thoughtbot](http://www.thoughtbot.com/)'s [protocol](https://github.com/thoughtbot/guides/tree/master/protocol).
|
66
|
-
|
67
|
-
1. Start a story in Pivotal Tracker (http://www.pivotaltracker.com) by clicking the 'start' button of a story assigned to you.
|
68
|
-
|
69
|
-
2. Create a new branch with
|
70
|
-
```bash
|
71
|
-
$ git checkout -b <your initials>-<name of branch>
|
72
|
-
```
|
73
|
-
For example:
|
74
|
-
```bash
|
75
|
-
$ git checkout -b nw-promo-codes
|
76
|
-
```
|
77
|
-
|
78
|
-
3. After changing files, stage your changes
|
79
|
-
```bash
|
80
|
-
$ git status
|
81
|
-
$ git add <changed file>
|
82
|
-
```
|
83
|
-
|
84
|
-
4. Commit your changes with a commit message that is under 80 characters
|
85
|
-
```bash
|
86
|
-
$ git commit -m '<commit message>'
|
87
|
-
```
|
88
|
-
|
89
|
-
5. If you have multiple, smaller commits that could be grouped into a larger commit, check the log to see how many commits you need to group together and then rebase them.
|
90
|
-
```bash
|
91
|
-
$ git log
|
92
|
-
$ git rebase -i HEAD~<the number of commits to be rebased>
|
93
|
-
```
|
94
|
-
For example:
|
95
|
-
```bash
|
96
|
-
$ git rebase -i HEAD~3
|
97
|
-
```
|
98
|
-
|
99
|
-
Note: The syntax is HEAD followed by a tilde (~) not a dash (-)
|
100
|
-
|
101
|
-
You will receive a message like this:
|
102
|
-
```bash
|
103
|
-
pick 95f08f0 <commit message>
|
104
|
-
pick 09d7d95 <commit message>
|
105
|
-
pick c86dd4e <commit message>
|
106
|
-
# Rebase 665d9f8..c86dd4e onto 665d9f8
|
107
|
-
#
|
108
|
-
# Commands:
|
109
|
-
# p, pick = use commit
|
110
|
-
# r, reword = use commit, but edit the commit message
|
111
|
-
# e, edit = use commit, but stop for amending
|
112
|
-
# s, squash = use commit, but meld into previous commit
|
113
|
-
# f, fixup = like "squash", but discard this commit's log message
|
114
|
-
# x, exec = run command (the rest of the line) using shell
|
115
|
-
```
|
116
|
-
|
117
|
-
Change the 'pick' to the appropriate command. In general, the top commit will receive an 'r' while the following commits will be fixed up with an 'f':
|
118
|
-
```bash
|
119
|
-
r 95f08f0 <commit message>
|
120
|
-
f 09d7d95 <commit message>
|
121
|
-
f c86dd4e <commit message>
|
122
|
-
# Rebase 665d9f8..c86dd4e onto 665d9f8
|
123
|
-
#
|
124
|
-
# Commands:
|
125
|
-
# p, pick = use commit
|
126
|
-
# r, reword = use commit, but edit the commit message
|
127
|
-
# e, edit = use commit, but stop for amending
|
128
|
-
# s, squash = use commit, but meld into previous commit
|
129
|
-
# f, fixup = like "squash", but discard this commit's log message
|
130
|
-
# x, exec = run command (the rest of the line) using shell
|
131
|
-
```
|
132
|
-
|
133
|
-
You will then be prompted to rename the commit message. The commit message should be assigned the Pivotal Tracker story id, followed by an 80 character commit message title, and an optional '*' delimited log of more detailed changes.
|
134
|
-
|
135
|
-
Generally, it should follow the form:
|
136
|
-
|
137
|
-
```
|
138
|
-
[#<Pivotal Tracker Story ID>] <80-character commit message>
|
139
|
-
|
140
|
-
* <detailed commit message>
|
141
|
-
* <detailed commit message>
|
142
|
-
```
|
143
|
-
|
144
|
-
For example:
|
145
|
-
```
|
146
|
-
[#12345678] Added a new kit page
|
147
|
-
|
148
|
-
* Generated a new kit controller
|
149
|
-
* Generated a new kit migration
|
150
|
-
...
|
151
|
-
```
|
152
|
-
|
153
|
-
6. If you have not yet pushed, or you didn't squash any commits or otherwise change history, you can leave off the `-f` flag on the following push. Otherwise, the branch you are working on should then be force pushed to change history. Then, open a pull request.
|
154
|
-
```bash
|
155
|
-
$ git branch
|
156
|
-
$ git push origin <branch name> -f
|
157
|
-
```
|
158
|
-
|
159
|
-
For example:
|
160
|
-
|
161
|
-
```bash
|
162
|
-
$ git push origin nw-promo-codes -f
|
163
|
-
```
|
164
|
-
|
165
|
-
A pull request can be made by visiting your github repo, selecting your branch name from the drop down, selecting the pull request icon, and then selecting the button to make a pull request.
|
166
|
-
|
167
|
-
7. When your pull request has been accepted, you should be sure to fetch the lastest master, and rebase master under your latest commit. Then force push to your branch to change history.
|
168
|
-
```bash
|
169
|
-
$ git fetch
|
170
|
-
$ git rebase origin/master
|
171
|
-
$ git push origin <name of branch> -f
|
172
|
-
```
|
173
|
-
|
174
|
-
If you have conflicts, be sure to continue the rebase after resolving the conflicts. Do not commit.
|
175
|
-
```bash
|
176
|
-
$ git status
|
177
|
-
$ git add <file after resolving conflicts>
|
178
|
-
$ git rebase --continue
|
179
|
-
```
|
180
|
-
|
181
|
-
8. Then, checkout master, pull the latest changes, and merge your branch into master only if there will not be a merge conflict.
|
182
|
-
```bash
|
183
|
-
$ git checkout master
|
184
|
-
$ git pull origin master
|
185
|
-
$ git merge <name of branch> --ff-only
|
186
|
-
```
|
187
|
-
For example:
|
188
|
-
```bash
|
189
|
-
$ git merge nw-promo-codes --ff-only
|
190
|
-
```
|
191
|
-
|
192
|
-
9. Now push your changes and delete your branch locally and remotely.
|
193
|
-
```bash
|
194
|
-
$ git push origin master
|
195
|
-
$ git branch -d <name of branch>
|
196
|
-
$ git push origin :<name of branch>
|
197
|
-
```
|
198
|
-
For example:
|
199
|
-
```bash
|
200
|
-
$ git branch -d nw-promo-codes
|
201
|
-
$ git push origin :nw-promo-codes
|
202
|
-
```
|
203
|
-
|
204
|
-
10. Mark your story in Pivotal Tracker as finished.
|
205
|
-
|
206
|
-
11. Once codeship has verified the tests pass, checkout your changes on staging on Heroku.
|
207
|
-
|
208
|
-
12. If your changes have been tested on staging, mark your story as delivered in Pivotal.
|
209
|
-
|
210
|
-
13. Once your story has been accepted and if it is time to push to production, checkout the production branch, merge master into it, and push your changes.
|
211
|
-
```bash
|
212
|
-
$ git checkout production
|
213
|
-
$ git merge master --ff-only
|
214
|
-
$ git push origin production
|
215
|
-
```
|
216
|
-
|
217
|
-
14. Once codeship has verified the tests pass, checkout your changes at on production. Monitor rollbar for any errors that may be occurring.
|
218
|
-
|
219
|
-
TODO
|
220
|
-
====
|
221
|
-
|
222
|
-
* Automate the opening of the iTerm tabs and run the scripts inside those tabs (starting zeus, guard, server)
|
223
|
-
* Add Devise
|
224
|
-
* Add a Google Maps map and a Leaflet map
|
225
|
-
* Add Figaro
|
226
|
-
* Add Google Places library
|
227
|
-
* Add Backbone
|
228
|
-
* Add spec generation
|
9
|
+
For questions on how to leverage Prop, consult the [wiki](https://github.com/NathanielWroblewski/prop/wiki).
|
data/lib/prop/app_builder.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module Prop
|
1
|
+
module Prop
|
2
2
|
class AppBuilder < Rails::AppBuilder
|
3
3
|
include Prop::Actions
|
4
4
|
|
@@ -77,6 +77,13 @@ module Prop
|
|
77
77
|
"Mail.register_interceptor RecipientInterceptor.new(ENV['EMAIL_RECIPIENTS'])\n"
|
78
78
|
end
|
79
79
|
|
80
|
+
def setup_devise
|
81
|
+
run 'rails g devise:install'
|
82
|
+
run 'rails g devise User'
|
83
|
+
run 'rake db:migrate'
|
84
|
+
run 'rails g devise:views'
|
85
|
+
end
|
86
|
+
|
80
87
|
def create_partials_directory
|
81
88
|
empty_directory 'app/views/application'
|
82
89
|
end
|
@@ -90,7 +97,8 @@ module Prop
|
|
90
97
|
end
|
91
98
|
|
92
99
|
def create_application_layout
|
93
|
-
|
100
|
+
remove_file 'app/views/layouts/application.html.erb'
|
101
|
+
copy_file 'prop_layout.html.erb.erb',
|
94
102
|
'app/views/layouts/application.html.erb',
|
95
103
|
:force => true
|
96
104
|
end
|
@@ -195,6 +203,10 @@ module Prop
|
|
195
203
|
'app/assets/stylesheets/application.css.scss'
|
196
204
|
end
|
197
205
|
|
206
|
+
def setup_google_places
|
207
|
+
copy_file 'places.coffee', 'app/assets/javascripts/places.coffee'
|
208
|
+
end
|
209
|
+
|
198
210
|
def setup_guardfile
|
199
211
|
copy_file 'Guardfile', 'Guardfile'
|
200
212
|
end
|
@@ -270,6 +282,29 @@ module Prop
|
|
270
282
|
"Application.routes.draw do\nend"
|
271
283
|
end
|
272
284
|
|
285
|
+
def setup_foundation
|
286
|
+
remove_file 'app/views/layouts/application.html.erb'
|
287
|
+
run 'rails g foundation:install'
|
288
|
+
end
|
289
|
+
|
290
|
+
def setup_modernizr
|
291
|
+
copy_file 'modernizr.js', 'app/assets/javascripts/modernizr.js'
|
292
|
+
end
|
293
|
+
|
294
|
+
def setup_backbone
|
295
|
+
copy_file 'backbone.js', 'app/assets/javascripts/backbone.js'
|
296
|
+
copy_file 'underscore.js', 'app/assets/javascripts/underscore.js'
|
297
|
+
end
|
298
|
+
|
299
|
+
def setup_application_js
|
300
|
+
remove_file 'app/assets/javascripts/application.js'
|
301
|
+
copy_file 'application.js', 'app/assets/javascripts/application.js'
|
302
|
+
end
|
303
|
+
|
304
|
+
def setup_backbone_rails
|
305
|
+
run 'rails g backbone:install'
|
306
|
+
end
|
307
|
+
|
273
308
|
def disable_xml_params
|
274
309
|
copy_file 'disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
|
275
310
|
end
|
@@ -280,42 +315,24 @@ module Prop
|
|
280
315
|
end
|
281
316
|
end
|
282
317
|
|
283
|
-
def open_tab
|
284
|
-
run 'PWD = pwd'
|
285
|
-
run 'launch () {
|
286
|
-
/usr/bin/osascript <<-EOF
|
287
|
-
tell application "iTerm"
|
288
|
-
make new terminal
|
289
|
-
tell the current terminal
|
290
|
-
activate current session
|
291
|
-
launch session "Default Session"
|
292
|
-
tell the last session
|
293
|
-
write text "cd $PWD"
|
294
|
-
end tell
|
295
|
-
end tell
|
296
|
-
end tell
|
297
|
-
EOF
|
298
|
-
}'
|
299
|
-
end
|
300
|
-
|
301
318
|
def start_zeus
|
302
|
-
run
|
303
|
-
|
319
|
+
run "launch () {
|
320
|
+
PWD = pwd
|
304
321
|
/usr/bin/osascript <<-EOF
|
305
|
-
tell application "iTerm"
|
322
|
+
tell application \"iTerm\"
|
306
323
|
make new terminal
|
307
324
|
tell the current terminal
|
308
325
|
activate current session
|
309
|
-
launch session "Default Session"
|
326
|
+
launch session \"Default Session\"
|
310
327
|
tell the last session
|
311
|
-
write text "cd $PWD"
|
312
|
-
write text "zeus start"
|
328
|
+
write text \"cd $PWD\"
|
329
|
+
write text \"zeus start\"
|
313
330
|
end tell
|
314
331
|
end tell
|
315
332
|
end tell
|
316
333
|
EOF
|
317
|
-
}
|
318
|
-
|
334
|
+
}
|
335
|
+
launch"
|
319
336
|
end
|
320
337
|
|
321
338
|
private
|
@@ -40,15 +40,22 @@ module Prop
|
|
40
40
|
invoke :setup_test_environment
|
41
41
|
invoke :setup_production_environment
|
42
42
|
invoke :setup_staging_environment
|
43
|
-
invoke :create_prop_views
|
44
43
|
invoke :setup_coffeescript
|
45
44
|
invoke :configure_app
|
46
45
|
invoke :setup_stylesheets
|
47
46
|
invoke :copy_miscellaneous_files
|
48
47
|
invoke :customize_error_pages
|
49
48
|
invoke :remove_routes_comment_lines
|
49
|
+
invoke :setup_modernizr
|
50
|
+
invoke :setup_backbone
|
51
|
+
invoke :setup_backbone_rails
|
52
|
+
invoke :setup_foundation
|
53
|
+
invoke :create_prop_views
|
54
|
+
invoke :setup_application_js
|
55
|
+
invoke :setup_google_places
|
50
56
|
invoke :create_guard_file
|
51
57
|
invoke :initialize_zeus
|
58
|
+
invoke :setup_devise
|
52
59
|
invoke :setup_git
|
53
60
|
invoke :create_heroku_apps
|
54
61
|
invoke :create_github_repo
|
@@ -103,6 +110,11 @@ module Prop
|
|
103
110
|
build :setup_staging_environment
|
104
111
|
end
|
105
112
|
|
113
|
+
def setup_devise
|
114
|
+
say 'Creating users, login, and facebook connect'
|
115
|
+
build :setup_devise
|
116
|
+
end
|
117
|
+
|
106
118
|
def create_prop_views
|
107
119
|
say 'Creating prop views'
|
108
120
|
build :create_partials_directory
|
@@ -136,6 +148,11 @@ module Prop
|
|
136
148
|
build :setup_stylesheets
|
137
149
|
end
|
138
150
|
|
151
|
+
def setup_google_places
|
152
|
+
say 'Integrating Google Places library'
|
153
|
+
build :setup_google_places
|
154
|
+
end
|
155
|
+
|
139
156
|
def create_guard_file
|
140
157
|
say 'Creating Guardfile'
|
141
158
|
build :setup_guardfile
|
@@ -191,6 +208,28 @@ module Prop
|
|
191
208
|
build :remove_routes_comment_lines
|
192
209
|
end
|
193
210
|
|
211
|
+
def setup_foundation
|
212
|
+
build :setup_foundation
|
213
|
+
end
|
214
|
+
|
215
|
+
def setup_modernizr
|
216
|
+
say 'Initializing modernizr.js'
|
217
|
+
build :setup_modernizr
|
218
|
+
end
|
219
|
+
|
220
|
+
def setup_backbone
|
221
|
+
say 'Initializing backbone.js'
|
222
|
+
build :setup_backbone
|
223
|
+
end
|
224
|
+
|
225
|
+
def setup_backbone_rails
|
226
|
+
build :setup_backbone_rails
|
227
|
+
end
|
228
|
+
|
229
|
+
def setup_application_js
|
230
|
+
build :setup_application_js
|
231
|
+
end
|
232
|
+
|
194
233
|
def start_zeus
|
195
234
|
build :start_zeus
|
196
235
|
end
|
data/lib/prop/version.rb
CHANGED
data/prop.gemspec
CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.required_ruby_version = '>= 2.0.0'
|
8
8
|
spec.add_dependency 'bundler', '~> 1.3'
|
9
9
|
spec.add_dependency 'rails', '4.0.0'
|
10
|
+
spec.add_dependency 'hub'
|
10
11
|
spec.authors = ['Nathaniel Wroblewski']
|
11
12
|
spec.date = Date.today.strftime('%Y-%m-%d')
|
12
13
|
|
data/templates/Gemfile_clean
CHANGED
@@ -5,9 +5,12 @@ ruby '2.0.0'
|
|
5
5
|
gem 'rails', '>= 4.0.0'
|
6
6
|
|
7
7
|
gem 'airbrake'
|
8
|
+
gem 'backbone-rails'
|
8
9
|
gem 'coffee-rails'
|
9
10
|
gem 'delayed_job_active_record', '>= 4.0.0'
|
11
|
+
gem 'devise'
|
10
12
|
gem 'email_validator'
|
13
|
+
gem 'figaro'
|
11
14
|
gem 'haml_coffee_assets'
|
12
15
|
gem 'jquery-rails'
|
13
16
|
gem 'paperclip'
|