tirantes 1.0.7

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 (50) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.travis.yml +8 -0
  4. data/CONTRIBUTING.md +38 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +140 -0
  7. data/LICENSE +21 -0
  8. data/NEWS.md +125 -0
  9. data/README.md +160 -0
  10. data/Rakefile +8 -0
  11. data/bin/tirantes +16 -0
  12. data/features/github_repo.feature +8 -0
  13. data/features/heroku_true.feature +9 -0
  14. data/features/rake_clean.feature +15 -0
  15. data/features/step_definitions/tirantes_steps.rb +68 -0
  16. data/features/support/bin/heroku +5 -0
  17. data/features/support/bin/hub +5 -0
  18. data/features/support/env.rb +10 -0
  19. data/features/support/fake_github.rb +21 -0
  20. data/features/support/fake_heroku.rb +21 -0
  21. data/lib/tirantes/actions.rb +40 -0
  22. data/lib/tirantes/app_builder.rb +322 -0
  23. data/lib/tirantes/generators/app_generator.rb +203 -0
  24. data/lib/tirantes/version.rb +3 -0
  25. data/templates/Gemfile_clean +50 -0
  26. data/templates/Procfile +2 -0
  27. data/templates/README.md.erb +11 -0
  28. data/templates/_flashes.html.erb +5 -0
  29. data/templates/_javascript.html.erb +10 -0
  30. data/templates/application.css.scss +14 -0
  31. data/templates/background_jobs_minitest.rb +19 -0
  32. data/templates/bin_setup +18 -0
  33. data/templates/config_locales_en.yml +11 -0
  34. data/templates/database_cleaner_minitest.rb +15 -0
  35. data/templates/disable_xml_params.rb +3 -0
  36. data/templates/errors.rb +28 -0
  37. data/templates/exception_notification.rb +8 -0
  38. data/templates/javascripts/prefilled_input.js +59 -0
  39. data/templates/postgresql_database.yml.erb +12 -0
  40. data/templates/puma.rb +13 -0
  41. data/templates/rack_timeout.rb +1 -0
  42. data/templates/sample.env +14 -0
  43. data/templates/secret_token.rb.erb +5 -0
  44. data/templates/simple_form_purecss.rb +13 -0
  45. data/templates/smtp.rb +10 -0
  46. data/templates/test_helper.rb +39 -0
  47. data/templates/tirantes_gitignore +17 -0
  48. data/templates/tirantes_layout.html.erb.erb +15 -0
  49. data/tirantes.gemspec +33 -0
  50. metadata +163 -0
