initiate 0.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.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +11 -0
  5. data/CONTRIBUTING.md +48 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +21 -0
  8. data/NEWS.md +444 -0
  9. data/README.md +129 -0
  10. data/Rakefile +8 -0
  11. data/bin/initiate +18 -0
  12. data/bin/rake +16 -0
  13. data/bin/rspec +16 -0
  14. data/bin/setup +13 -0
  15. data/lib/initiate.rb +6 -0
  16. data/lib/initiate/actions.rb +33 -0
  17. data/lib/initiate/app_builder.rb +341 -0
  18. data/lib/initiate/config.rb +9 -0
  19. data/lib/initiate/generators/app_generator.rb +174 -0
  20. data/lib/initiate/version.rb +5 -0
  21. data/spec/features/new_project_spec.rb +131 -0
  22. data/spec/spec_helper.rb +14 -0
  23. data/spec/support/initiate.rb +51 -0
  24. data/suspenders.gemspec +35 -0
  25. data/templates/Gemfile.erb +53 -0
  26. data/templates/Procfile +2 -0
  27. data/templates/README.md.erb +18 -0
  28. data/templates/_flashes.html.erb +7 -0
  29. data/templates/_javascript.html.erb +6 -0
  30. data/templates/action_mailer.rb +5 -0
  31. data/templates/annotate.rake +4 -0
  32. data/templates/application.html.slim.erb +10 -0
  33. data/templates/application.scss +1 -0
  34. data/templates/bin_setup.erb +32 -0
  35. data/templates/browserslist +4 -0
  36. data/templates/bugsnag.rb +5 -0
  37. data/templates/bundler_audit.rake +12 -0
  38. data/templates/capybara_webkit.rb +5 -0
  39. data/templates/config_i18n_tasks.yml +13 -0
  40. data/templates/config_locales_en.yml.erb +19 -0
  41. data/templates/database_cleaner_rspec.rb +21 -0
  42. data/templates/deploy.rb +95 -0
  43. data/templates/dev.rake +12 -0
  44. data/templates/disable_xml_params.rb +1 -0
  45. data/templates/errors.rb +34 -0
  46. data/templates/factories.rb +2 -0
  47. data/templates/factory_girl_rspec.rb +3 -0
  48. data/templates/flashes_helper.rb +5 -0
  49. data/templates/i18n.rb +3 -0
  50. data/templates/json_encoding.rb +1 -0
  51. data/templates/postgresql_database.yml.erb +23 -0
  52. data/templates/rails_helper.rb +22 -0
  53. data/templates/sample.env +9 -0
  54. data/templates/secrets.yml +15 -0
  55. data/templates/shoulda_matchers_config_rspec.rb +6 -0
  56. data/templates/smtp.rb +9 -0
  57. data/templates/spec_helper.rb +23 -0
  58. data/templates/staging.rb +9 -0
  59. data/templates/suspenders_gitignore +13 -0
  60. metadata +167 -0
