gb-firestarter 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +19 -0
  5. data/CONTRIBUTING.md +38 -0
  6. data/Gemfile +5 -0
  7. data/Gemfile.lock +133 -0
  8. data/README.md +7 -36
  9. data/Rakefile +8 -0
  10. data/bin/rspec +16 -0
  11. data/firestarter.gemspec +34 -0
  12. data/lib/firestarter/actions.rb +35 -0
  13. data/lib/firestarter/app_builder.rb +297 -0
  14. data/lib/firestarter/generators/app_generator.rb +186 -0
  15. data/lib/firestarter/version.rb +4 -0
  16. data/lib/firestarter.rb +4 -0
  17. data/spec/features/new_project_spec.rb +38 -0
  18. data/spec/spec_helper.rb +21 -0
  19. data/spec/support/firestarter.rb +49 -0
  20. data/templates/Gemfile.erb +55 -0
  21. data/templates/Procfile +1 -0
  22. data/templates/README.md.erb +25 -0
  23. data/templates/Rakefile.erb +10 -0
  24. data/templates/_flashes.slim +3 -0
  25. data/templates/_javascript.slim +9 -0
  26. data/templates/application.sass +3 -0
  27. data/templates/bin_setup +17 -0
  28. data/templates/config_locales_en.yml +11 -0
  29. data/templates/database_cleaner_rspec.rb +21 -0
  30. data/templates/development_seeds.rb +13 -0
  31. data/templates/disable_xml_params.rb +3 -0
  32. data/templates/errors.rb +28 -0
  33. data/templates/factories_spec.rb +13 -0
  34. data/templates/factories_spec_rake_task.rb +15 -0
  35. data/templates/factory_girl_syntax_rspec.rb +3 -0
  36. data/templates/firestarter_gitignore +18 -0
  37. data/templates/firestarter_layout.slim.erb +12 -0
  38. data/templates/i18n.rb +3 -0
  39. data/templates/postgresql_database.yml.erb +12 -0
  40. data/templates/puma.rb +18 -0
  41. data/templates/rack_timeout.rb +1 -0
  42. data/templates/ruby-version.erb +1 -0
  43. data/templates/sample.env +3 -0
  44. data/templates/secret_token.rb +10 -0
  45. data/templates/smtp.rb +10 -0
  46. data/templates/spec_helper.rb +42 -0
  47. data/templates/staging.rb +3 -0
  48. metadata +78 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f13205124cd14aef77c91f0264a5e8e5c2b2ddc
4
- data.tar.gz: ef71d06e1ae0aa908898089c42f2976618bd641d
3
+ metadata.gz: 12415a11e8173b1e4ac8453932364eeef81c14aa
4
+ data.tar.gz: a7e71d5a890557833c0a4db136827850f12864fd
5
5
  SHA512:
