rails-replicator 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 (58) hide show
  1. data/.gitignore +85 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +87 -0
  4. data/LICENSE +21 -0
  5. data/README.md +41 -0
  6. data/bin/replicator +16 -0
  7. data/lib/replicator/actions.rb +40 -0
  8. data/lib/replicator/app_builder.rb +337 -0
  9. data/lib/replicator/generators/app_generator.rb +207 -0
  10. data/lib/replicator/version.rb +3 -0
  11. data/replicator.gemspec +29 -0
  12. data/templates/Gemfile_clean +68 -0
  13. data/templates/Procfile +2 -0
  14. data/templates/README.md.erb +5 -0
  15. data/templates/_flashes.html.slim.erb +13 -0
  16. data/templates/_javascript.html.slim.erb +7 -0
  17. data/templates/ability.rb +15 -0
  18. data/templates/admin_base_controller.rb +14 -0
  19. data/templates/admin_dashboard_controller.rb +4 -0
  20. data/templates/application.css.sass +12 -0
  21. data/templates/application.html.slim.erb +24 -0
  22. data/templates/application.js +8 -0
  23. data/templates/application_helper.rb +5 -0
  24. data/templates/background_jobs_rspec.rb +19 -0
  25. data/templates/bin_setup +26 -0
  26. data/templates/config_locales_en.yml +11 -0
  27. data/templates/database.yml.erb +12 -0
  28. data/templates/database_cleaner_rspec.rb +21 -0
  29. data/templates/devise/confirmations/new.html.slim +12 -0
  30. data/templates/devise/mailer/confirmation_instructions.html.erb +5 -0
  31. data/templates/devise/mailer/reset_password_instructions.html.erb +8 -0
  32. data/templates/devise/mailer/unlock_instructions.html.erb +7 -0
  33. data/templates/devise/passwords/edit.html.slim +19 -0
  34. data/templates/devise/passwords/new.html.slim +14 -0
  35. data/templates/devise/registrations/edit.html.slim +36 -0
  36. data/templates/devise/registrations/new.html.slim +22 -0
  37. data/templates/devise/sessions/new.html.slim +20 -0
  38. data/templates/devise/shared/_links.html.slim +24 -0
  39. data/templates/devise/unlocks/new.html.slim +13 -0
  40. data/templates/devise_login.html.slim +20 -0
  41. data/templates/devise_shared_links.html.slim +24 -0
  42. data/templates/disable_xml_params.rb +3 -0
  43. data/templates/errors.rb +28 -0
  44. data/templates/factories_spec.rb +13 -0
  45. data/templates/factories_spec_rake_task.rb +9 -0
  46. data/templates/factory_girl_syntax_rspec.rb +3 -0
  47. data/templates/gitignore +85 -0
  48. data/templates/rack_timeout.rb +1 -0
  49. data/templates/routes.rb.erb +15 -0
  50. data/templates/sample.env +2 -0
  51. data/templates/smtp.rb +10 -0
  52. data/templates/spec_helper.rb +25 -0
  53. data/templates/stylesheets/layout/.keep +0 -0
  54. data/templates/stylesheets/typography/.keep +0 -0
  55. data/templates/stylesheets/typography/_forms.css.sass +2 -0
  56. data/templates/stylesheets/widgets/.keep +0 -0
  57. data/templates/unicorn.rb +26 -0
  58. metadata +140 -0
