trireme 0.0.1
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 +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/trireme +12 -0
- data/lib/trireme/actions.rb +20 -0
- data/lib/trireme/app_builder.rb +207 -0
- data/lib/trireme/generators/app_generator.rb +177 -0
- data/lib/trireme/templates/.rspec +1 -0
- data/lib/trireme/templates/Capfile +4 -0
- data/lib/trireme/templates/Guardfile +32 -0
- data/lib/trireme/templates/README.md.erb +6 -0
- data/lib/trireme/templates/additional_gems +37 -0
- data/lib/trireme/templates/app/assets/stylesheets/_bootstrap_and_overrides.scss +818 -0
- data/lib/trireme/templates/app/assets/stylesheets/application.css.scss +3 -0
- data/lib/trireme/templates/app/helpers/utility_helper.rb +32 -0
- data/lib/trireme/templates/app/views/layouts/application.html.erb +34 -0
- data/lib/trireme/templates/app/views/shared/_admin_actions.html.erb +3 -0
- data/lib/trireme/templates/app/views/shared/_flashes.html.erb +12 -0
- data/lib/trireme/templates/app/views/shared/_form_errors.html.erb +9 -0
- data/lib/trireme/templates/config/deploy/production.rb +17 -0
- data/lib/trireme/templates/config/deploy/staging.rb +8 -0
- data/lib/trireme/templates/config/deploy.rb.erb +41 -0
- data/lib/trireme/templates/config/environments/development.rb +45 -0
- data/lib/trireme/templates/config/environments/production.rb +70 -0
- data/lib/trireme/templates/config/environments/staging.rb +68 -0
- data/lib/trireme/templates/config/environments/test.rb +37 -0
- data/lib/trireme/templates/config/initializers/better_errors.rb +1 -0
- data/lib/trireme/templates/config/initializers/jazz_hands.rb +4 -0
- data/lib/trireme/templates/config/recipes/base.rb +8 -0
- data/lib/trireme/templates/config/recipes/check.rb +14 -0
- data/lib/trireme/templates/config/recipes/log.rb +6 -0
- data/lib/trireme/templates/config/recipes/logrotate.rb +8 -0
- data/lib/trireme/templates/config/recipes/nginx.rb +17 -0
- data/lib/trireme/templates/config/recipes/postgresql.rb +32 -0
- data/lib/trireme/templates/config/recipes/scripts/sql_functions.sql +23 -0
- data/lib/trireme/templates/config/recipes/templates/logrotate.erb +9 -0
- data/lib/trireme/templates/config/recipes/templates/nginx_unicorn.erb +69 -0
- data/lib/trireme/templates/config/recipes/templates/postgresql.yml.erb +8 -0
- data/lib/trireme/templates/config/recipes/templates/unicorn.rb.erb +14 -0
- data/lib/trireme/templates/config/recipes/templates/unicorn_init.erb +84 -0
- data/lib/trireme/templates/config/recipes/unicorn.rb +26 -0
- data/lib/trireme/templates/gitignore_additions +2 -0
- data/lib/trireme/templates/lib/templates/erb/scaffold/_form.html.erb +16 -0
- data/lib/trireme/templates/lib/templates/erb/scaffold/edit.html.erb +6 -0
- data/lib/trireme/templates/lib/templates/erb/scaffold/index.html.erb +27 -0
- data/lib/trireme/templates/lib/templates/erb/scaffold/new.html.erb +5 -0
- data/lib/trireme/templates/lib/templates/erb/scaffold/show.html.erb +10 -0
- data/lib/trireme/templates/spec/spec_helper.rb +60 -0
- data/lib/trireme/version.rb +3 -0
- data/lib/trireme.rb +48 -0
- data/trireme.gemspec +23 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d9a8e50b134b60477af20a52ac807788e28701d1
|
4
|
+
data.tar.gz: 7c073f1152a8c2c4d66f27919d602256f045f4ba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b26baa4e8e6d349eccf0482d7b67d30599f039ea27c1a5acb1118bd048c3c80c23c6fc13d064c58e6b2c4d76c4c79f91ecd3714b6b0ad022e8e6159c88be3acf
|
7
|
+
data.tar.gz: 277fb0c6aefcff4e2eeb8a6aa25d78f9fbab19a64d7483bae6bef856d0e37952453452275185326dc0684b8db4d59c8b4f75d43237251c629950ba2aec8461e1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Nathan Sharpe
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Trireme
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'trireme'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install trireme
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/trireme
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.expand_path(File.join('..', 'lib', 'trireme', 'generators', 'app_generator'), File.dirname(__FILE__))
|
4
|
+
require File.expand_path(File.join('..', 'lib', 'trireme', 'actions'), File.dirname(__FILE__))
|
5
|
+
require File.expand_path(File.join('..', 'lib', 'trireme', 'app_builder'), File.dirname(__FILE__))
|
6
|
+
require File.expand_path(File.join('..', 'lib', 'trireme'), File.dirname(__FILE__))
|
7
|
+
|
8
|
+
templates_root = File.expand_path(File.join('..', 'lib', 'trireme', 'templates'), File.dirname(__FILE__))
|
9
|
+
Trireme::AppGenerator.source_root templates_root
|
10
|
+
Trireme::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
|
11
|
+
|
12
|
+
Trireme::AppGenerator.start
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Trireme
|
2
|
+
module Actions
|
3
|
+
def configure_environment(rails_env, config)
|
4
|
+
inject_into_file(
|
5
|
+
"config/environments/#{rails_env}.rb",
|
6
|
+
"\n\n #{config}",
|
7
|
+
before: "\nend"
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
def replace_in_file(relative_path, find, replace)
|
12
|
+
path = File.join(destination_root, relative_path)
|
13
|
+
contents = IO.read(path)
|
14
|
+
unless contents.gsub!(find, replace)
|
15
|
+
raise "#{find.inspect} not found in #{relative_path}"
|
16
|
+
end
|
17
|
+
File.open(path, "w") { |file| file.write(contents) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,207 @@
|
|
1
|
+
module Trireme
|
2
|
+
class AppBuilder < Rails::AppBuilder
|
3
|
+
attr_accessor :domain_base, :server_ip
|
4
|
+
|
5
|
+
include Trireme::Actions
|
6
|
+
|
7
|
+
def add_additional_gems
|
8
|
+
if yes? "Add carrierwave for file uploading?"
|
9
|
+
@generator.gem 'carrierwave'
|
10
|
+
@generator.gem 'mini_magick'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_bootstrap_and_overrides
|
15
|
+
copy_file "app/assets/stylesheets/_bootstrap_and_overrides.scss"
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_custom_gems
|
19
|
+
gems_path = find_in_source_paths 'additional_gems'
|
20
|
+
new_gems = File.open(gems_path).read
|
21
|
+
append_file 'Gemfile', "\n#{new_gems}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_to_gitignore
|
25
|
+
gitignore_file = find_in_source_paths('gitignore_additions')
|
26
|
+
gitignore = File.open(gitignore_file).read
|
27
|
+
append_file '.gitignore', gitignore
|
28
|
+
end
|
29
|
+
|
30
|
+
def configure_generators
|
31
|
+
generators_config = <<-RUBY.gsub(/^ {2}/, '')
|
32
|
+
config.generators do |generate|
|
33
|
+
generate.helper false
|
34
|
+
generate.assets false
|
35
|
+
generate.view_specs false
|
36
|
+
generate.stylesheets false
|
37
|
+
generate.javascripts false
|
38
|
+
end\n
|
39
|
+
RUBY
|
40
|
+
inject_into_class 'config/application.rb', 'Application', generators_config
|
41
|
+
end
|
42
|
+
|
43
|
+
def configure_rspec
|
44
|
+
generate 'rspec:install'
|
45
|
+
run 'rm test/ -Rf'
|
46
|
+
end
|
47
|
+
|
48
|
+
def copy_utility_helper
|
49
|
+
copy_file "app/helpers/utility_helper.rb", force: true
|
50
|
+
end
|
51
|
+
|
52
|
+
def copy_application_layout
|
53
|
+
copy_file "app/views/layouts/application.html.erb", force: true
|
54
|
+
end
|
55
|
+
|
56
|
+
def copy_bootstrap_scaffold_templates
|
57
|
+
directory 'lib/templates/erb/scaffold'
|
58
|
+
end
|
59
|
+
|
60
|
+
def create_flashes_partial
|
61
|
+
copy_file "app/views/shared/_flashes.html.erb"
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_admin_actions_partial
|
65
|
+
copy_file "app/views/shared/_admin_actions.html.erb"
|
66
|
+
end
|
67
|
+
|
68
|
+
def create_form_errors_partial
|
69
|
+
copy_file "app/views/shared/_form_errors.html.erb"
|
70
|
+
end
|
71
|
+
|
72
|
+
def create_shared_views_directory
|
73
|
+
empty_directory 'app/views/shared'
|
74
|
+
end
|
75
|
+
|
76
|
+
def generate_home_controller
|
77
|
+
generate :controller, "home index"
|
78
|
+
route "root to: 'home\#index'"
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_server_options
|
82
|
+
@domain_base ||= ask("Domain:")
|
83
|
+
if !@domain_base.blank? && config_settings.has_key?(:chef) && yes?("Get IP from Chef (#{config_settings[:chef][:url]})?")
|
84
|
+
require 'open-uri'
|
85
|
+
begin
|
86
|
+
@server_ip = open("#{config_settings[:chef][:url]}#{@domain_base}").base_uri.to_s.match(/http:\/\/([\d\.]+)/)[1]
|
87
|
+
puts "Setting server ip to #{@server_ip}"
|
88
|
+
rescue
|
89
|
+
puts "Failed to get ip"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
@domain_base = "example.com" if @domain_base.blank?
|
93
|
+
@server_ip ||= ask("Server IP (if you have one):")
|
94
|
+
end
|
95
|
+
|
96
|
+
def initialize_git
|
97
|
+
git :init
|
98
|
+
git add: "."
|
99
|
+
git commit: "-m 'Inital commit'"
|
100
|
+
end
|
101
|
+
|
102
|
+
# Overrides generation of rails readme file
|
103
|
+
def readme
|
104
|
+
template "README.md.erb", "README.md"
|
105
|
+
end
|
106
|
+
|
107
|
+
def remove_routes_comment_lines
|
108
|
+
replace_in_file 'config/routes.rb', /Application\.routes\.draw do.*end/m, "Application.routes.draw do\nend"
|
109
|
+
end
|
110
|
+
|
111
|
+
def remove_sqlite_gem
|
112
|
+
gsub_file 'Gemfile', /^\s*gem .sqlite3.+$/, ''
|
113
|
+
end
|
114
|
+
|
115
|
+
def replace_application_css
|
116
|
+
remove_file 'app/assets/stylesheets/application.css'
|
117
|
+
copy_file 'app/assets/stylesheets/application.css.scss'
|
118
|
+
end
|
119
|
+
|
120
|
+
def set_sublime_text_as_editor
|
121
|
+
copy_file "config/initializers/better_errors.rb"
|
122
|
+
end
|
123
|
+
|
124
|
+
def setup_smtp
|
125
|
+
configure_environment "production",
|
126
|
+
"config.action_mailer_delivery_method = :smtp\n\tconfig.action_mailer.smtp_settings = #{format_config(config_settings[:action_mailer][:smtp_settings])}"
|
127
|
+
end
|
128
|
+
|
129
|
+
def setup_capistrano
|
130
|
+
if @domain_base && @server_ip
|
131
|
+
opts = { domain_base: @domain_base, server_ip: @server_ip, force: true }
|
132
|
+
else
|
133
|
+
opts[:domain_base] = ask("Domain:")
|
134
|
+
opts[:server_ip] = ask("Server IP:")
|
135
|
+
opts[:force] = true
|
136
|
+
end
|
137
|
+
template "config/deploy.rb.erb", "config/deploy.rb", opts
|
138
|
+
directory "config/deploy"
|
139
|
+
copy_file "Capfile", "Capfile"
|
140
|
+
directory "config/recipes"
|
141
|
+
end
|
142
|
+
|
143
|
+
def setup_console
|
144
|
+
copy_file "config/initializers/jazz_hands.rb"
|
145
|
+
end
|
146
|
+
|
147
|
+
def setup_devise
|
148
|
+
if config_settings[:devise][:include] || yes?("Add Devise?")
|
149
|
+
devise_model = ask("Devise model (default: #{config_settings[:devise][:model]}):").underscore
|
150
|
+
devise_model = config_settings[:devise][:model] if devise_model.blank?
|
151
|
+
@generator.gem 'devise'
|
152
|
+
run 'bundle install'
|
153
|
+
generate 'devise:install'
|
154
|
+
generate "devise #{devise_model}"
|
155
|
+
generate "devise:views"
|
156
|
+
bundle_command 'exec rake db:migrate'
|
157
|
+
if config_settings[:devise][:seed] || yes?("Seed database with #{devise_model}@example.com?")
|
158
|
+
append_file 'db/seeds.rb', "devise_user = #{devise_model.titleize}.create email: '#{devise_model}@example.com', password: 'password'"
|
159
|
+
bundle_command 'exec rake db:seed'
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def setup_exception_notification
|
165
|
+
en_config = "config.middleware.insert_before Warden::Manager, ExceptionNotification::Rack,\n"
|
166
|
+
if config_settings[:exception_notification][:email]
|
167
|
+
config_settings[:exception_notification][:email][:email_prefix] = "[#{app_name.titleize} Exception]"
|
168
|
+
en_config << "\t\t:email => #{format_config(config_settings[:exception_notification][:email], 2)}"
|
169
|
+
end
|
170
|
+
if config_settings[:exception_notification][:irc]
|
171
|
+
config_settings[:exception_notification][:irc][:prefix] = "[#{app_name.titleize} Production]"
|
172
|
+
en_config << ",\n\t\t" if en_config[/}\Z/]
|
173
|
+
en_config << ":irc => #{format_config(config_settings[:exception_notification][:irc], 2)}"
|
174
|
+
end
|
175
|
+
configure_environment "production", en_config
|
176
|
+
end
|
177
|
+
|
178
|
+
def setup_guard
|
179
|
+
copy_file "Guardfile"
|
180
|
+
end
|
181
|
+
|
182
|
+
def setup_mailcatcher
|
183
|
+
configure_environment "development",
|
184
|
+
"config.action_mailer.delivery_method = :smtp\n config.action_mailer.smtp_settings = { :address => \"localhost\", :port => 1025 }"
|
185
|
+
end
|
186
|
+
|
187
|
+
def setup_quiet_assets
|
188
|
+
configure_environment "development",
|
189
|
+
"config.quiet_assets = true"
|
190
|
+
end
|
191
|
+
|
192
|
+
def setup_staging_environment
|
193
|
+
run 'cp config/environments/production.rb config/environments/staging.rb'
|
194
|
+
end
|
195
|
+
|
196
|
+
# ----------
|
197
|
+
|
198
|
+
def config_settings
|
199
|
+
@config ||= Trireme::config
|
200
|
+
end
|
201
|
+
|
202
|
+
def format_config(yml, num_tabs = 1)
|
203
|
+
tabs = "\t" * (num_tabs + 1)
|
204
|
+
yml.to_s.gsub(/\A{/, "{\n#{tabs}").gsub(/, :/, ",\n#{tabs}:").gsub(/}\Z/, "\n#{"\t" * num_tabs}}").gsub("=>", " => ")
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/rails/app/app_generator'
|
3
|
+
|
4
|
+
module Trireme
|
5
|
+
class AppGenerator < Rails::Generators::AppGenerator
|
6
|
+
class_option :database, type: :string, aliases: '-d', default: 'sqlite3', desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
|
7
|
+
class_option :config_file, type: :string, aliases: '-c', desc: "Include yaml configuration file"
|
8
|
+
|
9
|
+
def finish_template
|
10
|
+
invoke :trireme_customization
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def trireme_customization
|
15
|
+
if options[:config_file]
|
16
|
+
say "Loading yaml configuration from #{options[:config_file]}"
|
17
|
+
Trireme::configure_with(options[:config_file])
|
18
|
+
end
|
19
|
+
invoke :configure_generators
|
20
|
+
invoke :add_gems
|
21
|
+
invoke :remove_routes_comment_lines
|
22
|
+
invoke :add_home_controller
|
23
|
+
invoke :setup_staging_environment
|
24
|
+
if config[:action_mailer] && config[:action_mailer][:smtp_settings]
|
25
|
+
invoke :configure_smtp
|
26
|
+
end
|
27
|
+
invoke :setup_console
|
28
|
+
invoke :setup_stylesheets
|
29
|
+
invoke :setup_gems
|
30
|
+
invoke :create_views_and_layouts
|
31
|
+
invoke :setup_deployment
|
32
|
+
invoke :setup_git
|
33
|
+
end
|
34
|
+
|
35
|
+
def configure_generators
|
36
|
+
say 'Configuring generators'
|
37
|
+
|
38
|
+
# Add generator configuration to config/application.rb
|
39
|
+
build :configure_generators
|
40
|
+
end
|
41
|
+
|
42
|
+
def add_gems
|
43
|
+
say 'Adding gems and installing'
|
44
|
+
|
45
|
+
# Remove sqlite gem from Gemfile (we'll add it back under development group)
|
46
|
+
build :remove_sqlite_gem
|
47
|
+
|
48
|
+
# Append 'templates/additional_gems' to Gemfile
|
49
|
+
build :add_custom_gems
|
50
|
+
|
51
|
+
# Confirm other gems before adding (e.g., Carrierwave)
|
52
|
+
build :add_additional_gems
|
53
|
+
|
54
|
+
bundle_command 'install'
|
55
|
+
end
|
56
|
+
|
57
|
+
def remove_routes_comment_lines
|
58
|
+
# Remove commented lines from config/routes.rb
|
59
|
+
# build :remove_routes_comment_lines
|
60
|
+
end
|
61
|
+
|
62
|
+
def add_home_controller
|
63
|
+
say 'Creating home controller with index'
|
64
|
+
|
65
|
+
build :generate_home_controller
|
66
|
+
end
|
67
|
+
|
68
|
+
def setup_staging_environment
|
69
|
+
say 'Setting up the staging environment'
|
70
|
+
|
71
|
+
# Create config/environments/staging.rb based on production.rb
|
72
|
+
build :setup_staging_environment
|
73
|
+
end
|
74
|
+
|
75
|
+
def configure_smtp
|
76
|
+
say 'Configuring action mailer for production'
|
77
|
+
|
78
|
+
build :setup_smtp
|
79
|
+
end
|
80
|
+
|
81
|
+
def setup_console
|
82
|
+
say 'Configuring console (config/initializers/jazz_hands.rb)'
|
83
|
+
|
84
|
+
# Add jazz_hands configuration in config/initializers/jazz_hands.rb
|
85
|
+
build :setup_console
|
86
|
+
end
|
87
|
+
|
88
|
+
def setup_stylesheets
|
89
|
+
say 'Setting up stylesheets'
|
90
|
+
|
91
|
+
# Add boostrap_and_overrides to app/assets/stylesheets; it contains bootstrap variables and imports bootstrap
|
92
|
+
build :add_bootstrap_and_overrides
|
93
|
+
|
94
|
+
# Replaces application.css with application.css.scss that imports compass, bootstrap, font-awesome
|
95
|
+
build :replace_application_css
|
96
|
+
|
97
|
+
# build :add_foundation_scaffold_templates
|
98
|
+
end
|
99
|
+
|
100
|
+
def setup_gems
|
101
|
+
say 'Setting up gems...'
|
102
|
+
# Add quiet assets config to development (makes it easy to turn off)
|
103
|
+
build :setup_quiet_assets
|
104
|
+
|
105
|
+
# Add mailcatcher configuration for development
|
106
|
+
build :setup_mailcatcher
|
107
|
+
|
108
|
+
# Sets sublime text as editor for better_errors
|
109
|
+
build :set_sublime_text_as_editor
|
110
|
+
|
111
|
+
# Set up devise in accordance with preferences
|
112
|
+
build :setup_devise
|
113
|
+
|
114
|
+
# Setup rspec (rspec:install)
|
115
|
+
build :setup_rspec
|
116
|
+
|
117
|
+
# Setup guard by copying Guardfile
|
118
|
+
build :setup_guard
|
119
|
+
|
120
|
+
# Add configuration for exception notification if it is specified
|
121
|
+
if config.has_key? :exception_notification
|
122
|
+
build :setup_exception_notification
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def create_views_and_layouts
|
127
|
+
say 'Creating partials and adding layouts'
|
128
|
+
|
129
|
+
# Create app/views/shared directory
|
130
|
+
build :create_shared_views_directory
|
131
|
+
|
132
|
+
# Copy partials to app/views/shared
|
133
|
+
build :create_flashes_partial
|
134
|
+
build :create_form_errors_partial
|
135
|
+
build :create_admin_actions_partial
|
136
|
+
|
137
|
+
# Add title, icon, placeholder helpers
|
138
|
+
build :copy_utility_helper
|
139
|
+
|
140
|
+
build :copy_application_layout
|
141
|
+
|
142
|
+
build :copy_bootstrap_scaffold_templates
|
143
|
+
end
|
144
|
+
|
145
|
+
def setup_deployment
|
146
|
+
# Get domain and server ip from input
|
147
|
+
build :get_server_options
|
148
|
+
|
149
|
+
# Add deploy configuration and recipes
|
150
|
+
build :setup_capistrano
|
151
|
+
end
|
152
|
+
|
153
|
+
def setup_git
|
154
|
+
say 'Setting up .gitignore and git repo'
|
155
|
+
|
156
|
+
# Add gitignore_additions to .gitignore
|
157
|
+
build :add_to_gitignore
|
158
|
+
|
159
|
+
# Initialize git repository and create first commit
|
160
|
+
build :initialize_git
|
161
|
+
end
|
162
|
+
|
163
|
+
def outro
|
164
|
+
say "Ready to set sail (and probably catch on fire, sink, and kill everyone on board)! Run 'cap deploy:setup' to finish preparing the server for deployment."
|
165
|
+
end
|
166
|
+
|
167
|
+
protected
|
168
|
+
|
169
|
+
def get_builder_class
|
170
|
+
Trireme::AppBuilder
|
171
|
+
end
|
172
|
+
|
173
|
+
def config
|
174
|
+
@config ||= Trireme::config
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'livereload' do
|
5
|
+
watch(%r{app/views/.+\.(erb|haml|slim)$})
|
6
|
+
watch(%r{app/helpers/.+\.rb})
|
7
|
+
watch(%r{public/.+\.(css|js|html)})
|
8
|
+
watch(%r{config/locales/.+\.yml})
|
9
|
+
# Rails Assets Pipeline
|
10
|
+
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
|
11
|
+
end
|
12
|
+
|
13
|
+
guard :rspec, cmd: 'spring rspec' do
|
14
|
+
watch(%r{^spec/.+_spec\.rb$})
|
15
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
16
|
+
watch('spec/spec_helper.rb') { "spec" }
|
17
|
+
|
18
|
+
# Rails example
|
19
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
20
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
21
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
22
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
23
|
+
watch('config/routes.rb') { "spec/routing" }
|
24
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
25
|
+
|
26
|
+
# Capybara features specs
|
27
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
28
|
+
|
29
|
+
# Turnip features and steps
|
30
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
31
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
32
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
gem "pg"
|
2
|
+
gem "carrier-pigeon"
|
3
|
+
gem "exception_notification", :git => 'https://github.com/cliftonlabs/exception_notification.git', branch: 'irc-notifier'
|
4
|
+
gem "compass-rails"
|
5
|
+
gem "bootstrap-sass"
|
6
|
+
gem "font-awesome-rails"
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem "annotate"
|
10
|
+
gem "better_errors"
|
11
|
+
gem "binding_of_caller"
|
12
|
+
gem "quiet_assets"
|
13
|
+
gem "mailcatcher"
|
14
|
+
gem "guard"
|
15
|
+
gem "guard-rspec", require: false
|
16
|
+
gem "guard-livereload", require: false
|
17
|
+
end
|
18
|
+
|
19
|
+
group :development, :test do
|
20
|
+
gem "sqlite3"
|
21
|
+
gem "rspec-rails", "~> 3.0.0.beta"
|
22
|
+
gem "factory_girl_rails"
|
23
|
+
gem "jazz_hands"
|
24
|
+
end
|
25
|
+
|
26
|
+
group :test do
|
27
|
+
gem "database_cleaner"
|
28
|
+
gem "shoulda-matchers"
|
29
|
+
gem "capybara"
|
30
|
+
gem "poltergeist", "~> 1.5.0"
|
31
|
+
gem "vcr"
|
32
|
+
gem "webmock", "~> 1.8.0"
|
33
|
+
gem "simplecov", require: false
|
34
|
+
end
|
35
|
+
|
36
|
+
gem 'unicorn'
|
37
|
+
gem 'capistrano', '2.15.5'
|