6
- metadata.gz: 7fc13786de3c0b5ebd09e60606545b3bd953e1c71ee77690cfd929a6428ec1927bb17b0d1bd298eff450879078165d54d466cc6977e48e5f2d3f842a6f0ffbc2
7
- data.tar.gz: cb7c29ffbcde6b4144b61f18f9a872a5c7c94e6fc4a946a6cea32b5994135d02fe318d8d3efe0831b07d522ce9e6e1484fe1f50cb1f95d2260dea68d748f15a6
6
+ metadata.gz: c808f98e8179b080d282b47953a52f0ef48528777aac857b051d0a6cc9ae77b41b321ee6b8e451514a88e40f7920a5002b06b17acc54c2470ec2c982608d0a7f
7
+ data.tar.gz: 9b0299c99f0924e8e453fc7e321de8fb2686f603e45bc06b1073e4346e03ce61b7b68eaa08c2bc243db91231a57b3623272e98918bfb0e237cbf4e4a89f8af27
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ *.swp
3
+ /.bundle
4
+ /tmp/dummy
5
+ .ruby-gemset
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.5
data/.travis.yml ADDED
@@ -0,0 +1,19 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
4
+ - ruby-head
5
+ env:
6
+ - "RAILS_VERSION=4.1.8"
7
+ - "RAILS_VERSION=master"
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: ruby-head
11
+ - env: "RAILS_VERSION=master"
12
+ before_install:
13
+ - "echo '--colour' > ~/.rspec"
14
+ - git config --global user.name 'Travis CI'
15
+ - git config --global user.email 'travis-ci@example.com'
16
+ install:
17
+ - bundle install
18
+ notifications:
19
+ email: false
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,38 @@
1
+ We love pull requests. Here's a quick guide:
2
+
3
+ 1. Fork the repo.
4
+
5
+ 2. Run the tests. We only take pull requests with passing tests, and it's great
6
+ to know that you have a clean slate: `bundle && rake`
7
+
8
+ 3. Add a test for your change. Only refactoring and documentation changes
9
+ require no new tests. If you are adding functionality or fixing a bug, we need
10
+ a test!
11
+
12
+ 4. Make the test pass.
13
+
14
+ 5. Push to your fork and submit a pull request.
15
+
16
+
17
+ At this point you're waiting on us. We like to at least comment on, if not
18
+ accept, pull requests within three business days (and, typically, one business
19
+ day). We may suggest some changes or improvements or alternatives.
20
+
21
+ Some things that will increase the chance that your pull request is accepted,
22
+ taken straight from the Ruby on Rails guide:
23
+
24
+ * Use Rails idioms and helpers
25
+ * Include tests that fail without your code, and pass with it
26
+ * Update the documentation, the surrounding one, examples elsewhere, guides,
27
+ whatever is affected by your contribution
28
+
29
+ Syntax:
30
+
31
+ * Two spaces, no tabs.
32
+ * No trailing whitespace. Blank lines should not have any space.
33
+ * Prefer &&/|| over and/or.
34
+ * my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
35
+ * a = b and not a=b.
36
+ * Follow the conventions you see used in the source already.
37
+
38
+ And in case we didn't emphasize it enough: we love tests!
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'pry'
data/Gemfile.lock ADDED
@@ -0,0 +1,133 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gb-firestarter (0.0.1)
5
+ bundler (~> 1.3)
6
+ rails (= 4.1.8)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.1.8)
12
+ actionpack (= 4.1.8)
13
+ actionview (= 4.1.8)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ actionpack (4.1.8)
16
+ actionview (= 4.1.8)
17
+ activesupport (= 4.1.8)
18
+ rack (~> 1.5.2)
19
+ rack-test (~> 0.6.2)
20
+ actionview (4.1.8)
21
+ activesupport (= 4.1.8)
22
+ builder (~> 3.1)
23
+ erubis (~> 2.7.0)
24
+ activemodel (4.1.8)
25
+ activesupport (= 4.1.8)
26
+ builder (~> 3.1)
27
+ activerecord (4.1.8)
28
+ activemodel (= 4.1.8)
29
+ activesupport (= 4.1.8)
30
+ arel (~> 5.0.0)
31
+ activesupport (4.1.8)
32
+ i18n (~> 0.6, >= 0.6.9)
33
+ json (~> 1.7, >= 1.7.7)
34
+ minitest (~> 5.1)
35
+ thread_safe (~> 0.1)
36
+ tzinfo (~> 1.1)
37
+ arel (5.0.1.20140414130214)
38
+ aruba (0.5.4)
39
+ childprocess (>= 0.3.6)
40
+ cucumber (>= 1.1.1)
41
+ rspec-expectations (>= 2.7.0)
42
+ builder (3.1.4)
43
+ capybara (2.2.1)
44
+ mime-types (>= 1.16)
45
+ nokogiri (>= 1.3.3)
46
+ rack (>= 1.0.0)
47
+ rack-test (>= 0.5.4)
48
+ xpath (~> 2.0)
49
+ childprocess (0.5.1)
50
+ ffi (~> 1.0, >= 1.0.11)
51
+ coderay (1.1.0)
52
+ cucumber (1.3.13)
53
+ builder (>= 2.1.2)
54
+ diff-lcs (>= 1.1.3)
55
+ gherkin (~> 2.12)
56
+ multi_json (>= 1.7.5, < 2.0)
57
+ multi_test (>= 0.1.1)
58
+ diff-lcs (1.2.5)
59
+ erubis (2.7.0)
60
+ ffi (1.9.3)
61
+ gherkin (2.12.2)
62
+ multi_json (~> 1.3)
63
+ hike (1.2.3)
64
+ i18n (0.6.11)
65
+ json (1.8.1)
66
+ mail (2.6.3)
67
+ mime-types (>= 1.16, < 3)
68
+ method_source (0.8.2)
69
+ mime-types (1.25.1)
70
+ mini_portile (0.5.3)
71
+ minitest (5.5.0)
72
+ multi_json (1.9.2)
73
+ multi_test (0.1.1)
74
+ nokogiri (1.6.1)
75
+ mini_portile (~> 0.5.0)
76
+ pry (0.10.1)
77
+ coderay (~> 1.1.0)
78
+ method_source (~> 0.8.1)
79
+ slop (~> 3.4)
80
+ rack (1.5.2)
81
+ rack-test (0.6.2)
82
+ rack (>= 1.0)
83
+ rails (4.1.8)
84
+ actionmailer (= 4.1.8)
85
+ actionpack (= 4.1.8)
86
+ actionview (= 4.1.8)
87
+ activemodel (= 4.1.8)
88
+ activerecord (= 4.1.8)
89
+ activesupport (= 4.1.8)
90
+ bundler (>= 1.3.0, < 2.0)
91
+ railties (= 4.1.8)
92
+ sprockets-rails (~> 2.0)
93
+ railties (4.1.8)
94
+ actionpack (= 4.1.8)
95
+ activesupport (= 4.1.8)
96
+ rake (>= 0.8.7)
97
+ thor (>= 0.18.1, < 2.0)
98
+ rake (10.4.2)
99
+ rspec (2.14.1)
100
+ rspec-core (~> 2.14.0)
101
+ rspec-expectations (~> 2.14.0)
102
+ rspec-mocks (~> 2.14.0)
103
+ rspec-core (2.14.8)
104
+ rspec-expectations (2.14.5)
105
+ diff-lcs (>= 1.1.3, < 2.0)
106
+ rspec-mocks (2.14.6)
107
+ slop (3.6.0)
108
+ sprockets (2.12.3)
109
+ hike (~> 1.2)
110
+ multi_json (~> 1.0)
111
+ rack (~> 1.0)
112
+ tilt (~> 1.1, != 1.3.0)
113
+ sprockets-rails (2.2.2)
114
+ actionpack (>= 3.0)
115
+ activesupport (>= 3.0)
116
+ sprockets (>= 2.8, < 4.0)
117
+ thor (0.19.1)
118
+ thread_safe (0.3.4)
119
+ tilt (1.4.1)
120
+ tzinfo (1.2.2)
121
+ thread_safe (~> 0.1)
122
+ xpath (2.0.0)
123
+ nokogiri (~> 1.3)
124
+
125
+ PLATFORMS
126
+ ruby
127
+
128
+ DEPENDENCIES
129
+ aruba (~> 0.5.4)
130
+ capybara (~> 2.2, >= 2.2.0)
131
+ gb-firestarter!
132
+ pry
133
+ rspec (~> 2.0)
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Firestarter
1
+ # Firestarter [![Build Status](https://travis-ci.org/groupbuddies/firestarter.svg?branch=master)](https://travis-ci.org/groupbuddies/firestarter)
2
2
 