@@ -0,0 +1,20 @@
1
+ .col-md-6.col-md-offset-3
2
+ h1.page-header Sign in
3
+
4
+ = form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
5
+ .form-group
6
+ = f.label :email, class: 'control-label'
7
+ = f.email_field :email, autofocus: true, class: 'form-control'
8
+
9
+ .form-group
10
+ = f.label :password, class: 'control-label'
11
+ = f.password_field :password, class: 'form-control'
12
+
13
+ - if devise_mapping.rememberable?
14
+ .checkbox
15
+ = f.check_box :remember_me
16
+ = f.label :remember_me
17
+ .form-actions
18
+ = f.submit 'Sign in', class: 'btn btn-primary btn-lg'
19
+
20
+ = render 'devise/shared/links'
@@ -0,0 +1,24 @@
1
+ p.shared-account-links
2
+ - if controller_name != 'sessions'
3
+ = link_to "Sign in", new_session_path(resource_name)
4
+ br
5
+
6
+ - if devise_mapping.registerable? && controller_name != 'registrations'
7
+ = link_to "Sign up", new_registration_path(resource_name)
8
+ br
9
+
10
+ - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
11
+ = link_to "Forgot your password?", new_password_path(resource_name)
12
+ br
13
+
14
+ - if devise_mapping.confirmable? && controller_name != 'confirmations'
15
+ = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
16
+ br
17
+
18
+ - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
19
+ = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
20
+ br
21
+
22
+ - if devise_mapping.omniauthable?
23
+ - resource_class.omniauth_providers.each do |provider|
24
+ = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider)
@@ -0,0 +1,13 @@
1
+ h1.page-header Resend unlock instructions
2
+
3
+ = form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
4
+ = devise_error_messages!
5
+
6
+ .form-group
7
+ = f.label :email, class: 'form-label'
8
+ = f.email_field :email, :autofocus => true, class: 'form-control'
9
+
10
+ .form-action
11
+ = f.submit 'Resend unlock instructions', class: 'btn btn-primary btn-lg'
12
+
13
+ = render 'devise/shared/links'
@@ -0,0 +1,20 @@
1
+ .col-md-6.col-md-offset-3
2
+ h1.page-header Sign in
3
+
4
+ = form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
5
+ .form-group
6
+ = f.label :email, class: 'control-label'
7
+ = f.email_field :email, autofocus: true, class: 'form-control'
8
+
9
+ .form-group
10
+ = f.label :password, class: 'control-label'
11
+ = f.password_field :password, class: 'form-control'
12
+
13
+ - if devise_mapping.rememberable?
14
+ .checkbox
15
+ = f.check_box :remember_me
16
+ = f.label :remember_me
17
+ .form-actions
18
+ = f.submit 'Sign in', class: 'btn btn-primary btn-lg'
19
+
20
+ = render 'devise/shared/links'
@@ -0,0 +1,24 @@
1
+ p.shared-account-links
2
+ - if controller_name != 'sessions'
3
+ = link_to "Sign in", new_session_path(resource_name)
4
+ br
5
+
6
+ - if devise_mapping.registerable? && controller_name != 'registrations'
7
+ = link_to "Sign up", new_registration_path(resource_name)
8
+ br
9
+
10
+ - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
11
+ = link_to "Forgot your password?", new_password_path(resource_name)
12
+ br
13
+
14
+ - if devise_mapping.confirmable? && controller_name != 'confirmations'
15
+ = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
16
+ br
17
+
18
+ - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
19
+ = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
20
+ br
21
+
22
+ - if devise_mapping.omniauthable?
23
+ - resource_class.omniauth_providers.each do |provider|
24
+ = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider)
@@ -0,0 +1,3 @@
1
+ # Protect against injection attacks
2
+ # http://www.kb.cert.org/vuls/id/380039
3
+ ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
@@ -0,0 +1,28 @@
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 = [Timeout::Error,
12
+ Errno::EINVAL,
13
+ Errno::ECONNRESET,
14
+ EOFError,
15
+ Net::HTTPBadResponse,
16
+ Net::HTTPHeaderSyntaxError,
17
+ Net::ProtocolError]
18
+
19
+ SMTP_SERVER_ERRORS = [TimeoutError,
20
+ IOError,
21
+ Net::SMTPUnknownError,
22
+ Net::SMTPServerBusy,
23
+ Net::SMTPAuthenticationError]
24
+
25
+ SMTP_CLIENT_ERRORS = [Net::SMTPFatalError,
26
+ Net::SMTPSyntaxError]
27
+
28
+ SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ FactoryGirl.factories.map(&:name).each do |factory_name|
4
+ describe "factory #{factory_name}" do
5
+ it 'is valid' do
6
+ factory = build(factory_name)
7
+
8
+ if factory.respond_to?(:valid?)
9
+ expect(factory).to be_valid, factory.errors.full_messages.join(',')
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ if defined?(RSpec)
2
+ desc 'Run factory specs.'
3
+
4
+ RSpec::Core::RakeTask.new(:factory_specs) do |t|
5
+ t.pattern = './spec/models/factories_spec.rb'
6
+ end
7
+
8
+ task spec: :factory_specs
9
+ end
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include FactoryGirl::Syntax::Methods
3
+ end
@@ -0,0 +1,85 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*.log
16
+ /tmp
17
+ [12:00 PM]: ~/Dropbox/Code/apps/foobar : cat ../chimera/.gitignore
18
+ # bundler state
19
+ /.bundle
20
+ /vendor/bundle/
21
+ /vendor/ruby/
22
+
23
+ # minimal Rails specific artifacts
24
+ db/*.sqlite3
25
+ /log/*
26
+ /tmp/*
27
+
28
+ # various artifacts
29
+ **.war
30
+ *.rbc
31
+ *.sassc
32
+ .rspec
33
+ .redcar/
34
+ .sass-cache
35
+ /config/config.yml
36
+ /config/database.yml
37
+ /coverage.data
38
+ /coverage/
39
+ /db/*.javadb/
40
+ /db/*.sqlite3
41
+ /doc/api/
42
+ /doc/app/
43
+ /doc/features.html
44
+ /doc/specs.html
45
+ /public/cache
46
+ /public/stylesheets/compiled
47
+ /public/system/*
48
+ /spec/tmp/*
49
+ /cache
50
+ /capybara*
51
+ /capybara-*.html
52
+ /gems
53
+ /specifications
54
+ rerun.txt
55
+ pickle-email-*.html
56
+
57
+ # If you find yourself ignoring temporary files generated by your text editor
58
+ # or operating system, you probably want to add a global ignore instead:
59
+ # git config --global core.excludesfile ~/.gitignore_global
60
+ #
61
+ # Here are some files you may want to ignore globally:
62
+
63
+ # scm revert files
64
+ **.orig
65
+
66
+ # Mac finder artifacts
67
+ .DS_Store
68
+
69
+ # Netbeans project directory
70
+ /nbproject/
71
+
72
+ # RubyMine project files
73
+ .idea
74
+
75
+ # Textmate project files
76
+ /*.tmproj
77
+
78
+ # vim artifacts
79
+ **.swp
80
+
81
+ # Ignore application configuration
82
+ /config/application.yml
83
+
84
+ # Ignore Heroku environment file
85
+ .env
@@ -0,0 +1 @@
1
+ Rack::Timeout.timeout = (ENV['TIMEOUT_IN_SECONDS'] || 5).to_i
@@ -0,0 +1,15 @@
1
+ <%= app_name.classify %>::Application.routes.draw do
2
+ devise_for :users
3
+ devise_scope :user do
4
+ get "login", :to => "devise/sessions#new"
5
+ delete "logout", to: "devise/sessions#destroy"
6
+ get "signup", to: "devise/registrations#new"
7
+ end
8
+
9
+ namespace "admin" do
10
+ # resources :puppies
11
+ get '', to: 'dashboard#index'
12
+ end
13
+
14
+ root to: 'pages#index'
15
+ end
@@ -0,0 +1,2 @@
1
+ # http://ddollar.github.com/foreman/
2
+ RACK_ENV=development
data/templates/smtp.rb ADDED
@@ -0,0 +1,10 @@
1
+ if Rails.env.staging? || Rails.env.production?
2
+ SMTP_SETTINGS = {
3
+ address: ENV['SMTP_ADDRESS'], # example: 'smtp.sendgrid.net'
4
+ authentication: :plain,
5
+ domain: ENV['SMTP_DOMAIN'], # example: 'example.com'
6
+ password: ENV['SMTP_PASSWORD'],
7
+ port: '587',
8
+ user_name: ENV['SMTP_USERNAME']
9
+ }
10
+ end
@@ -0,0 +1,25 @@
1
+ require 'simplecov'
2
+ SimpleCov.start 'rails'
3
+
4
+ ENV['RAILS_ENV'] = 'test'
5
+
6
+ require File.expand_path('../../config/environment', __FILE__)
7
+
8
+ require 'rspec/rails'
9
+ require 'webmock/rspec'
10
+
11
+ Dir[Rails.root.join('spec/support/**/*.rb')].each { |file| require file }
12
+
13
+ RSpec.configure do |config|
14
+ config.expect_with :rspec do |c|
15
+ c.syntax = :expect
16
+ end
17
+
18
+ config.fail_fast = true
19
+ config.infer_base_class_for_anonymous_controllers = false
20
+ config.order = 'random'
21
+ config.use_transactional_fixtures = false
22
+ end
23
+
24
+ Capybara.javascript_driver = :webkit
25
+ WebMock.disable_net_connect!(allow_localhost: true)
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ .form-actions
2
+ margin-bottom: 2em
File without changes
@@ -0,0 +1,26 @@
1
+ # https://devcenter.heroku.com/articles/rails-unicorn
2
+
3
+ worker_processes (ENV['WEB_CONCURRENCY'] || 3).to_i
4
+ timeout (ENV['WEB_TIMEOUT'] || 5).to_i
5
+ preload_app true
6
+
7
+ before_fork do |server, worker|
8
+ Signal.trap 'TERM' do
9
+ puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
10
+ Process.kill 'QUIT', Process.pid
11
+ end
12
+
13
+ if defined? ActiveRecord::Base
14
+ ActiveRecord::Base.connection.disconnect!
15
+ end
16
+ end
17
+
18
+ after_fork do |server, worker|
19
+ Signal.trap 'TERM' do
20
+ puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
21
+ end
22
+
23
+ if defined? ActiveRecord::Base
24
+ ActiveRecord::Base.establish_connection
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails-replicator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - teleporter
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-09-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - '='
36
+ - !ruby/object:Gem::Version
37
+ version: 4.0.0
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - '='
44
+ - !ruby/object:Gem::Version
45
+ version: 4.0.0
46
+ description: ! 'Rails application generator used at Teleporter, based on thoughtbot/suspenders.
47
+
48
+ '
49
+ email: hire@teleporter.io
50
+ executables:
51
+ - replicator
52
+ extensions: []
53
+ extra_rdoc_files:
54
+ - README.md
55
+ - LICENSE
56
+ files:
57
+ - .gitignore
58
+ - Gemfile
59
+ - Gemfile.lock
60
+ - LICENSE
61
+ - README.md
62
+ - bin/replicator
63
+ - lib/replicator/actions.rb
64
+ - lib/replicator/app_builder.rb
65
+ - lib/replicator/generators/app_generator.rb
66
+ - lib/replicator/version.rb
67
+ - replicator.gemspec
68
+ - templates/Gemfile_clean
69
+ - templates/Procfile
70
+ - templates/README.md.erb
71
+ - templates/_flashes.html.slim.erb
72
+ - templates/_javascript.html.slim.erb
73
+ - templates/ability.rb
74
+ - templates/admin_base_controller.rb
75
+ - templates/admin_dashboard_controller.rb
76
+ - templates/application.css.sass
77
+ - templates/application.html.slim.erb
78
+ - templates/application.js
79
+ - templates/application_helper.rb
80
+ - templates/background_jobs_rspec.rb
81
+ - templates/bin_setup
82
+ - templates/config_locales_en.yml
83
+ - templates/database.yml.erb
84
+ - templates/database_cleaner_rspec.rb
85
+ - templates/devise/confirmations/new.html.slim
86
+ - templates/devise/mailer/confirmation_instructions.html.erb
87
+ - templates/devise/mailer/reset_password_instructions.html.erb
88
+ - templates/devise/mailer/unlock_instructions.html.erb
89
+ - templates/devise/passwords/edit.html.slim
90
+ - templates/devise/passwords/new.html.slim
91
+ - templates/devise/registrations/edit.html.slim
92
+ - templates/devise/registrations/new.html.slim
93
+ - templates/devise/sessions/new.html.slim
94
+ - templates/devise/shared/_links.html.slim
95
+ - templates/devise/unlocks/new.html.slim
96
+ - templates/devise_login.html.slim
97
+ - templates/devise_shared_links.html.slim
98
+ - templates/disable_xml_params.rb
99
+ - templates/errors.rb
100
+ - templates/factories_spec.rb
101
+ - templates/factories_spec_rake_task.rb
102
+ - templates/factory_girl_syntax_rspec.rb
103
+ - templates/gitignore
104
+ - templates/rack_timeout.rb
105
+ - templates/routes.rb.erb
106
+ - templates/sample.env
107
+ - templates/smtp.rb
108
+ - templates/spec_helper.rb
109
+ - templates/stylesheets/layout/.keep
110
+ - templates/stylesheets/typography/.keep
111
+ - templates/stylesheets/typography/_forms.css.sass
112
+ - templates/stylesheets/widgets/.keep
113
+ - templates/unicorn.rb
114
+ homepage: http://github.com/teleporter/replicator
115
+ licenses:
116
+ - MIT
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
+ none: false
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: 2.0.0
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 1.8.24
137
+ signing_key:
138
+ specification_version: 3
139
+ summary: Generate a Rails app using Teleporter's best practices.
140
+ test_files: []