@@ -0,0 +1,14 @@
1
+ @charset 'utf-8';
2
+
3
+ ///////////////////////////////////////////////////////////////////////////////
4
+
5
+ @import 'purecss/base';
6
+ @import 'purecss/grids';
7
+ @import 'purecss/forms';
8
+ @import 'purecss/buttons';
9
+ @import 'purecss/menus';
10
+
11
+ //@import 'base/*';
12
+ //@import 'layout/*';
13
+ //@import 'modules/*';
14
+ ///////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,19 @@
1
+ module BackgroundJobs
2
+ def run_background_jobs_immediately
3
+ delay_jobs = Delayed::Worker.delay_jobs
4
+ Delayed::Worker.delay_jobs = false
5
+ yield
6
+ ensure
7
+ Delayed::Worker.delay_jobs = delay_jobs
8
+ end
9
+ end
10
+
11
+ #RSpec.configure do |config|
12
+ # config.around(:each, type: :feature) do |example|
13
+ # run_background_jobs_immediately do
14
+ # example.run
15
+ # end
16
+ # end
17
+ #
18
+ # config.include BackgroundJobs
19
+ #end
@@ -0,0 +1,18 @@
1
+ # Set up Rails app. Run this script immediately after cloning the codebase.
2
+ # https://github.com/thoughtbot/guides/tree/master/protocol
3
+
4
+ # Set up configurable environment variables
5
+ if [ ! -f .env ]; then
6
+ cp .sample.env .env
7
+ fi
8
+
9
+ # Pick a port for Foreman
10
+ echo "port: 7000" > .foreman
11
+
12
+ # Set up DNS via Pow
13
+ if [ -d ~/.pow ]
14
+ then
15
+ echo 7000 > ~/.pow/`basename $PWD`
16
+ else
17
+ echo "Pow not set up but the team uses it for this project. Setup: http://goo.gl/RaDPO"
18
+ fi
@@ -0,0 +1,11 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ default: '%m/%d/%Y'
5
+ with_weekday: '%a %m/%d/%y'
6
+
7
+ time:
8
+ formats:
9
+ default: '%a, %b %-d, %Y at %r'
10
+ date: '%b %-d, %Y'
11
+ short: '%B %d'
@@ -0,0 +1,15 @@
1
+ class Minitest::Unit::TestCase
2
+ def self.prepare
3
+ DatabaseCleaner.clean_with(:deletion)
4
+ end
5
+ prepare
6
+
7
+ def setup
8
+ DatabaseCleaner.strategy = :transaction
9
+ DatabaseCleaner.start
10
+ end
11
+
12
+ def teardown
13
+ DatabaseCleaner.clean
14
+ end
15
+ end
@@ -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,8 @@
1
+ if Rails.env.staging? || Rails.env.production?
2
+ Whatever::Application.config.middleware.use ExceptionNotification::Rack,
3
+ :email => {
4
+ :email_prefix => ENV['EXCEPTION_NOTIFICATION_PREFIX'] || "[Exception] ",
5
+ :sender_address => ENV['EXCEPTION_NOTIFICATION_SENDER'] || %{"notifier" <notifier@example.com>},
6
+ :exception_recipients => ENV['EXCEPTION_NOTIFICATION_RECIPIENTS'] || %w{exceptions@example.com}
7
+ }
8
+ end
@@ -0,0 +1,59 @@
1
+ // clear inputs with starter values
2
+ new function($) {
3
+ $.fn.prefilledInput = function() {
4
+
5
+ var focus = function () {
6
+ $(this).removeClass('prefilled');
7
+ if (this.value == this.prefilledValue) {
8
+ this.value = '';
9
+ }
10
+ };
11
+
12
+ var blur = function () {
13
+ if (this.value == '') {
14
+ $(this).addClass('prefilled').val(this.prefilledValue);
15
+ } else if (this.value != this.prefilledValue) {
16
+ $(this).removeClass('prefilled');
17
+ }
18
+ };
19
+
20
+ var extractPrefilledValue = function () {
21
+ if (this.title) {
22
+ this.prefilledValue = this.title;
23
+ this.title = '';
24
+ } else if (this.id) {
25
+ this.prefilledValue = $('label[for=' + this.id + ']').hide().text();
26
+ }
27
+ if (this.prefilledValue) {
28
+ this.prefilledValue = this.prefilledValue.replace(/\*$/, '');
29
+ }
30
+ };
31
+
32
+ var initialize = function (index) {
33
+ if (!this.prefilledValue) {
34
+ this.extractPrefilledValue = extractPrefilledValue;
35
+ this.extractPrefilledValue();
36
+ $(this).trigger('blur');
37
+ }
38
+ };
39
+
40
+ return this.filter(":input").
41
+ focus(focus).
42
+ blur(blur).
43
+ each(initialize);
44
+ };
45
+
46
+ var clearPrefilledInputs = function () {
47
+ var form = this.form || this;
48
+ $(form).find("input.prefilled, textarea.prefilled").val("");
49
+ };
50
+
51
+ var prefilledSetup = function () {
52
+ $('input.prefilled, textarea.prefilled').prefilledInput();
53
+ $('form').submit(clearPrefilledInputs);
54
+ $('input:submit, button:submit').click(clearPrefilledInputs);
55
+ };
56
+
57
+ $(document).ready(prefilledSetup);
58
+ $(document).ajaxComplete(prefilledSetup);
59
+ }(jQuery);
@@ -0,0 +1,12 @@
1
+ development: &default
2
+ adapter: postgresql
3
+ database: <%= app_name %>_development
4
+ encoding: utf8
5
+ min_messages: warning
6
+ host: localhost
7
+ pool: 5
8
+ timeout: 5000
9
+
10
+ test:
11
+ <<: *default
12
+ database: <%= app_name %>_test
data/templates/puma.rb ADDED
@@ -0,0 +1,13 @@
1
+ # http://ctshryock.com/posts/2012/07/12/running-rails-with-puma-on-heroku.html
2
+
3
+ environment ENV['RACK_ENV']
4
+ threads 0,5
5
+
6
+ workers 3
7
+ preload_app!
8
+
9
+ on_worker_boot do
10
+ ActiveSupport.on_load(:active_record) do
11
+ ActiveRecord::Base.establish_connection
12
+ end
13
+ end
@@ -0,0 +1 @@
1
+ Rack::Timeout.timeout = (ENV['TIMEOUT_IN_SECONDS'] || 5).to_i
@@ -0,0 +1,14 @@
1
+ # http://ddollar.github.com/foreman/
2
+ RACK_ENV=development
3
+
4
+ # Uncomment and set the right values
5
+ # SMTP_ADDRESS=smtp.mandrillapp.com
6
+ # SMTP_DOMAIN=this-app.com
7
+ # SMTP_PASSWORD=mysecretpassword
8
+ # SMTP_USERNAME=myusername
9
+
10
+ # TIMEOUT_IN_SECONDS=30
11
+
12
+ # EXCEPTION_NOTIFICATION_PREFIX=[Exception]
13
+ # EXCEPTION_NOTIFICATION_SENDER="notifier" <notifier@example.com>
14
+ # EXCEPTION_NOTIFICATION_RECIPIENTS=exception@example.com
@@ -0,0 +1,5 @@
1
+ <%= app_name.classify %>::Application.config.secret_key_base = if Rails.env.development? or Rails.env.test?
2
+ ('x' * 30) # meets minimum requirement of 30 chars long
3
+ else
4
+ ENV['SECRET_TOKEN']
5
+ end
@@ -0,0 +1,13 @@
1
+ SimpleForm.setup do |config|
2
+ config.wrappers :purecss, tag: 'div', class: 'pure-control-group', error_class: 'field_with_errors' do |b|
3
+ b.use :html5
4
+ b.use :placeholder
5
+
6
+ b.use :label_input
7
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
8
+ b.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
9
+ end
10
+
11
+ config.button_class = 'pure-button'
12
+ config.default_wrapper = :purecss
13
+ end
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: 'this-app.com'
6
+ password: ENV['SMTP_PASSWORD'],
7
+ port: '587',
8
+ user_name: ENV['SMTP_USERNAME']
9
+ }
10
+ end
@@ -0,0 +1,39 @@
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 'rails/test_help'
9
+ require 'minitest/autorun'
10
+ require 'minitest/rails'
11
+ #require 'minitest/rails/capybara'
12
+ require 'capybara/poltergeist'
13
+ #require 'minitest/focus'
14
+ #require 'minitest/colorize'
15
+ #require 'webmock/minitest'
16
+ require 'database_cleaner'
17
+
18
+ module Minitest::Expectations
19
+ infect_an_assertion :assert_redirected_to, :must_redirect_to
20
+ infect_an_assertion :assert_template, :must_render_template
21
+ infect_an_assertion :assert_response, :must_respond_with
22
+ end
23
+
24
+ Dir[Rails.root.join('test/support/**/*.rb')].each{ |file| require file }
25
+
26
+ class ActiveSupport::TestCase
27
+ fixtures :all
28
+ end
29
+
30
+ class Minitest::Unit::TestCase
31
+ class << self
32
+ alias_method :context, :describe
33
+ end
34
+ end
35
+
36
+ Capybara.javascript_driver = :poltergeist
37
+ Capybara.default_driver = :poltergeist
38
+
39
+ WebMock.disable_net_connect!(allow_localhost: true)
@@ -0,0 +1,17 @@
1
+ !.keep
2
+ *.DS_Store
3
+ *.swo
4
+ *.swp
5
+ .bundle
6
+ .sass-cache/
7
+ coverage/*
8
+ db/*.sqlite3
9
+ db/schema.rb
10
+ log/*
11
+ public/system
12
+ rerun.txt
13
+ tags
14
+ tmp/*
15
+ tmp/**/*
16
+ .env
17
+ .sample.env
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="ROBOTS" content="NOODP" />
6
+ <title>Rails Application</title>
7
+ <%%= stylesheet_link_tag :application, :media => 'all' %>
8
+ <%%= csrf_meta_tags %>
9
+ </head>
10
+ <body>
11
+ <%%= render 'flashes' -%>
12
+ <%%= yield %>
13
+ <%%= render 'javascript' %>
14
+ </body>
15
+ </html>
data/tirantes.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'tirantes/version'
4
+ require 'date'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.required_ruby_version = '>= 2.1.0'
8
+ s.add_dependency 'bundler', '~> 1.7.0'
9
+ s.add_dependency 'rails', '~>4.2.0'
10
+ s.add_development_dependency 'aruba', '~> 0.5.2'
11
+ s.add_development_dependency 'cucumber', '~> 1.2'
12
+ s.authors = ['thoughtbot']
13
+ s.date = Date.today.strftime('%Y-%m-%d')
14
+
15
+ s.description = <<-HERE
16
+ Tirantes is a base Rails project that you can upgrade. It is used by
17
+ thoughtbot to get a jump start on a working app. Use Suspenders if you're in a
18
+ rush to build something amazing; don't use it if you like missing deadlines.
19
+ HERE
20
+
21
+ s.email = 'support@thoughtbot.com'
22
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |file| File.basename(file) }
23
+ s.extra_rdoc_files = %w[README.md LICENSE]
24
+ s.files = `git ls-files`.split("\n")
25
+ s.homepage = 'http://github.com/thoughtbot/suspenders'
26
+ s.license = 'MIT'
27
+ s.name = 'tirantes'
28
+ s.rdoc_options = ['--charset=UTF-8']
29
+ s.require_paths = ['lib']
30
+ s.summary = "Generate a Rails app using thoughtbot's best practices."
31
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
32
+ s.version = Tirantes::VERSION
33
+ end
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tirantes
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.7
5
+ platform: ruby
6
+ authors:
7
+ - thoughtbot
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.7.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.7.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 4.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 4.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: aruba
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.5.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: cucumber
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.2'
69
+ description: |
70
+ Tirantes is a base Rails project that you can upgrade. It is used by
71
+ thoughtbot to get a jump start on a working app. Use Suspenders if you're in a
72
+ rush to build something amazing; don't use it if you like missing deadlines.
73
+ email: support@thoughtbot.com
74
+ executables:
75
+ - tirantes
76
+ extensions: []
77
+ extra_rdoc_files:
78
+ - README.md
79
+ - LICENSE
80
+ files:
81
+ - ".gitignore"
82
+ - ".travis.yml"
83
+ - CONTRIBUTING.md
84
+ - Gemfile
85
+ - Gemfile.lock
86
+ - LICENSE
87
+ - NEWS.md
88
+ - README.md
89
+ - Rakefile
90
+ - bin/tirantes
91
+ - features/github_repo.feature
92
+ - features/heroku_true.feature
93
+ - features/rake_clean.feature
94
+ - features/step_definitions/tirantes_steps.rb
95
+ - features/support/bin/heroku
96
+ - features/support/bin/hub
97
+ - features/support/env.rb
98
+ - features/support/fake_github.rb
99
+ - features/support/fake_heroku.rb
100
+ - lib/tirantes/actions.rb
101
+ - lib/tirantes/app_builder.rb
102
+ - lib/tirantes/generators/app_generator.rb
103
+ - lib/tirantes/version.rb
104
+ - templates/Gemfile_clean
105
+ - templates/Procfile
106
+ - templates/README.md.erb
107
+ - templates/_flashes.html.erb
108
+ - templates/_javascript.html.erb
109
+ - templates/application.css.scss
110
+ - templates/background_jobs_minitest.rb
111
+ - templates/bin_setup
112
+ - templates/config_locales_en.yml
113
+ - templates/database_cleaner_minitest.rb
114
+ - templates/disable_xml_params.rb
115
+ - templates/errors.rb
116
+ - templates/exception_notification.rb
117
+ - templates/javascripts/prefilled_input.js
118
+ - templates/postgresql_database.yml.erb
119
+ - templates/puma.rb
120
+ - templates/rack_timeout.rb
121
+ - templates/sample.env
122
+ - templates/secret_token.rb.erb
123
+ - templates/simple_form_purecss.rb
124
+ - templates/smtp.rb
125
+ - templates/test_helper.rb
126
+ - templates/tirantes_gitignore
127
+ - templates/tirantes_layout.html.erb.erb
128
+ - tirantes.gemspec
129
+ homepage: http://github.com/thoughtbot/suspenders
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options:
135
+ - "--charset=UTF-8"
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: 2.1.0
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 2.4.5
151
+ signing_key:
152
+ specification_version: 4
153
+ summary: Generate a Rails app using thoughtbot's best practices.
154
+ test_files:
155
+ - features/github_repo.feature
156
+ - features/heroku_true.feature
157
+ - features/rake_clean.feature
158
+ - features/step_definitions/tirantes_steps.rb
159
+ - features/support/bin/heroku
160
+ - features/support/bin/hub
161
+ - features/support/env.rb
162
+ - features/support/fake_github.rb
163
+ - features/support/fake_heroku.rb