3
3
  Firestarter is the base Rails application used at [Group Buddies](http://groupbuddies.com).
4
4
 
@@ -7,13 +7,13 @@ Installation
7
7
 
8
8
  First install the firestarter gem:
9
9
 
10
- gem install firestarter
10
+ gem install gb-firestarter
11
11
 
12
12
  Then run:
13
13
 
14
14
  firestarter projectname
15
15
 
16
- This will create a Rails 4.0 app in `projectname`.
16
+ This will create a Rails app in `projectname`.
17
17
 
18
18
  By default this script creates a new git repository. See below if you
19
19
  want to use it against an existing repo.
@@ -41,6 +41,7 @@ It includes application gems like:
41
41
  * [Unicorn](https://github.com/defunkt/unicorn) to serve HTTP requests
42
42
  * [Title](https://github.com/calebthompson/title) for storing titles in
43
43
  translations
44
+ * [Dotenv](https://github.com/bkeepers/dotenv) for loading environment variables
44
45
 
45
46
  And gems only for staging and production like:
46
47
 
@@ -50,10 +51,7 @@ And gems only for staging and production like:
50
51
 
51
52
  And development gems like:
52
53
 
53
- * [Dotenv](https://github.com/bkeepers/dotenv) for loading environment variables
54
54
  * [Pry Rails](https://github.com/rweng/pry-rails) for debugging
55
- * [Spring](https://github.com/rails/spring) for fast Rails actions via
56
- pre-loading
57
55
 
58
56
  And testing gems like:
59
57
 
@@ -90,7 +88,7 @@ Firestarter also comes with:
90
88
 
91
89
  Firestarter fixes several of Rails' [insecure defaults]:
92
90
 
93
- * Firestarter uses Unicorn instead of WEBrick, allowing less verbose Server
91
+ * Firestarter uses Puma instead of WEBrick, allowing less verbose Server
94
92
  headers.
95
93
  * Firestarter is configured to pull your application secret key base from an
96
94
  environment variable, which means you won't need to risk placing it in version
@@ -98,20 +96,6 @@ Firestarter fixes several of Rails' [insecure defaults]:
98
96
 
99
97
  [insecure defaults]: http://blog.codeclimate.com/blog/2013/03/27/rails-insecure-defaults/
100
98
 
101
- Heroku
102
- ------
103
-
104
- You can optionally create Heroku staging and production apps:
105
-
106
- firestarter app --heroku true
107
-
108
- This:
109
-
110
- * Creates a staging and production Heroku app
111
- * Sets them as `staging` and `production` Git remotes
112
- * Configures staging with `RACK_ENV` and `RAILS_ENV` environment variables set
113
- to `staging`
114
-
115
99
  Git
116
100
  ---
117
101
 
@@ -120,23 +104,10 @@ bypass this with the `--skip-git` option:
120
104
 
121
105
  firestarter app --skip-git true
122
106
 
123
- GitHub
124
- ------
125
-
126
- You can optionally create a GitHub repository for the new Rails app. It
127
- requires that you have [Hub](https://github.com/github/hub) on your system:
128
-
129
- curl http://hub.github.com/standalone -sLo ~/bin/hub && chmod +x ~/bin/hub
130
- firestarter app --github organization/project
131
-
132
- This has the same effect as running:
133
-
134
- hub create organization/project
135
-
136
107
  Dependencies
137
108
  ------------
138
109
 
139
- Firestarter requires Ruby 1.9.2 or greater.
110
+ Firestarter requires Ruby 2.1.0 or greater.
140
111
 
141
112
  Some gems included in Firestarter have native extensions. You should have GCC
142
113
  installed on your machine before generating an app with Firestarter.
@@ -180,5 +151,5 @@ Firestarter is maintained by
180
151
  License
181
152
  -------
182
153
 
183
- Firestarter is © 2014 GB-Software As A Service, Lda. It is free software and may be
154
+ Firestarter is © 2014 GB-Software As A Service, Lda. It is free software and may be
184
155
  redistributed under the terms specified in the [LICENSE](LICENSE) file.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:rspec)
6
+
7
+ desc 'Run the test suite'
8
+ task :default => :rspec
data/bin/rspec ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -0,0 +1,34 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'firestarter/version'
4
+ require 'date'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'gb-firestarter'
8
+ s.version = Firestarter::VERSION
9
+ s.summary = "Generate a Rails app using groupbuddies's best practices and opinions."
10
+ s.description = <<-HERE
11
+ Firestarter is the way to get great apps up and running in a heartbeat. It's
12
+ what we use at Group Buddies.
13
+ HERE
14
+ s.authors = ['groupbuddies']
15
+ s.email = 'contact@groupbuddies.com'
16
+ s.files = `git ls-files`.split("\n")
17
+ s.homepage = 'http://github.com/groupbuddies/firestarter'
18
+ s.extra_rdoc_files = %w[README.md LICENSE]
19
+ s.license = 'MIT'
20
+
21
+ s.executables = ['firestarter']
22
+ s.rdoc_options = ['--charset=UTF-8']
23
+ s.require_paths = ['lib']
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.required_ruby_version = '>= 1.9.2'
26
+ s.date = Date.today.strftime('%Y-%m-%d')
27
+
28
+ s.add_dependency 'bundler', '~> 1.3'
29
+ s.add_dependency 'rails', Firestarter::RAILS_VERSION
30
+
31
+ s.add_development_dependency 'aruba', '~> 0.5.4'
32
+ s.add_development_dependency 'rspec', '~> 2.0'
33
+ s.add_development_dependency 'capybara', '~> 2.2', '>= 2.2.0'
34
+ end
@@ -0,0 +1,35 @@
1
+ module Firestarter
2
+ module Actions
3
+ def replace_in_file(relative_path, find, replace)
4
+ path = File.join(destination_root, relative_path)
5
+ contents = IO.read(path)
6
+ unless contents.gsub!(find, replace)
7
+ raise "#{find.inspect} not found in #{relative_path}"
8
+ end
9
+ File.open(path, "w") { |file| file.write(contents) }
10
+ end
11
+
12
+ def action_mailer_host(rails_env, host)
13
+ host_config = "config.action_mailer.default_url_options = { host: '#{host}' }"
14
+ configure_environment(rails_env, host_config)
15
+ end
16
+
17
+ def configure_environment(rails_env, config)
18
+ inject_into_file(
19
+ "config/environments/#{rails_env}.rb",
20
+ "\n\n #{config}",
21
+ before: "\nend"
22
+ )
23
+ end
24
+
25
+ def download_file(uri_string, destination)
26
+ uri = URI.parse(uri_string)
27
+ http = Net::HTTP.new(uri.host, uri.port)
28
+ http.use_ssl = true if uri_string =~ /^https/
29
+ request = Net::HTTP::Get.new(uri.path)
30
+ contents = http.request(request).body
31
+ path = File.join(destination_root, destination)
32
+ File.open(path, "w") { |file| file.write(contents) }
33
+ end
34
+ end
35
+ end