armadura 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/Gemfile +3 -0
- data/LICENSE +19 -0
- data/README.md +218 -0
- data/Rakefile +8 -0
- data/USAGE +9 -0
- data/armadura.gemspec +29 -0
- data/bin/armadura +23 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +13 -0
- data/lib/armadura.rb +7 -0
- data/lib/armadura/actions.rb +33 -0
- data/lib/armadura/adapters/heroku.rb +118 -0
- data/lib/armadura/app_builder.rb +484 -0
- data/lib/armadura/generators/app_generator.rb +245 -0
- data/lib/armadura/generators/static_generator.rb +10 -0
- data/lib/armadura/generators/stylesheet_base_generator.rb +37 -0
- data/lib/armadura/version.rb +8 -0
- data/spec/adapters/heroku_spec.rb +57 -0
- data/spec/fakes/bin/heroku +5 -0
- data/spec/fakes/bin/hub +5 -0
- data/spec/features/cli_help_spec.rb +36 -0
- data/spec/features/github_spec.rb +16 -0
- data/spec/features/heroku_spec.rb +75 -0
- data/spec/features/new_project_spec.rb +295 -0
- data/spec/features/sidekiq_spec.rb +30 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/support/armadura.rb +83 -0
- data/spec/support/fake_github.rb +21 -0
- data/spec/support/fake_heroku.rb +53 -0
- data/templates/Gemfile.erb +60 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +28 -0
- data/templates/_analytics.html.erb +7 -0
- data/templates/_css_overrides.html.erb +7 -0
- data/templates/_flashes.html.erb +7 -0
- data/templates/_javascript.html.erb +12 -0
- data/templates/action_mailer.rb +5 -0
- data/templates/app.json.erb +39 -0
- data/templates/application.scss +9 -0
- data/templates/armadura_gitignore +14 -0
- data/templates/armadura_layout.html.erb.erb +22 -0
- data/templates/bin_deploy +12 -0
- data/templates/bin_setup +22 -0
- data/templates/bin_setup_review_app.erb +19 -0
- data/templates/browserslist +3 -0
- data/templates/bundler_audit.rake +12 -0
- data/templates/capybara_webkit.rb +5 -0
- data/templates/circle.yml.erb +6 -0
- data/templates/config_locales_en.yml.erb +19 -0
- data/templates/database_cleaner_rspec.rb +21 -0
- data/templates/dev.rake +12 -0
- data/templates/dotfiles/.ctags +2 -0
- data/templates/dotfiles/.env +14 -0
- data/templates/errors.rb +34 -0
- data/templates/factories.rb +2 -0
- data/templates/factory_girl_rspec.rb +3 -0
- data/templates/flashes_helper.rb +5 -0
- data/templates/hound.yml +14 -0
- data/templates/i18n.rb +3 -0
- data/templates/json_encoding.rb +1 -0
- data/templates/postgresql_database.yml.erb +21 -0
- data/templates/puma.rb +28 -0
- data/templates/rack_mini_profiler.rb +5 -0
- data/templates/rails_helper.rb +22 -0
- data/templates/secrets.yml +14 -0
- data/templates/shoulda_matchers_config_rspec.rb +6 -0
- data/templates/sidekiq.yml +6 -0
- data/templates/smtp.rb +13 -0
- data/templates/spec_helper.rb +29 -0
- metadata +188 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 36b26941170980cabf20c58b602706e6d4c78f68
|
4
|
+
data.tar.gz: c54079e4c2e3c51d0bfb1fa4da0d4e6cb0ed7e9b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ddcb0b5185a19ac82b5f3cf60848f2d4f89d98b0d519fb10e664e65e01de781f158ce1e1ef15d2e91040ab0d70882e83544b719e7db4bbdd81e4f99009bcbafa
|
7
|
+
data.tar.gz: 9b6c5cf924ea45ba115b4c3ae0b4f8ab0eacbc63b3e343dc9266439ff8d1b935ac94eb08bc8c5b6dbaaf872ac5f6f75170f37454344645d9a90e01b1f68c2f25
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm: 2.3.1
|
3
|
+
cache: bundler
|
4
|
+
sudo: false
|
5
|
+
before_install:
|
6
|
+
- "echo '--colour' > ~/.rspec"
|
7
|
+
- git config --global user.name 'Travis CI'
|
8
|
+
- git config --global user.email 'travis-ci@example.com'
|
9
|
+
install: bundle install
|
10
|
+
notifications:
|
11
|
+
email: false
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
# Armadura [![Build Status](https://secure.travis-ci.org/mcmire/armadura.svg?branch=master)](http://travis-ci.org/mcmire/armadura)
|
2
|
+
|
3
|
+
Armadura is a gem that lets you generate a Rails application, preconfigured with
|
4
|
+
sensible defaults.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
First install the armadura gem:
|
9
|
+
|
10
|
+
gem install armadura
|
11
|
+
|
12
|
+
Then run:
|
13
|
+
|
14
|
+
armadura projectname
|
15
|
+
|
16
|
+
This will create a Rails app in `projectname` using the latest version of Rails.
|
17
|
+
|
18
|
+
### Associated services
|
19
|
+
|
20
|
+
* Enable [Circle CI](https://circleci.com/) Continuous Integration
|
21
|
+
* Enable [GitHub auto deploys to Heroku staging and review
|
22
|
+
apps](https://dashboard.heroku.com/apps/app-name-staging/deploy/github).
|
23
|
+
|
24
|
+
## Gemfile
|
25
|
+
|
26
|
+
To see the latest and greatest gems, look at Armadura's
|
27
|
+
[Gemfile](templates/Gemfile.erb), which will be appended to the default
|
28
|
+
generated projectname/Gemfile.
|
29
|
+
|
30
|
+
It includes application gems like:
|
31
|
+
|
32
|
+
* [Autoprefixer Rails](https://github.com/ai/autoprefixer-rails) for CSS vendor prefixes
|
33
|
+
* [Bourbon](https://github.com/thoughtbot/bourbon) for Sass mixins
|
34
|
+
* [Bitters](https://github.com/thoughtbot/bitters) for scaffold application styles
|
35
|
+
* [Sidekiq](https://github.com/mperham/sidekiq) for background
|
36
|
+
processing
|
37
|
+
* [Flutie](https://github.com/thoughtbot/flutie) for `page_title` and `body_class` view
|
38
|
+
helpers
|
39
|
+
* [High Voltage](https://github.com/thoughtbot/high_voltage) for static pages
|
40
|
+
* [jQuery Rails](https://github.com/rails/jquery-rails) for jQuery
|
41
|
+
* [Neat](https://github.com/thoughtbot/neat) for semantic grids
|
42
|
+
* [Normalize](https://necolas.github.io/normalize.css/) for resetting browser styles
|
43
|
+
* [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database
|
44
|
+
* [Rack Canonical Host](https://github.com/tylerhunt/rack-canonical-host) to
|
45
|
+
ensure all requests are served from the same domain
|
46
|
+
* [Rack Timeout](https://github.com/heroku/rack-timeout) to abort requests that are
|
47
|
+
taking too long
|
48
|
+
* [Recipient Interceptor](https://github.com/croaky/recipient_interceptor) to
|
49
|
+
avoid accidentally sending emails to real people from staging
|
50
|
+
* [Refills](https://github.com/thoughtbot/refills) for “copy-paste” components
|
51
|
+
and patterns based on Bourbon, Neat and Bitters
|
52
|
+
* [Sentry](https://sentry.io) for exception notification
|
53
|
+
* [Simple Form](https://github.com/plataformatec/simple_form) for form markup
|
54
|
+
and style
|
55
|
+
* [Skylight](https://www.skylight.io/) for monitoring performance
|
56
|
+
* [Title](https://github.com/calebthompson/title) for storing titles in
|
57
|
+
translations
|
58
|
+
* [Puma](https://github.com/puma/puma) to serve HTTP requests
|
59
|
+
|
60
|
+
And development gems like:
|
61
|
+
|
62
|
+
* [Dotenv](https://github.com/bkeepers/dotenv) for loading environment variables
|
63
|
+
* [Pry Rails](https://github.com/rweng/pry-rails) for interactively exploring
|
64
|
+
objects
|
65
|
+
* [ByeBug](https://github.com/deivid-rodriguez/byebug) for interactively
|
66
|
+
debugging behavior
|
67
|
+
* [Bullet](https://github.com/flyerhzm/bullet) for help to kill N+1 queries and
|
68
|
+
unused eager loading
|
69
|
+
* [Bundler Audit](https://github.com/rubysec/bundler-audit) for scanning the
|
70
|
+
Gemfile for insecure dependencies based on published CVEs
|
71
|
+
* [Spring](https://github.com/rails/spring) for fast Rails actions via
|
72
|
+
pre-loading
|
73
|
+
* [Web Console](https://github.com/rails/web-console) for better debugging via
|
74
|
+
in-browser IRB consoles.
|
75
|
+
|
76
|
+
And testing gems like:
|
77
|
+
|
78
|
+
* [Capybara](https://github.com/jnicklas/capybara) and
|
79
|
+
[Capybara WebKit](https://github.com/thoughtbot/capybara-webkit) for
|
80
|
+
integration testing
|
81
|
+
* [Factory Girl](https://github.com/thoughtbot/factory_girl) for test data
|
82
|
+
* [Formulaic](https://github.com/thoughtbot/formulaic) for integration testing
|
83
|
+
HTML forms
|
84
|
+
* [RSpec](https://github.com/rspec/rspec) for unit testing
|
85
|
+
* [RSpec Mocks](https://github.com/rspec/rspec-mocks) for stubbing and spying
|
86
|
+
* [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) for common
|
87
|
+
RSpec matchers
|
88
|
+
* [Timecop](https://github.com/ferndopolis/timecop-console) for testing time
|
89
|
+
|
90
|
+
## Other goodies
|
91
|
+
|
92
|
+
Armadura also comes with:
|
93
|
+
|
94
|
+
* The [`./bin/setup`][setup] convention for new developer setup
|
95
|
+
* The `./bin/deploy` convention for deploying to Heroku
|
96
|
+
* Rails' flashes set up and in application layout
|
97
|
+
* A few nice time formats set up for localization
|
98
|
+
* `Rack::Deflater` to [compress responses with Gzip][compress]
|
99
|
+
* A [low database connection pool limit][pool]
|
100
|
+
* [Safe binstubs][binstub]
|
101
|
+
* [t() and l() in specs without prefixing with I18n][i18n]
|
102
|
+
* An automatically-created `SECRET_KEY_BASE` environment variable in all
|
103
|
+
environments
|
104
|
+
* Configuration for [CircleCI][circle] Continuous Integration (tests)
|
105
|
+
* Configuration for [Hound][hound] Continuous Integration (style)
|
106
|
+
* The analytics adapter [Segment][segment] (and therefore config for Google
|
107
|
+
Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)
|
108
|
+
|
109
|
+
[setup]: https://robots.thoughtbot.com/bin-setup
|
110
|
+
[compress]: https://robots.thoughtbot.com/content-compression-with-rack-deflater
|
111
|
+
[pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
|
112
|
+
[binstub]: https://github.com/thoughtbot/suspenders/pull/282
|
113
|
+
[i18n]: https://github.com/thoughtbot/suspenders/pull/304
|
114
|
+
[circle]: https://circleci.com/docs
|
115
|
+
[hound]: https://houndci.com
|
116
|
+
[segment]: https://segment.com
|
117
|
+
|
118
|
+
## Heroku
|
119
|
+
|
120
|
+
You can optionally create Heroku staging and production apps:
|
121
|
+
|
122
|
+
armadura app --heroku true
|
123
|
+
|
124
|
+
This:
|
125
|
+
|
126
|
+
* Creates a staging and production Heroku app
|
127
|
+
* Sets them as `staging` and `production` Git remotes
|
128
|
+
* Configures staging with `RACK_ENV` environment variable set
|
129
|
+
to `staging`
|
130
|
+
* Adds the [Rails Stdout Logging][logging-gem] gem
|
131
|
+
to configure the app to log to standard out,
|
132
|
+
which is how [Heroku's logging][heroku-logging] works.
|
133
|
+
* Creates a [Heroku Pipeline] for review apps
|
134
|
+
|
135
|
+
[logging-gem]: https://github.com/heroku/rails_stdout_logging
|
136
|
+
[heroku-logging]: https://devcenter.heroku.com/articles/logging#writing-to-your-log
|
137
|
+
[Heroku Pipeline]: https://devcenter.heroku.com/articles/pipelines
|
138
|
+
|
139
|
+
You can optionally specify alternate Heroku flags:
|
140
|
+
|
141
|
+
armadura app \
|
142
|
+
--heroku true \
|
143
|
+
--heroku-flags "--region eu --addons sendgrid,ssl"
|
144
|
+
|
145
|
+
See all possible Heroku flags:
|
146
|
+
|
147
|
+
heroku help create
|
148
|
+
|
149
|
+
## Git
|
150
|
+
|
151
|
+
This will initialize a new git repository for your Rails app. You can
|
152
|
+
bypass this with the `--skip-git` option:
|
153
|
+
|
154
|
+
armadura app --skip-git true
|
155
|
+
|
156
|
+
## GitHub
|
157
|
+
|
158
|
+
You can optionally create a GitHub repository for the suspended Rails app. It
|
159
|
+
requires that you have [Hub](https://github.com/github/hub) on your system:
|
160
|
+
|
161
|
+
curl http://hub.github.com/standalone -sLo ~/bin/hub && chmod +x ~/bin/hub
|
162
|
+
armadura app --github organization/project
|
163
|
+
|
164
|
+
This has the same effect as running:
|
165
|
+
|
166
|
+
hub create organization/project
|
167
|
+
|
168
|
+
## Spring
|
169
|
+
|
170
|
+
Armadura uses [spring](https://github.com/rails/spring) by default.
|
171
|
+
It makes Rails applications load faster, but it might introduce confusing issues
|
172
|
+
around stale code not being refreshed.
|
173
|
+
If you think your application is running old code, run `spring stop`.
|
174
|
+
And if you'd rather not use spring, add `DISABLE_SPRING=1` to your login file.
|
175
|
+
|
176
|
+
## Dependencies
|
177
|
+
|
178
|
+
Armadura requires the latest version of Ruby.
|
179
|
+
|
180
|
+
Some gems included in Armadura have native extensions. You should have GCC
|
181
|
+
installed on your machine before generating an app with Armadura.
|
182
|
+
|
183
|
+
Use [OS X GCC Installer](https://github.com/kennethreitz/osx-gcc-installer/) for
|
184
|
+
Snow Leopard (OS X 10.6).
|
185
|
+
|
186
|
+
Use [Command Line Tools for Xcode](https://developer.apple.com/downloads/index.action)
|
187
|
+
for Lion (OS X 10.7) or Mountain Lion (OS X 10.8).
|
188
|
+
|
189
|
+
We use [Capybara WebKit](https://github.com/thoughtbot/capybara-webkit) for
|
190
|
+
full-stack JavaScript integration testing. It requires QT. Instructions for
|
191
|
+
installing QT are
|
192
|
+
[here](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
|
193
|
+
|
194
|
+
PostgreSQL needs to be installed and running for the `db:create` rake task.
|
195
|
+
|
196
|
+
## Issues
|
197
|
+
|
198
|
+
If you have problems, please create a
|
199
|
+
[GitHub Issue](https://github.com/mcmire/armadura/issues).
|
200
|
+
|
201
|
+
## Contributing
|
202
|
+
|
203
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
204
|
+
|
205
|
+
Thank you, [contributors]!
|
206
|
+
|
207
|
+
[contributors]: https://github.com/thoughtbot/armadura/graphs/contributors
|
208
|
+
|
209
|
+
## License
|
210
|
+
|
211
|
+
Armadura is copyright © 2016 Elliot Winkler.
|
212
|
+
It is adapted from [Suspenders], a [thoughtbot] project.
|
213
|
+
It is free software, and may be redistributed under the terms specified in the
|
214
|
+
[LICENSE] file.
|
215
|
+
|
216
|
+
[Suspenders]: https://github.com/thoughtbot/suspenders
|
217
|
+
[thoughtbot]: http://thoughtbot.com
|
218
|
+
[LICENSE]: LICENSE
|
data/Rakefile
ADDED
data/USAGE
ADDED
data/armadura.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'armadura/version'
|
4
|
+
require 'date'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.required_ruby_version = ">= #{Armadura::RUBY_VERSION}"
|
8
|
+
s.authors = ['Elliot Winkler <elliot.winkler@gmail.com>']
|
9
|
+
s.date = Date.today.strftime('%Y-%m-%d')
|
10
|
+
s.description = "Armadura generates Rails projects, preconfigured with sensible defaults."
|
11
|
+
s.summary = "Armadura generates Rails projects, preconfigured with sensible defaults."
|
12
|
+
s.email = 'elliot.winkler@gmail.com'
|
13
|
+
s.executables = ['armadura']
|
14
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.homepage = 'https://github.com/mcmire/armadura'
|
17
|
+
s.license = 'MIT'
|
18
|
+
s.name = 'armadura'
|
19
|
+
s.rdoc_options = ['--charset=UTF-8']
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.version = Armadura::VERSION
|
23
|
+
|
24
|
+
s.add_dependency 'bitters', '~> 1.3'
|
25
|
+
s.add_dependency 'bundler', '~> 1.3'
|
26
|
+
s.add_dependency 'rails', Armadura::RAILS_VERSION
|
27
|
+
|
28
|
+
s.add_development_dependency 'rspec', '~> 3.2'
|
29
|
+
end
|
data/bin/armadura
ADDED
@@ -0,0 +1,23 @@
|
|
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 'armadura'
|
8
|
+
|
9
|
+
if ARGV.empty?
|
10
|
+
puts "Please provide a path for the new application"
|
11
|
+
puts
|
12
|
+
puts "See --help for more info"
|
13
|
+
exit 0
|
14
|
+
elsif ['-v', '--version'].include? ARGV[0]
|
15
|
+
puts Armadura::VERSION
|
16
|
+
exit 0
|
17
|
+
end
|
18
|
+
|
19
|
+
templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
|
20
|
+
Armadura::AppGenerator.source_root templates_root
|
21
|
+
Armadura::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
|
22
|
+
|
23
|
+
Armadura::AppGenerator.start
|
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/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')
|
data/bin/setup
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/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/lib/armadura.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'armadura/version'
|
2
|
+
require 'armadura/generators/app_generator'
|
3
|
+
require 'armadura/generators/static_generator'
|
4
|
+
require 'armadura/generators/stylesheet_base_generator'
|
5
|
+
require 'armadura/actions'
|
6
|
+
require "armadura/adapters/heroku"
|
7
|
+
require 'armadura/app_builder'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Armadura
|
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_application_file(config)
|
18
|
+
inject_into_file(
|
19
|
+
"config/application.rb",
|
20
|
+
"\n\n #{config}",
|
21
|
+
before: "\n end"
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def configure_environment(rails_env, config)
|
26
|
+
inject_into_file(
|
27
|
+
"config/environments/#{rails_env}.rb",
|
28
|
+
"\n\n #{config}",
|
29
|
+
before: "\nend"
|
30
|
+
)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|