@@ -0,0 +1,2 @@
1
+ web: bundle exec puma -p $PORT -C ./config/puma.rb
2
+ worker: bundle exec rake jobs:work
@@ -0,0 +1,18 @@
1
+ # <%= app_name.humanize %>
2
+
3
+ ## Getting Started
4
+
5
+ After you have cloned this repo, run this setup script to set up your machine
6
+ with the necessary dependencies to run and test this app:
7
+
8
+ % ./bin/setup
9
+
10
+ It assumes you have a machine equipped with Ruby, Postgres, etc. If not, set up
11
+ your machine with our setup script placed in our internal guides.
12
+
13
+ ## Guidelines
14
+
15
+ Use the following guides for getting things done, programming well, and
16
+ programming in style.
17
+
18
+ * [Infinum Developer Handbook](https://developer-handbook.infinum.co)
@@ -0,0 +1,7 @@
1
+ <% if flash.any? %>
2
+ <div class="flashes">
3
+ <% user_facing_flashes.each do |key, value| -%>
4
+ <div class="flash-<%= key %>"><%= value %></div>
5
+ <% end -%>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% if Rails.env.test? %>
2
+ <%= javascript_tag do %>
3
+ $.fx.off = true;
4
+ $.ajaxSetup({ async: false });
5
+ <% end %>
6
+ <% end %>
@@ -0,0 +1,5 @@
1
+ RSpec.configure do |config|
2
+ config.before(:each) do
3
+ ActionMailer::Base.deliveries.clear
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ desc 'Annotate only models'
2
+ task :annotate do
3
+ `annotate --exclude tests,fixtures,factories`
4
+ end
@@ -0,0 +1,10 @@
1
+ doctype html
2
+ html
3
+ head
4
+ title <%%= @app_name.titleize %>
5
+ = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
6
+ = javascript_include_tag 'application', 'data-turbolinks-track' => true
7
+ = csrf_meta_tags
8
+ body class="<%%= body_class %>"
9
+ = render 'flashes'
10
+ = yield
@@ -0,0 +1 @@
1
+ @charset "utf-8";
@@ -0,0 +1,32 @@
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 'bundle check || bundle install'
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system 'bin/rake db:setup'
22
+ system 'bundle exec rake dev:prime'
23
+
24
+ puts "\n== Removing old logs and tempfiles =="
25
+ system 'rm -f log/*'
26
+ system 'rm -rf tmp/cache'
27
+ end
28
+ # Set up database and add any development seed data
29
+ bin/rake dev:prime
30
+
31
+ # Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
32
+ mkdir -p .git/safe
@@ -0,0 +1,4 @@
1
+ Last 2 versions
2
+ Explorer >= 9
3
+ iOS >= 7.1
4
+ Android >= 4.4
@@ -0,0 +1,5 @@
1
+ Bugsnag.configure do |config|
2
+ config.api_key = Rails.application.secrets.bugsnag_api_key
3
+ config.ignore_classes = []
4
+ config.notify_release_stages = ['production', 'staging']
5
+ end
@@ -0,0 +1,12 @@
1
+ if Rails.env.development? || Rails.env.test?
2
+ require "bundler/audit/cli"
3
+
4
+ namespace :bundler do
5
+ desc "Updates the ruby-advisory-db and runs audit"
6
+ task :audit do
7
+ %w(update check).each do |command|
8
+ Bundler::Audit::CLI.start [command]
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ Capybara.javascript_driver = :webkit
2
+
3
+ Capybara::Webkit.configure do |config|
4
+ config.block_unknown_urls
5
+ end
@@ -0,0 +1,13 @@
1
+ search:
2
+ paths:
3
+ - "app/controllers"
4
+ - "app/helpers"
5
+ - "app/presenters"
6
+ - "app/views"
7
+
8
+ ignore_unused:
9
+ - activerecord.*
10
+ - date.*
11
+ - simple_form.*
12
+ - time.*
13
+ - titles.*
@@ -0,0 +1,19 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ default:
5
+ "%m/%d/%Y"
6
+ with_weekday:
7
+ "%a %m/%d/%y"
8
+
9
+ time:
10
+ formats:
11
+ default:
12
+ "%a, %b %-d, %Y at %r"
13
+ date:
14
+ "%b %-d, %Y"
15
+ short:
16
+ "%B %d"
17
+
18
+ titles:
19
+ application: <%= app_name.humanize %>
@@ -0,0 +1,21 @@
1
+ RSpec.configure do |config|
2
+ config.before(:suite) do
3
+ DatabaseCleaner.clean_with(:deletion)
4
+ end
5
+
6
+ config.before(:each) do
7
+ DatabaseCleaner.strategy = :transaction
8
+ end
9
+
10
+ config.before(:each, js: true) do
11
+ DatabaseCleaner.strategy = :deletion
12
+ end
13
+
14
+ config.before(:each) do
15
+ DatabaseCleaner.start
16
+ end
17
+
18
+ config.after(:each) do
19
+ DatabaseCleaner.clean
20
+ end
21
+ end
@@ -0,0 +1,95 @@
1
+ require 'mina/bundler'
2
+ require 'mina/rails'
3
+ require 'mina/git'
4
+ # require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
5
+ # require 'mina/rvm' # for rvm support. (http://rvm.io)
6
+
7
+ # Basic settings:
8
+ # domain - The hostname to SSH to.
9
+ # deploy_to - Path to deploy into.
10
+ # repository - Git repo to clone from. (needed by mina/git)
11
+ # branch - Branch name to deploy. (needed by mina/git)
12
+ set :repository, ENV['GIT_REPOSITORY']
13
+ set :user, ENV['USERNAME']
14
+ set :port, ENV['PORT_NUMBER']
15
+
16
+ task :production do
17
+ set :domain, ENV['PRODUCTION_DOMAIN']
18
+ set :deploy_to, ENV['PRODUCTION_DEPLOY_FOLDER']
19
+ set :branch, 'master'
20
+ end
21
+
22
+ task :staging do
23
+ set :domain, ENV['STAGING_DOMAIN']
24
+ set :deploy_to, ENV['STAGING_DEPLOY_FOLDER']
25
+ set :branch, 'master'
26
+ end
27
+
28
+ # For system-wide RVM install.
29
+ # set :rvm_path, '/usr/local/rvm/bin/rvm'
30
+
31
+ # Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
32
+ # They will be linked in the 'deploy:link_shared_paths' step.
33
+ set :shared_paths, ['log']
34
+
35
+ # Optional settings:
36
+ # set :user, 'foobar' # Username in the server to SSH to.
37
+ # set :port, '30000' # SSH port number.
38
+ # set :forward_agent, true # SSH forward_agent.
39
+
40
+ # This task is the environment that is loaded for most commands, such as
41
+ # `mina deploy` or `mina rake`.
42
+ task :environment do
43
+ # If you're using rbenv, use this to load the rbenv environment.
44
+ # Be sure to commit your .rbenv-version to your repository.
45
+ # invoke :'rbenv:load'
46
+
47
+ # For those using RVM, use this to load an RVM version@gemset.
48
+ # invoke :'rvm:use[ruby-1.9.3-p125@default]'
49
+ end
50
+
51
+ # Put any custom mkdir's in here for when `mina setup` is ran.
52
+ # For Rails apps, we'll make some of the shared paths that are shared between
53
+ # all releases.
54
+ task :setup => :environment do
55
+ queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
56
+ queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]
57
+ end
58
+
59
+ desc "Deploys the current version to the server."
60
+ task :deploy => :environment do
61
+ deploy do
62
+
63
+ to :prepare do
64
+ queue! %[echo "-----> Stopping jobs"]
65
+ queue! %[mkdir log]
66
+ queue "RAILS_ENV=#{rails_env} #{deploy_to}/#{current_path}/bin/delayed_job stop"
67
+ queue! %[rm -r log]
68
+ end
69
+
70
+ to :default do
71
+ invoke :'git:clone'
72
+ invoke :'deploy:link_shared_paths'
73
+ invoke :'bundle:install'
74
+ invoke :'rails:db_migrate'
75
+ invoke :'rails:assets_precompile'
76
+ invoke :'deploy:cleanup'
77
+ end
78
+
79
+ to :launch do
80
+ queue %[echo "-----> Retarting jobs"]
81
+ queue! %[mkdir -p #{deploy_to}/#{current_path}/tmp/pids]
82
+ queue "RAILS_ENV=#{rails_env} #{deploy_to}/#{current_path}/bin/delayed_job restart"
83
+
84
+ queue "mkdir -p #{deploy_to}/#{current_path}/tmp/"
85
+ queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt"
86
+ end
87
+ end
88
+ end
89
+
90
+ # For help in making your deploy script, see the Mina documentation:
91
+ #
92
+ # - http://nadarei.co/mina
93
+ # - http://nadarei.co/mina/tasks
94
+ # - http://nadarei.co/mina/settings
95
+ # - http://nadarei.co/mina/helpers
@@ -0,0 +1,12 @@
1
+ if Rails.env.development? || Rails.env.test?
2
+ require "factory_girl"
3
+
4
+ namespace :dev do
5
+ desc "Sample data for local development environment"
6
+ task prime: "db:setup" do
7
+ include FactoryGirl::Syntax::Methods
8
+
9
+ # create(:user, email: "user@example.com", password: "password")
10
+ end
11
+ end
12
+ end
@@ -0,0 +1 @@
1
+ ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
@@ -0,0 +1,34 @@
1
+ require "net/http"
2
+ require "net/smtp"
3
+
4
+ # Example:
5
+ # begin
6
+ # some http call
7
+ # rescue *HTTP_ERRORS => error
8
+ # notify_hoptoad error
9
+ # end
10
+
11
+ HTTP_ERRORS = [
12
+ EOFError,
13
+ Errno::ECONNRESET,
14
+ Errno::EINVAL,
15
+ Net::HTTPBadResponse,
16
+ Net::HTTPHeaderSyntaxError,
17
+ Net::ProtocolError,
18
+ Timeout::Error
19
+ ]
20
+
21
+ SMTP_SERVER_ERRORS = [
22
+ IOError,
23
+ Net::SMTPAuthenticationError,
24
+ Net::SMTPServerBusy,
25
+ Net::SMTPUnknownError,
26
+ TimeoutError
27
+ ]
28
+
29
+ SMTP_CLIENT_ERRORS = [
30
+ Net::SMTPFatalError,
31
+ Net::SMTPSyntaxError
32
+ ]
33
+
34
+ SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
@@ -0,0 +1,2 @@
1
+ FactoryGirl.define do
2
+ end
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include FactoryGirl::Syntax::Methods
3
+ end
@@ -0,0 +1,5 @@
1
+ module FlashesHelper
2
+ def user_facing_flashes
3
+ flash.to_hash.slice("alert", "error", "notice", "success")
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include AbstractController::Translation
3
+ end
@@ -0,0 +1 @@
1
+ ActiveSupport::JSON::Encoding.time_precision = 0
@@ -0,0 +1,23 @@
1
+ default: &default
2
+ encoding: utf8
3
+ adapter: postgresql
4
+ pool: 5
5
+ timeout: 5000
6
+ host: localhost
7
+ username: postgres
8
+
9
+ development:
10
+ <<: *default
11
+ database: <%= @app_path %>_development
12
+
13
+ test:
14
+ <<: *default
15
+ database: <%= @app_path %>_test
16
+
17
+ staging:
18
+ <<: *default
19
+ database: <%= @app_path %>_staging
20
+
21
+ production:
22
+ <<: *default
23
+ database: <%= @app_path %>_production
@@ -0,0 +1,22 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+ abort("DATABASE_URL environment variable is set") if ENV["DATABASE_URL"]
5
+
6
+ require "rspec/rails"
7
+
8
+ Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |file| require file }
9
+
10
+ module Features
11
+ # Extend this module in spec/support/features/*.rb
12
+ include Formulaic::Dsl
13
+ end
14
+
15
+ RSpec.configure do |config|
16
+ config.include Features, type: :feature
17
+ config.infer_base_class_for_anonymous_controllers = false
18
+ config.infer_spec_type_from_file_location!
19
+ config.use_transactional_fixtures = false
20
+ end
21
+
22
+ ActiveRecord::Migration.maintain_test_schema!
@@ -0,0 +1,9 @@
1
+ ASSET_HOST=localhost:3000
2
+ APPLICATION_HOST=localhost:3000
3
+ RACK_ENV=development
4
+ SECRET_KEY_BASE=development_secret
5
+ EXECJS_RUNTIME=Node
6
+ SMTP_ADDRESS=smtp.example.com
7
+ SMTP_DOMAIN=example.com
8
+ SMTP_PASSWORD=password
9
+ SMTP_USERNAME=username
@@ -0,0 +1,15 @@
1
+ default: &default
2
+ secret_key_base: <%%= ENV.fetch('SECRET_KEY_BASE') %>
3
+ bugsnag_api_key: <%%= ENV.fetch('BUGSNAG_API_KEY') %>
4
+
5
+ development:
6
+ <<: *default
7
+
8
+ test:
9
+ <<: *default
10
+
11
+ staging:
12
+ <<: *default
13
+
14
+ production:
15
+ <<: *default
@@ -0,0 +1,6 @@
1
+ Shoulda::Matchers.configure do |config|
2
+ config.integrate do |with|
3
+ with.test_framework :rspec
4
+ with.library :rails
5
+ end
6
+ end