startblock 1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.ruby-version +1 -0
- data/.travis.yml +12 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +121 -0
- data/LICENSE +46 -0
- data/NEWS.md +2 -0
- data/README.md +64 -0
- data/bin/rake +16 -0
- data/bin/setup +13 -0
- data/bin/startblock +13 -0
- data/lib/startblock/actions.rb +25 -0
- data/lib/startblock/app_builder.rb +144 -0
- data/lib/startblock/generators/app_generator.rb +136 -0
- data/lib/startblock/version.rb +5 -0
- data/lib/startblock.rb +4 -0
- data/startblock.gemspec +33 -0
- data/templates/Gemfile.erb +44 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +8 -0
- data/templates/_flashes.html.erb +7 -0
- data/templates/_javascript.html.erb +5 -0
- data/templates/_mixpanel.html.erb +5 -0
- data/templates/application.css.scss +8 -0
- data/templates/bin_setup.erb +34 -0
- data/templates/postgresql_database.yml.erb +12 -0
- data/templates/sample.env +3 -0
- data/templates/secrets.yml +14 -0
- data/templates/staging.rb +1 -0
- data/templates/startblock_gitignore +14 -0
- data/templates/startblock_layout.html.erb.erb +16 -0
- data/templates/test_helper.erb +27 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 60770b3aee9993bc321411044b1b2bc6d77cad21
|
4
|
+
data.tar.gz: 51dc9c7591cbd8fcb0efb910319f790408fee989
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bdf0ecea21f68d2f25272f3684d1c08652a7cdb2bee310371c6fc22279e83137d0343bd9c490cda76ee15778c97fd397c9b1fa1a12197d6414e6687046912c56
|
7
|
+
data.tar.gz: e4c166fec18727d8f5383975fa22530bbee45d406f78fe931a426168be93b45ca4861856a89269fa8a3e85008fdbdd2799475fa509dd7fc40c8e47524cec01a9
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.5
|
data/.travis.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.2.0
|
4
|
+
before_install:
|
5
|
+
- "echo '--colour' > ~/.rspec"
|
6
|
+
- git config --global user.name 'Travis CI'
|
7
|
+
- git config --global user.email 'travis-ci@example.com'
|
8
|
+
install:
|
9
|
+
- bundle install
|
10
|
+
notifications:
|
11
|
+
email: false
|
12
|
+
sudo: false
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
startblock (1.0)
|
5
|
+
bitters (~> 0.10)
|
6
|
+
bundler (~> 1.3)
|
7
|
+
rails (= 4.2.0)
|
8
|
+
thor (~> 0.19)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
actionmailer (4.2.0)
|
14
|
+
actionpack (= 4.2.0)
|
15
|
+
actionview (= 4.2.0)
|
16
|
+
activejob (= 4.2.0)
|
17
|
+
mail (~> 2.5, >= 2.5.4)
|
18
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
19
|
+
actionpack (4.2.0)
|
20
|
+
actionview (= 4.2.0)
|
21
|
+
activesupport (= 4.2.0)
|
22
|
+
rack (~> 1.6.0)
|
23
|
+
rack-test (~> 0.6.2)
|
24
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
25
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
26
|
+
actionview (4.2.0)
|
27
|
+
activesupport (= 4.2.0)
|
28
|
+
builder (~> 3.1)
|
29
|
+
erubis (~> 2.7.0)
|
30
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
31
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
32
|
+
activejob (4.2.0)
|
33
|
+
activesupport (= 4.2.0)
|
34
|
+
globalid (>= 0.3.0)
|
35
|
+
activemodel (4.2.0)
|
36
|
+
activesupport (= 4.2.0)
|
37
|
+
builder (~> 3.1)
|
38
|
+
activerecord (4.2.0)
|
39
|
+
activemodel (= 4.2.0)
|
40
|
+
activesupport (= 4.2.0)
|
41
|
+
arel (~> 6.0)
|
42
|
+
activesupport (4.2.0)
|
43
|
+
i18n (~> 0.7)
|
44
|
+
json (~> 1.7, >= 1.7.7)
|
45
|
+
minitest (~> 5.1)
|
46
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
47
|
+
tzinfo (~> 1.1)
|
48
|
+
arel (6.0.0)
|
49
|
+
bitters (0.10.1)
|
50
|
+
bourbon (>= 3.2)
|
51
|
+
sass (>= 3.2)
|
52
|
+
thor
|
53
|
+
bourbon (4.2.0)
|
54
|
+
sass (~> 3.4)
|
55
|
+
thor
|
56
|
+
builder (3.2.2)
|
57
|
+
erubis (2.7.0)
|
58
|
+
globalid (0.3.3)
|
59
|
+
activesupport (>= 4.1.0)
|
60
|
+
hike (1.2.3)
|
61
|
+
i18n (0.7.0)
|
62
|
+
json (1.8.2)
|
63
|
+
loofah (2.0.1)
|
64
|
+
nokogiri (>= 1.5.9)
|
65
|
+
mail (2.6.3)
|
66
|
+
mime-types (>= 1.16, < 3)
|
67
|
+
mime-types (2.4.3)
|
68
|
+
mini_portile (0.6.2)
|
69
|
+
minitest (5.5.1)
|
70
|
+
multi_json (1.10.1)
|
71
|
+
nokogiri (1.6.6.2)
|
72
|
+
mini_portile (~> 0.6.0)
|
73
|
+
rack (1.6.0)
|
74
|
+
rack-test (0.6.3)
|
75
|
+
rack (>= 1.0)
|
76
|
+
rails (4.2.0)
|
77
|
+
actionmailer (= 4.2.0)
|
78
|
+
actionpack (= 4.2.0)
|
79
|
+
actionview (= 4.2.0)
|
80
|
+
activejob (= 4.2.0)
|
81
|
+
activemodel (= 4.2.0)
|
82
|
+
activerecord (= 4.2.0)
|
83
|
+
activesupport (= 4.2.0)
|
84
|
+
bundler (>= 1.3.0, < 2.0)
|
85
|
+
railties (= 4.2.0)
|
86
|
+
sprockets-rails
|
87
|
+
rails-deprecated_sanitizer (1.0.3)
|
88
|
+
activesupport (>= 4.2.0.alpha)
|
89
|
+
rails-dom-testing (1.0.5)
|
90
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
91
|
+
nokogiri (~> 1.6.0)
|
92
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
93
|
+
rails-html-sanitizer (1.0.1)
|
94
|
+
loofah (~> 2.0)
|
95
|
+
railties (4.2.0)
|
96
|
+
actionpack (= 4.2.0)
|
97
|
+
activesupport (= 4.2.0)
|
98
|
+
rake (>= 0.8.7)
|
99
|
+
thor (>= 0.18.1, < 2.0)
|
100
|
+
rake (10.4.2)
|
101
|
+
sass (3.4.11)
|
102
|
+
sprockets (2.12.3)
|
103
|
+
hike (~> 1.2)
|
104
|
+
multi_json (~> 1.0)
|
105
|
+
rack (~> 1.0)
|
106
|
+
tilt (~> 1.1, != 1.3.0)
|
107
|
+
sprockets-rails (2.2.4)
|
108
|
+
actionpack (>= 3.0)
|
109
|
+
activesupport (>= 3.0)
|
110
|
+
sprockets (>= 2.8, < 4.0)
|
111
|
+
thor (0.19.1)
|
112
|
+
thread_safe (0.3.4)
|
113
|
+
tilt (1.4.1)
|
114
|
+
tzinfo (1.2.2)
|
115
|
+
thread_safe (~> 0.1)
|
116
|
+
|
117
|
+
PLATFORMS
|
118
|
+
ruby
|
119
|
+
|
120
|
+
DEPENDENCIES
|
121
|
+
startblock!
|
data/LICENSE
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2015 Firmhouse
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
23
|
+
|
24
|
+
ORIGINAL SUSPENDERS LICENSE:
|
25
|
+
|
26
|
+
The MIT License
|
27
|
+
|
28
|
+
Copyright (c) 2010-2012 Mike Burns and thoughtbot, inc.
|
29
|
+
|
30
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
31
|
+
of this software and associated documentation files (the "Software"), to deal
|
32
|
+
in the Software without restriction, including without limitation the rights
|
33
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
34
|
+
copies of the Software, and to permit persons to whom the Software is
|
35
|
+
furnished to do so, subject to the following conditions:
|
36
|
+
|
37
|
+
The above copyright notice and this permission notice shall be included in
|
38
|
+
all copies or substantial portions of the Software.
|
39
|
+
|
40
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
41
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
42
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
43
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
44
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
45
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
46
|
+
THE SOFTWARE.
|
data/NEWS.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Startblock
|
2
|
+
|
3
|
+
Startblock is the base Rails application used at
|
4
|
+
[Firmhouse](http://firmhouse.com).
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
First install the startblock gem:
|
9
|
+
|
10
|
+
$ gem install startblock
|
11
|
+
|
12
|
+
Then run:
|
13
|
+
|
14
|
+
$ startblock projectname
|
15
|
+
|
16
|
+
this will create a Rails app in `projectname` using the latest version of Rails.
|
17
|
+
|
18
|
+
## Gemfile
|
19
|
+
|
20
|
+
To see the latest and greatest gems, look at Startblock' [Gemfile](templates/Gemfile.erb).
|
21
|
+
|
22
|
+
## Other goodies
|
23
|
+
|
24
|
+
Startblock also comes with:
|
25
|
+
|
26
|
+
* The `./bin/setup` convention for new developer setup based on the
|
27
|
+
rails 4.2 standard.
|
28
|
+
* Rails' flashes set up and in application layout
|
29
|
+
* An automatically-created `SECRET_KEY_BASE` environment variable in all
|
30
|
+
environments
|
31
|
+
* Mixpanel integration
|
32
|
+
* A basic README
|
33
|
+
|
34
|
+
## Dependencies
|
35
|
+
|
36
|
+
Startblock requires Ruby 2.1.5.
|
37
|
+
|
38
|
+
Some gems included in Startblock have native extensions. You should have GCC
|
39
|
+
installed on your machine before generating an app with Startblock.
|
40
|
+
|
41
|
+
Use [Command Line Tools for XCode](https://developer.apple.com/downloads/index.action)
|
42
|
+
for Lion (OS X 10.7) or Mountain Lion (OS X 10.8).
|
43
|
+
|
44
|
+
PostgreSQL needs to be installed and running for the `db:create` rake task.
|
45
|
+
|
46
|
+
## Issues
|
47
|
+
|
48
|
+
If you have problems, please create a
|
49
|
+
[GitHub Issue](https://github.com/firmhouse/startblock/issues).
|
50
|
+
|
51
|
+
## Credits
|
52
|
+
|
53
|
+
This gem is cloned from the [Suspenders][suspenders] project and formatted to
|
54
|
+
the wishes we have at Firmhouse. The main idea of this gem goes out to the amazing people at
|
55
|
+
[Thoughtbot][thoughtbot].
|
56
|
+
|
57
|
+
[thoughbot]: http://thoughtbot.com
|
58
|
+
[suspenders]: http://github.com/thoughtbot/suspenders
|
59
|
+
|
60
|
+
|
61
|
+
## License
|
62
|
+
|
63
|
+
The original Suspenders gem is Copyright © 2008-2014 thoughtbot. It is free software, and may be
|
64
|
+
redistributed under the terms specified in the LICENSE file.
|
data/bin/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' 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('rake', 'rake')
|
data/bin/setup
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env sh
|
2
|
+
|
3
|
+
# Run this script immediately after cloning the codebase.
|
4
|
+
|
5
|
+
# Exit if any subcommand fails
|
6
|
+
set -e
|
7
|
+
|
8
|
+
# Set up Ruby dependencies via Bundler
|
9
|
+
bundle install
|
10
|
+
|
11
|
+
# Add binstubs to PATH in ~/.zshenv like this:
|
12
|
+
# export PATH=".git/safe/../../bin:$PATH"
|
13
|
+
mkdir -p .git/safe
|
data/bin/startblock
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
|
5
|
+
$LOAD_PATH << source_path
|
6
|
+
|
7
|
+
require 'startblock'
|
8
|
+
|
9
|
+
templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
|
10
|
+
Startblock::AppGenerator.source_root templates_root
|
11
|
+
Startblock::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
|
12
|
+
|
13
|
+
Startblock::AppGenerator.start
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Startblock
|
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
|
+
config = "config.action_mailer.default_url_options = { host: #{host} }"
|
14
|
+
configure_environment(rails_env, 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
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
module Startblock
|
2
|
+
class AppBuilder < Rails::AppBuilder
|
3
|
+
include Startblock::Actions
|
4
|
+
|
5
|
+
def readme
|
6
|
+
template 'README.md.erb', 'README.md'
|
7
|
+
end
|
8
|
+
|
9
|
+
def replace_gemfile
|
10
|
+
remove_file 'Gemfile'
|
11
|
+
template 'Gemfile.erb', 'Gemfile'
|
12
|
+
end
|
13
|
+
|
14
|
+
def set_ruby_to_version_being_used
|
15
|
+
create_file '.ruby-version', "#{Startblock::RUBY_VERSION}\n"
|
16
|
+
end
|
17
|
+
|
18
|
+
def use_postgres_config_template
|
19
|
+
template 'postgresql_database.yml.erb', 'config/database.yml',
|
20
|
+
force: true
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_database
|
24
|
+
bundle_command 'exec rake db:create db:migrate'
|
25
|
+
end
|
26
|
+
|
27
|
+
def raise_on_delivery_errors
|
28
|
+
replace_in_file 'config/environments/development.rb',
|
29
|
+
'raise_delivery_errors = false', 'raise_delivery_errors = true'
|
30
|
+
end
|
31
|
+
|
32
|
+
def raise_on_unpermitted_parameters
|
33
|
+
config = <<-RUBY
|
34
|
+
config.action_controller.action_on_unpermitted_parameters = :raise
|
35
|
+
RUBY
|
36
|
+
|
37
|
+
inject_into_class "config/application.rb", "Application", config
|
38
|
+
end
|
39
|
+
|
40
|
+
def provide_setup_script
|
41
|
+
remove_file "bin/setup"
|
42
|
+
template "bin_setup.erb", "bin/setup"
|
43
|
+
run "chmod a+x bin/setup"
|
44
|
+
end
|
45
|
+
|
46
|
+
def configure_i18n_for_missing_translations
|
47
|
+
raise_on_missing_translations_in("development")
|
48
|
+
raise_on_missing_translations_in("test")
|
49
|
+
end
|
50
|
+
|
51
|
+
def configuring_test_helper
|
52
|
+
remove_file "test/test_helper.rb"
|
53
|
+
template "test_helper.erb", "test/test_helper.rb"
|
54
|
+
end
|
55
|
+
|
56
|
+
def setup_staging_environment
|
57
|
+
staging_file = 'config/environments/staging.rb'
|
58
|
+
copy_file 'staging.rb', staging_file
|
59
|
+
|
60
|
+
config = <<-RUBY
|
61
|
+
|
62
|
+
Rails.application.configure do
|
63
|
+
# ...
|
64
|
+
end
|
65
|
+
RUBY
|
66
|
+
|
67
|
+
append_file staging_file, config
|
68
|
+
end
|
69
|
+
|
70
|
+
def setup_secret_token
|
71
|
+
template 'secrets.yml', 'config/secrets.yml', force: true
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_partials_directory
|
75
|
+
empty_directory 'app/views/application'
|
76
|
+
end
|
77
|
+
|
78
|
+
def create_shared_flashes
|
79
|
+
copy_file '_flashes.html.erb', 'app/views/application/_flashes.html.erb'
|
80
|
+
end
|
81
|
+
|
82
|
+
def create_shared_javascripts
|
83
|
+
copy_file '_javascript.html.erb', 'app/views/application/_javascript.html.erb'
|
84
|
+
end
|
85
|
+
|
86
|
+
def create_application_layout
|
87
|
+
template 'startblock_layout.html.erb.erb',
|
88
|
+
'app/views/layouts/application.html.erb',
|
89
|
+
force: true
|
90
|
+
end
|
91
|
+
|
92
|
+
def configure_action_mailer
|
93
|
+
action_mailer_host "development", %{"localhost:1205"}
|
94
|
+
action_mailer_host "test", %{"www.example.com"}
|
95
|
+
end
|
96
|
+
|
97
|
+
def setup_foreman
|
98
|
+
copy_file 'sample.env', '.sample.env'
|
99
|
+
copy_file 'Procfile', 'Procfile'
|
100
|
+
end
|
101
|
+
|
102
|
+
def setup_stylesheets
|
103
|
+
remove_file 'app/assets/stylesheets/application.css'
|
104
|
+
copy_file 'application.css.scss',
|
105
|
+
'app/assets/stylesheets/application.css.scss'
|
106
|
+
end
|
107
|
+
|
108
|
+
def install_bitters
|
109
|
+
run "bitters install --path app/assets/stylesheets"
|
110
|
+
end
|
111
|
+
|
112
|
+
def install_refills
|
113
|
+
run "rails generate refills:import flashes"
|
114
|
+
end
|
115
|
+
|
116
|
+
def remove_routes_comment_lines
|
117
|
+
replace_in_file 'config/routes.rb',
|
118
|
+
/Rails\.application\.routes\.draw do.*end/m,
|
119
|
+
"Rails.application.routes.draw do\nend"
|
120
|
+
end
|
121
|
+
|
122
|
+
def gitignore_files
|
123
|
+
remove_file '.gitignore'
|
124
|
+
copy_file 'startblock_gitignore', '.gitignore'
|
125
|
+
end
|
126
|
+
|
127
|
+
def init_git
|
128
|
+
run 'git init'
|
129
|
+
end
|
130
|
+
|
131
|
+
def setup_mixpanel
|
132
|
+
copy_file '_mixpanel.html.erb',
|
133
|
+
'app/views/application/_mixpanel.html.erb'
|
134
|
+
end
|
135
|
+
|
136
|
+
private
|
137
|
+
|
138
|
+
def raise_on_missing_translations_in(environment)
|
139
|
+
config = 'config.action_view.raise_on_missing_translations = true'
|
140
|
+
|
141
|
+
uncomment_lines("config/environments/#{environment}.rb", config)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/rails/app/app_generator'
|
3
|
+
|
4
|
+
module Startblock
|
5
|
+
class AppGenerator < Rails::Generators::AppGenerator
|
6
|
+
class_option :database, type: :string, aliases: "-d", default: "postgresql",
|
7
|
+
desc: "Configure for selected database (options: #{DATABASES.join("/")})"
|
8
|
+
|
9
|
+
class_option :skip_test_unit, type: :boolean, aliases: "-T", default: false,
|
10
|
+
desc: "Skip Test::Unit files"
|
11
|
+
|
12
|
+
class_option :skip_turbolinks, type: :boolean, default: false,
|
13
|
+
desc: "Skip turbolinks gem"
|
14
|
+
|
15
|
+
def finish_template
|
16
|
+
invoke :startblock_customization
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def startblock_customization
|
21
|
+
invoke :customize_gemfile
|
22
|
+
invoke :setup_development_environment
|
23
|
+
invoke :setup_testing_environment
|
24
|
+
invoke :setup_staging_environment
|
25
|
+
invoke :setup_secret_token
|
26
|
+
invoke :create_startblock_views
|
27
|
+
invoke :configure_app
|
28
|
+
invoke :setup_stylesheets
|
29
|
+
invoke :install_bitters
|
30
|
+
invoke :install_refills
|
31
|
+
invoke :remove_routes_comment_lines
|
32
|
+
invoke :setup_git
|
33
|
+
invoke :setup_database
|
34
|
+
invoke :setup_mixpanel
|
35
|
+
invoke :outro
|
36
|
+
end
|
37
|
+
|
38
|
+
def customize_gemfile
|
39
|
+
build :replace_gemfile
|
40
|
+
build :set_ruby_to_version_being_used
|
41
|
+
|
42
|
+
bundle_command 'install'
|
43
|
+
end
|
44
|
+
|
45
|
+
def setup_development_environment
|
46
|
+
say 'Setting up the development environment'
|
47
|
+
build :raise_on_delivery_errors
|
48
|
+
build :raise_on_unpermitted_parameters
|
49
|
+
build :provide_setup_script
|
50
|
+
build :configure_i18n_for_missing_translations
|
51
|
+
end
|
52
|
+
|
53
|
+
def setup_testing_environment
|
54
|
+
say "Setting up the testing environment"
|
55
|
+
build :configuring_test_helper
|
56
|
+
end
|
57
|
+
|
58
|
+
def setup_staging_environment
|
59
|
+
say 'Setting up the staging environment'
|
60
|
+
build :setup_staging_environment
|
61
|
+
end
|
62
|
+
|
63
|
+
def setup_secret_token
|
64
|
+
say 'Moving secret token out of version control'
|
65
|
+
build :setup_secret_token
|
66
|
+
end
|
67
|
+
|
68
|
+
def create_startblock_views
|
69
|
+
say 'Creating Startblock views'
|
70
|
+
build :create_partials_directory
|
71
|
+
build :create_shared_flashes
|
72
|
+
build :create_shared_javascripts
|
73
|
+
build :create_application_layout
|
74
|
+
end
|
75
|
+
|
76
|
+
def configure_app
|
77
|
+
say 'Configuring app'
|
78
|
+
build :configure_action_mailer
|
79
|
+
build :setup_foreman
|
80
|
+
end
|
81
|
+
|
82
|
+
def setup_stylesheets
|
83
|
+
say 'Set up stylesheets'
|
84
|
+
build :setup_stylesheets
|
85
|
+
end
|
86
|
+
|
87
|
+
def install_bitters
|
88
|
+
say 'Install Bitters'
|
89
|
+
build :install_bitters
|
90
|
+
end
|
91
|
+
|
92
|
+
def install_refills
|
93
|
+
say "Install Refills"
|
94
|
+
build :install_refills
|
95
|
+
end
|
96
|
+
|
97
|
+
def remove_routes_comment_lines
|
98
|
+
build :remove_routes_comment_lines
|
99
|
+
end
|
100
|
+
|
101
|
+
def setup_git
|
102
|
+
say 'Initializing git'
|
103
|
+
build :gitignore_files
|
104
|
+
build :init_git
|
105
|
+
end
|
106
|
+
|
107
|
+
def setup_database
|
108
|
+
say 'Setting up database'
|
109
|
+
|
110
|
+
if 'postgresql' == options[:database]
|
111
|
+
build :use_postgres_config_template
|
112
|
+
end
|
113
|
+
|
114
|
+
build :create_database
|
115
|
+
end
|
116
|
+
|
117
|
+
def setup_mixpanel
|
118
|
+
say 'Setting up Mixpanel'
|
119
|
+
build :setup_mixpanel
|
120
|
+
end
|
121
|
+
|
122
|
+
def outro
|
123
|
+
say 'Congratulations! You just entered our startblock.'
|
124
|
+
end
|
125
|
+
|
126
|
+
def run_bundle
|
127
|
+
# Let's not: We'll bundle manually at the right spot
|
128
|
+
end
|
129
|
+
|
130
|
+
protected
|
131
|
+
|
132
|
+
def get_builder_class
|
133
|
+
Startblock::AppBuilder
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
data/lib/startblock.rb
ADDED
data/startblock.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'startblock/version'
|
4
|
+
require 'date'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.required_ruby_version = ">= #{Startblock::RUBY_VERSION}"
|
8
|
+
s.authors = ['Jeroen van Baarsen', 'Firmhouse']
|
9
|
+
s.date = Date.today.strftime('%Y-%m-%d')
|
10
|
+
|
11
|
+
s.description = <<-HERE
|
12
|
+
Startblock is a base Rails project. It is used by Firmhouse to get a jump
|
13
|
+
start on a working app.
|
14
|
+
HERE
|
15
|
+
|
16
|
+
s.email = 'hello@firmhouse.com'
|
17
|
+
s.executables = ['startblock']
|
18
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.homepage = 'http://github.com/firmhouse/startblock'
|
21
|
+
s.license = 'MIT'
|
22
|
+
s.name = 'startblock'
|
23
|
+
s.rdoc_options = ['--charset=UTF-8']
|
24
|
+
s.require_paths = ['lib']
|
25
|
+
s.summary = "Generate a Rails app using Firmhouse's best practices."
|
26
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
27
|
+
s.version = Startblock::VERSION
|
28
|
+
|
29
|
+
s.add_dependency 'bitters', '~> 0.10'
|
30
|
+
s.add_dependency 'bundler', '~> 1.3'
|
31
|
+
s.add_dependency 'rails', Startblock::RAILS_VERSION
|
32
|
+
s.add_dependency 'thor', '~> 0.19'
|
33
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem "rails", "<%= Startblock::RAILS_VERSION %>"
|
4
|
+
gem "pg"
|
5
|
+
gem 'turbolinks'
|
6
|
+
gem "bourbon", "~> 4.1.0"
|
7
|
+
gem "refills"
|
8
|
+
gem "neat", "~> 1.7.0"
|
9
|
+
gem "normalize-rails", "~> 3.0.0"
|
10
|
+
gem "coffee-rails", "~> 4.1.0"
|
11
|
+
gem "jquery-rails"
|
12
|
+
gem 'jquery-turbolinks'
|
13
|
+
gem "sass-rails", "~> 5.0"
|
14
|
+
gem "uglifier"
|
15
|
+
gem 'rollbar', '~> 1.0.0'
|
16
|
+
gem 'sidekiq', '~> 3.2.5'
|
17
|
+
gem "redis", '~> 3.1.0'
|
18
|
+
gem "redis-namespace", "~> 1.5.1"
|
19
|
+
gem "passenger"
|
20
|
+
|
21
|
+
group :development do
|
22
|
+
gem "spring"
|
23
|
+
gem "web-console"
|
24
|
+
gem "capistrano"
|
25
|
+
gem 'capistrano-rails'
|
26
|
+
gem 'capistrano-rails-console'
|
27
|
+
gem "daemon_controller"
|
28
|
+
end
|
29
|
+
|
30
|
+
group :development, :test do
|
31
|
+
gem "awesome_print"
|
32
|
+
gem "dotenv-rails"
|
33
|
+
end
|
34
|
+
|
35
|
+
group :test do
|
36
|
+
gem "minitest-rails-capybara"
|
37
|
+
gem "minitest-reporters"
|
38
|
+
gem 'timecop'
|
39
|
+
gem 'shoulda'
|
40
|
+
gem 'mocha'
|
41
|
+
end
|
42
|
+
|
43
|
+
group :staging, :production do
|
44
|
+
end
|
data/templates/Procfile
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
<% if ENV["MIXPANEL_TOKEN"] %>
|
2
|
+
<!-- start Mixpanel --><script type="text/javascript">(function(f,b){if(!b.__SV){var a,e,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");
|
3
|
+
for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=f.createElement("script");a.type="text/javascript";a.async=!0;a.src="//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";e=f.getElementsByTagName("script")[0];e.parentNode.insertBefore(a,e)}})(document,window.mixpanel||[]);
|
4
|
+
mixpanel.init("<%= ENV["MIXPANEL_TOKEN"] %>");</script><!-- end Mixpanel -->
|
5
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "gem install foreman --conservative"
|
14
|
+
system "bundle check || bundle install"
|
15
|
+
|
16
|
+
puts "\n== Preparing database =="
|
17
|
+
system "bin/rake db:setup"
|
18
|
+
|
19
|
+
puts "\n== Removing old logs and tempfiles =="
|
20
|
+
system "rm -f log/*"
|
21
|
+
system "rm -rf tmp/cache"
|
22
|
+
|
23
|
+
puts "\n== Making sure Foreman is running on port 3000 =="
|
24
|
+
system 'echo "port: 3000" > .foreman'
|
25
|
+
|
26
|
+
puts "\n== Copy the sample.env to .env =="
|
27
|
+
unless File.exist?(File.join(APP_ROOT, ".env"))
|
28
|
+
system "cp .sample.env .env"
|
29
|
+
end
|
30
|
+
|
31
|
+
puts "\n== Restarting application server =="
|
32
|
+
system "mkdir -p tmp"
|
33
|
+
system "touch tmp/restart.txt"
|
34
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative "production"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta name="ROBOTS" content="NOODP" />
|
6
|
+
<meta name="viewport" content="initial-scale=1" />
|
7
|
+
<title>appname</title>
|
8
|
+
<%%= stylesheet_link_tag :application, media: "all" %>
|
9
|
+
<%%= csrf_meta_tags %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<%%= render "flashes" -%>
|
13
|
+
<%%= yield %>
|
14
|
+
<%%= render "javascript" %>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
|
+
require File.expand_path('../../config/environment', __FILE__)
|
4
|
+
require 'rails/test_help'
|
5
|
+
require "capybara/rails"
|
6
|
+
require "active_support/testing/setup_and_teardown"
|
7
|
+
require "sidekiq/testing"
|
8
|
+
require 'minitest/mock'
|
9
|
+
require "mocha/mini_test"
|
10
|
+
require "minitest/rails/capybara"
|
11
|
+
require "minitest/reporters"
|
12
|
+
|
13
|
+
Sidekiq::Testing.fake!
|
14
|
+
Minitest::Reporters.use! Minitest::Reporters::ProgressReporter.new
|
15
|
+
|
16
|
+
class ActiveSupport::TestCase
|
17
|
+
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
18
|
+
fixtures :all
|
19
|
+
end
|
20
|
+
|
21
|
+
class ActionDispatch::IntegrationTest
|
22
|
+
include Capybara::DSL
|
23
|
+
teardown do
|
24
|
+
Capybara.reset_sessions!
|
25
|
+
Capybara.use_default_driver
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: startblock
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeroen van Baarsen
|
8
|
+
- Firmhouse
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-02-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bitters
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0.10'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0.10'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.3'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.3'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rails
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 4.2.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 4.2.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: thor
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.19'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.19'
|
70
|
+
description: |
|
71
|
+
Startblock is a base Rails project. It is used by Firmhouse to get a jump
|
72
|
+
start on a working app.
|
73
|
+
email: hello@firmhouse.com
|
74
|
+
executables:
|
75
|
+
- startblock
|
76
|
+
extensions: []
|
77
|
+
extra_rdoc_files:
|
78
|
+
- README.md
|
79
|
+
- LICENSE
|
80
|
+
files:
|
81
|
+
- ".gitignore"
|
82
|
+
- ".ruby-version"
|
83
|
+
- ".travis.yml"
|
84
|
+
- Gemfile
|
85
|
+
- Gemfile.lock
|
86
|
+
- LICENSE
|
87
|
+
- NEWS.md
|
88
|
+
- README.md
|
89
|
+
- bin/rake
|
90
|
+
- bin/setup
|
91
|
+
- bin/startblock
|
92
|
+
- lib/startblock.rb
|
93
|
+
- lib/startblock/actions.rb
|
94
|
+
- lib/startblock/app_builder.rb
|
95
|
+
- lib/startblock/generators/app_generator.rb
|
96
|
+
- lib/startblock/version.rb
|
97
|
+
- startblock.gemspec
|
98
|
+
- templates/Gemfile.erb
|
99
|
+
- templates/Procfile
|
100
|
+
- templates/README.md.erb
|
101
|
+
- templates/_flashes.html.erb
|
102
|
+
- templates/_javascript.html.erb
|
103
|
+
- templates/_mixpanel.html.erb
|
104
|
+
- templates/application.css.scss
|
105
|
+
- templates/bin_setup.erb
|
106
|
+
- templates/postgresql_database.yml.erb
|
107
|
+
- templates/sample.env
|
108
|
+
- templates/secrets.yml
|
109
|
+
- templates/staging.rb
|
110
|
+
- templates/startblock_gitignore
|
111
|
+
- templates/startblock_layout.html.erb.erb
|
112
|
+
- templates/test_helper.erb
|
113
|
+
homepage: http://github.com/firmhouse/startblock
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options:
|
119
|
+
- "--charset=UTF-8"
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 2.1.5
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.2.2
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Generate a Rails app using Firmhouse's best practices.
|
138
|
+
test_files: []
|