dfl_rails_config 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +41 -0
  7. data/Rakefile +1 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +7 -0
  10. data/dfl_rails_config.gemspec +32 -0
  11. data/lib/dfl_rails_config.rb +5 -0
  12. data/lib/dfl_rails_config/version.rb +3 -0
  13. data/lib/generators/dfl_rails_config/USAGE +8 -0
  14. data/lib/generators/dfl_rails_config/install_generator.rb +158 -0
  15. data/lib/generators/dfl_rails_config/templates/.overcommit.yml +42 -0
  16. data/lib/generators/dfl_rails_config/templates/.rubocop.yml +118 -0
  17. data/lib/generators/dfl_rails_config/templates/application.css.scss +9 -0
  18. data/lib/generators/dfl_rails_config/templates/application.js +41 -0
  19. data/lib/generators/dfl_rails_config/templates/bin/_heroku_vars.sh +7 -0
  20. data/lib/generators/dfl_rails_config/templates/bin/deploy_production +27 -0
  21. data/lib/generators/dfl_rails_config/templates/bin/deploy_staging +34 -0
  22. data/lib/generators/dfl_rails_config/templates/bin/heroku_setup +16 -0
  23. data/lib/generators/dfl_rails_config/templates/bin/heroku_setup_staging +14 -0
  24. data/lib/generators/dfl_rails_config/templates/bin/rubocop-precommit +8 -0
  25. data/lib/generators/dfl_rails_config/templates/database.yml +13 -0
  26. data/lib/generators/dfl_rails_config/templates/gemfiles/bootstrap_datepicker_rails.rb +1 -0
  27. data/lib/generators/dfl_rails_config/templates/gemfiles/bootstrap_filestyle_rails.rb +1 -0
  28. data/lib/generators/dfl_rails_config/templates/gemfiles/bootstrap_flash_messages.rb +1 -0
  29. data/lib/generators/dfl_rails_config/templates/gemfiles/bootstrap_sass.rb +1 -0
  30. data/lib/generators/dfl_rails_config/templates/gemfiles/default_value_for.rb +1 -0
  31. data/lib/generators/dfl_rails_config/templates/gemfiles/devise.rb +3 -0
  32. data/lib/generators/dfl_rails_config/templates/gemfiles/dotenv_rails.rb +3 -0
  33. data/lib/generators/dfl_rails_config/templates/gemfiles/enum_help.rb +1 -0
  34. data/lib/generators/dfl_rails_config/templates/gemfiles/forgery.rb +2 -0
  35. data/lib/generators/dfl_rails_config/templates/gemfiles/has_scope.rb +2 -0
  36. data/lib/generators/dfl_rails_config/templates/gemfiles/heroku.rb +5 -0
  37. data/lib/generators/dfl_rails_config/templates/gemfiles/inherited_resources.rb +2 -0
  38. data/lib/generators/dfl_rails_config/templates/gemfiles/kaminari.rb +2 -0
  39. data/lib/generators/dfl_rails_config/templates/gemfiles/mandrill_api.rb +1 -0
  40. data/lib/generators/dfl_rails_config/templates/gemfiles/mysql.rb +1 -0
  41. data/lib/generators/dfl_rails_config/templates/gemfiles/nprogress_rails.rb +1 -0
  42. data/lib/generators/dfl_rails_config/templates/gemfiles/rails_i18n.rb +2 -0
  43. data/lib/generators/dfl_rails_config/templates/gemfiles/ransak.rb +1 -0
  44. data/lib/generators/dfl_rails_config/templates/gemfiles/responders.rb +2 -0
  45. data/lib/generators/dfl_rails_config/templates/gemfiles/rspec.rb +5 -0
  46. data/lib/generators/dfl_rails_config/templates/gemfiles/simple_form.rb +2 -0
  47. data/lib/generators/dfl_rails_config/templates/gemfiles/slim_rails.rb +1 -0
  48. data/lib/generators/dfl_rails_config/templates/gemfiles/tools/annotate.rb +1 -0
  49. data/lib/generators/dfl_rails_config/templates/gemfiles/tools/brakeman.rb +2 -0
  50. data/lib/generators/dfl_rails_config/templates/gemfiles/tools/bump.rb +2 -0
  51. data/lib/generators/dfl_rails_config/templates/gemfiles/tools/guard_livereload.rb +2 -0
  52. data/lib/generators/dfl_rails_config/templates/gemfiles/tools/overcommit.rb +2 -0
  53. data/lib/generators/dfl_rails_config/templates/gemfiles/tools/rails_best_practices.rb +2 -0
  54. data/lib/generators/dfl_rails_config/templates/gemfiles/tools/rubocop.rb +4 -0
  55. data/lib/generators/dfl_rails_config/templates/slim/scaffold/_form.html.slim +12 -0
  56. data/lib/generators/dfl_rails_config/templates/slim/scaffold/edit.html.slim +7 -0
  57. data/lib/generators/dfl_rails_config/templates/slim/scaffold/index.html.slim +20 -0
  58. data/lib/generators/dfl_rails_config/templates/slim/scaffold/new.html.slim +7 -0
  59. data/lib/generators/dfl_rails_config/templates/slim/scaffold/show.html.slim +15 -0
  60. metadata +131 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 441f86070f5ed1bc5f058a4b3afc824d1584b3fe
4
+ data.tar.gz: 88dc320b91902db9ab7b092c8406995818c46ce4
5
+ SHA512:
6
+ metadata.gz: 6c7123657481c97a14a1e7c66edd01581a4d2667c67c5a275e93df2a7be7ca6066f4981ff33af45f0bc115334aa525c24931075334b7984ed88b5bbd0ea00250
7
+ data.tar.gz: 7b955e4fb8f61e916cba98f57d7717867e9a9e421387583a615f08d717de28597544071bd8a11b35c73477478347fec505445fad792bef418afebb517def438e
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
11
+ pkg
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dfl_rails_config.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Daniel Fernando Lourusso
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # DflRailsConfig
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dfl_rails_config`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'dfl_rails_config'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install dfl_rails_config
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dfl_rails_config.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "dfl_rails_config"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dfl_rails_config/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dfl_rails_config"
8
+ spec.version = DflRailsConfig::VERSION
9
+ spec.authors = ["Daniel Fernando Lourusso"]
10
+ spec.email = ["dflourusso@gmail.com"]
11
+
12
+ spec.summary = "Prepare rails application for develop"
13
+ spec.description = "Basic configuration for rails application"
14
+ spec.homepage = "https://github.com/dflourusso"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ end
@@ -0,0 +1,5 @@
1
+ require "dfl_rails_config/version"
2
+
3
+ module DflRailsConfig
4
+ # Do a generator to run all sub generators
5
+ end
@@ -0,0 +1,3 @@
1
+ module DflRailsConfig
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate initializer Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,158 @@
1
+ require 'rails/generators'
2
+
3
+ # TODO: Dividir generator em partes. Ex: DeployGenerator, GemsGenerator, DatabaseGenerator, etc.
4
+ module DflRailsConfig
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ def create_version_file
9
+ create_file "lib/version.rb", <<-FILE
10
+ module #{application_name}
11
+ VERSION = '0.0.1'
12
+ end
13
+ FILE
14
+ end
15
+
16
+ def copy_bin
17
+ directory 'bin/', 'bin/'
18
+ end
19
+
20
+ def replace_deploy_vars
21
+ f = 'bin/_heroku_vars.sh'
22
+ gsub_file f, '_STAGING_APP', "#{application_name.underscore}_staging"
23
+ gsub_file f, '_STAGING_NAME', "'#{application_name.underscore.humanize} Staging'"
24
+ gsub_file f, '_PRODUCTION_APP', application_name.underscore
25
+ gsub_file f, '_PRODUCTION_NAME', "'#{application_name.underscore.humanize}'"
26
+ gsub_file f, '_APP_DOMAIN', "#{application_name.underscore}.com.br"
27
+ end
28
+
29
+ def add_flash_types
30
+ file_name = 'app/controllers/application_controller.rb'
31
+ unless File.read(file_name) =~ /add_flash_types/
32
+ inject_into_file file_name, after: 'protect_from_forgery with: :exception' do
33
+ "\n add_flash_types :warning, :error, :info"
34
+ end
35
+ end
36
+ end
37
+
38
+ def inject_default_date_formats
39
+ file_name = 'config/application.rb'
40
+ unless File.read(file_name) =~ /Date::DATE_FORMATS/
41
+ inject_into_file file_name, after: "raise_in_transactional_callbacks = true" do
42
+ "\n Date::DATE_FORMATS[:default] = '%d/%m/%Y'"
43
+ end
44
+ end
45
+ unless File.read(file_name) =~ /Time::DATE_FORMATS/
46
+ inject_into_file file_name, after: "raise_in_transactional_callbacks = true" do
47
+ "\n Time::DATE_FORMATS[:default] = '%d/%m/%Y %H:%M:%S'"
48
+ end
49
+ end
50
+ end
51
+
52
+ def rubocop_config
53
+ file_name = '.rubocop.yml'
54
+ copy_file file_name, file_name
55
+ end
56
+
57
+ def gem_font_awesome_rails
58
+ append_file 'Gemfile', "\ngem 'font-awesome-rails'" unless File.read('Gemfile') =~ /font-awesome-rails/
59
+ end
60
+
61
+ def gem_better_errors
62
+ unless File.read('Gemfile') =~ /better_errors/
63
+ inject_into_file 'Gemfile', after: "group :development, :test do" do
64
+ "\n gem 'better_errors'\n"
65
+ end
66
+ end
67
+ end
68
+
69
+ def gem_ruby_version
70
+ unless File.read('Gemfile') =~ /ruby /
71
+ inject_into_file 'Gemfile', after: "source 'https://rubygems.org'\n" do
72
+ "\nruby '2.2.2'"
73
+ end
74
+ end
75
+ end
76
+
77
+ def include_gems_directory
78
+ string_to_append = "\nDir.glob('gemfiles/**/*.rb') { |f| eval_gemfile f }\n"
79
+ regex = /Dir.glob\('gemfiles\/\*\*\/\*.rb'\)/
80
+ directory 'gemfiles/', 'gemfiles/'
81
+ append_file 'Gemfile', string_to_append unless File.read('Gemfile') =~ regex
82
+ Bundler.with_clean_env {run "bundle install --without production"}
83
+ end
84
+
85
+ def overcommit_install
86
+ # run 'overcommit --install'
87
+ file_name = '.overcommit.yml'
88
+ remove_file file_name
89
+ copy_file file_name, file_name
90
+ end
91
+
92
+ def rspec_install
93
+ run 'rails generate rspec:install'
94
+ end
95
+
96
+ def devise_install
97
+ run 'rails generate devise:install'
98
+
99
+ #password length
100
+ old_config = 'config.password_length = 8..72'
101
+ new_config = 'config.password_length = Rails.env.production? ? 8..72 : 1..8'
102
+ gsub_file 'config/initializers/devise.rb', old_config, new_config
103
+ end
104
+
105
+ def kaminari_views
106
+ run 'rails g kaminari:views bootstrap3'
107
+ end
108
+
109
+ def simple_form_install
110
+ run 'rails generate simple_form:install --bootstrap'
111
+ end
112
+
113
+ def rspec_always_test_env
114
+ gsub_file 'spec/rails_helper.rb', "ENV['RAILS_ENV'] ||= 'test'", "ENV['RAILS_ENV'] = 'test'"
115
+ end
116
+
117
+ def i18n_pt_br
118
+ file_name = 'config/application.rb'
119
+ gsub_file file_name, '# config.i18n.default_locale = :de', "config.i18n.default_locale = :'pt-BR'"
120
+ end
121
+
122
+ def ransak_simple_form
123
+ file_name = 'config/application.rb'
124
+ unless File.read(file_name) =~ /RANSACK_FORM_BUILDER/
125
+ inject_into_file file_name, before: "require 'rails/all'" do
126
+ "ENV['RANSACK_FORM_BUILDER'] = '::SimpleForm::FormBuilder'\n"
127
+ end
128
+ end
129
+ end
130
+
131
+ def configure_database
132
+ file_name = 'config/database.yml'
133
+ remove_file file_name
134
+ copy_file file_name.split('/').last, file_name
135
+ gsub_file file_name, 'database_name', application_name.underscore
136
+ gsub_file file_name, 'database_name_test', "#{application_name.underscore}_test"
137
+ end
138
+
139
+ def application_js
140
+ file_name = 'app/assets/javascripts/application.js'
141
+ remove_file file_name
142
+ copy_file file_name.split('/').last, file_name
143
+ end
144
+
145
+ def application_css
146
+ rm_file_name = 'app/assets/stylesheets/application.css'
147
+ file_name = 'app/assets/stylesheets/application.css.scss'
148
+ remove_file rm_file_name
149
+ copy_file file_name.split('/').last, file_name
150
+ end
151
+
152
+ protected
153
+
154
+ def application_name
155
+ Rails.application.class.parent_name
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,42 @@
1
+ # Use this file to configure the Overcommit hooks you wish to use. This will
2
+ # extend the default configuration defined in:
3
+ # https://github.com/brigade/overcommit/blob/master/config/default.yml
4
+ #
5
+ # At the topmost level of this YAML file is a key representing type of hook
6
+ # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7
+ # customize each hook, such as whether to only run it on certain files (via
8
+ # `include`), whether to only display output if it fails (via `quiet`), etc.
9
+ #
10
+ # For a complete list of hooks, see:
11
+ # https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
12
+ #
13
+ # For a complete list of options that you can use to customize hooks, see:
14
+ # https://github.com/brigade/overcommit#configuration
15
+ #
16
+ # Uncomment the following lines to make the configuration take effect.
17
+ CommitMsg:
18
+ CapitalizedSubject:
19
+ enabled: false
20
+
21
+ PreCommit:
22
+ RuboCop:
23
+ enabled: true
24
+ on_warn: fail # Treat all warnings as failures
25
+ command: ['bin/rubocop-precommit']
26
+
27
+ TrailingWhitespace:
28
+ enabled: true
29
+
30
+ TrailingWhitespace:
31
+ enabled: true
32
+
33
+ PrePush:
34
+ RSpec:
35
+ enabled: true
36
+ #
37
+ #PostCheckout:
38
+ # ALL: # Special hook name that customizes all hooks of this type
39
+ # quiet: true # Change all post-checkout hooks to only display output on failure
40
+ #
41
+ # IndexTags:
42
+ # enabled: true # Generate a tags file with `ctags` each time HEAD changes
@@ -0,0 +1,118 @@
1
+ AllCops:
2
+ RunRailsCops: false
3
+ DisplayCopNames: true
4
+ DisplayStyleGuide: true
5
+ StyleGuideCopsOnly: false
6
+ Exclude:
7
+ - db/**/*
8
+ - bin/*
9
+
10
+ # Configuration parameters: AllowSafeAssignment.
11
+ Lint/AssignmentInCondition:
12
+ Enabled: true
13
+ Exclude:
14
+ - bin/spring
15
+
16
+ # Cop supports --auto-correct.
17
+ Style/BlockComments:
18
+ Enabled: true
19
+ Exclude:
20
+ - spec/spec_helper.rb
21
+
22
+ # Cop supports --auto-correct.
23
+ Lint/UnusedBlockArgument:
24
+ Enabled: true
25
+ Exclude:
26
+ - config/initializers/bower_rails.rb
27
+
28
+ Lint/HandleExceptions:
29
+ Enabled: true
30
+ Exclude:
31
+ - bin/rails
32
+ - bin/rake
33
+
34
+ # Configuration parameters: MinBodyLength.
35
+ Style/GuardClause:
36
+ MinBodyLength: 2
37
+
38
+ # Cop supports --auto-correct.
39
+ Style/NumericLiterals:
40
+ Enabled: true
41
+ Exclude:
42
+ - db/schema.rb
43
+
44
+ # Cop supports --auto-correct.
45
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
46
+ Style/BracesAroundHashParameters:
47
+ Enabled: true
48
+ AutoCorrect: false
49
+
50
+ # dificil de arrumar
51
+ Metrics/AbcSize:
52
+ Enabled: false
53
+
54
+ # Configuration parameters: CountComments.
55
+ Metrics/MethodLength:
56
+ Max: 12
57
+
58
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
59
+ Style/ClassAndModuleChildren:
60
+ Enabled: false
61
+
62
+ # Cop supports --auto-correct.
63
+ # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
64
+ Style/BlockDelimiters:
65
+ Enabled: true
66
+ Exclude:
67
+ - spec/controllers/**/*
68
+
69
+ # Cop supports --auto-correct.
70
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
71
+ Style/EmptyLinesAroundBlockBody:
72
+ Exclude:
73
+ - spec/**/*
74
+
75
+ # Cop supports --auto-correct.
76
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
77
+ Style/SpaceInsideBlockBraces:
78
+ Enabled: false
79
+ EnforcedStyle: no_space
80
+ SpaceBeforeBlockParameters: false
81
+
82
+ Style/Documentation:
83
+ Enabled: false
84
+
85
+ # Cop supports --auto-correct.
86
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
87
+ # TODO: suportar com e sem
88
+ Style/SpaceInsideHashLiteralBraces:
89
+ Enabled: false
90
+ EnforcedStyle: no_space
91
+ Exclude:
92
+ - spec/**/*
93
+ - test/**/*
94
+
95
+ # Cop supports --auto-correct.
96
+ # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
97
+ Style/HashSyntax:
98
+ Enabled: false
99
+ Exclude:
100
+ - spec/**/*
101
+
102
+ # Configuration parameters: AllowURI, URISchemes.
103
+ Metrics/LineLength:
104
+ Max: 120
105
+ Exclude:
106
+ - spec/**/*
107
+ - test/**/*
108
+
109
+ # Cop supports --auto-correct.
110
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
111
+ Style/StringLiterals:
112
+ Enabled: true
113
+ Exclude:
114
+ - spec/**/*
115
+ - test/**/*
116
+
117
+ Style/CaseIndentation:
118
+ Enabled: false
@@ -0,0 +1,9 @@
1
+
2
+ @import "bootstrap";
3
+ @import 'font-awesome';
4
+ @import 'devise_bootstrap_views';
5
+ @import 'bootstrap-datepicker';
6
+
7
+ /*
8
+ *= require_tree .
9
+ */
@@ -0,0 +1,41 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require bootstrap
17
+ //= require jquery.mask.min
18
+ //= require jquery.mask.definitions
19
+ //= require bootstrap-datepicker/core
20
+ //= require bootstrap-datepicker/locales/bootstrap-datepicker.pt-BR.js
21
+ //= require bootstrap-filestyle
22
+ //= require_tree .
23
+
24
+ $(document).on("ready page:load", function() {
25
+ $(".alert-dismissable" ).slideDown('fast').delay(3000).slideToggle('fast');
26
+ initializeMasks();
27
+ $('.datepicker').datepicker({
28
+ language: "pt-BR",
29
+ todayBtn: "linked",
30
+ autoclose: true,
31
+ todayHighlight: true,
32
+ format: "dd/mm/yyyy"
33
+ });
34
+ $(":file").filestyle({
35
+ buttonText: 'Selecionar arquivo',
36
+ iconName: 'fa fa-folder-open',
37
+ buttonName: 'btn-primary',
38
+ buttonBefore: true,
39
+ badge: true
40
+ });
41
+ });
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ STAGING_APP=_STAGING_APP
4
+ STAGING_APP_NAME=_STAGING_NAME
5
+ PRODUCTION_APP=_PRODUCTION_APP
6
+ PRODUCTION_APP_NAME=_PRODUCTION_NAME
7
+ APP_DOMAIN=_APP_DOMAIN
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+ source $(dirname $0)"/_heroku_vars.sh"
3
+
4
+ set -e
5
+
6
+ # bump=${1:-patch} # executar bump minor antes de deploy_staging
7
+ set -v
8
+
9
+ heroku maintenance:on --app $PRODUCTION_APP
10
+
11
+ heroku pipeline:promote --app $STAGING_APP
12
+ heroku run rake db:migrate --app $PRODUCTION_APP
13
+ heroku ps:restart --app $PRODUCTION_APP
14
+
15
+ heroku maintenance:off --app $PRODUCTION_APP
16
+
17
+ # salva a tag da versão atual
18
+ git tag -a -m "v$(bump current | awk '{print $3}')" $(bump current | awk '{print $3}') master
19
+
20
+ # depois já incrementa a versão no develop
21
+ git checkout develop
22
+ bump patch
23
+
24
+ # atualiza repositório
25
+ git push -v origin master:master
26
+ git push -v origin develop:develop
27
+ git push -v --tags origin
@@ -0,0 +1,34 @@
1
+ #!/bin/bash
2
+ source $(dirname $0)"/_heroku_vars.sh"
3
+
4
+ # parar se ocorrer algum erro
5
+ set -e
6
+
7
+ # definie a app heroku que será utilizado
8
+ export HEROKU_APP=$STAGING_APP
9
+
10
+ # exibe os comandos executados
11
+ set -v
12
+
13
+ git checkout master
14
+ # traz atualizações do develop para o master, ignorando conflitos
15
+ git merge --no-ff --rerere-autoupdate --no-edit -v --stat -X theirs develop
16
+ git checkout develop
17
+
18
+ # coloca a app online em modo de manutenção
19
+ heroku maintenance:on
20
+
21
+ # publica app no heroku
22
+ git push $STAGING_APP master
23
+ # roda as migrações
24
+ heroku run rake db:migrate
25
+ # reinicia a app no heroku
26
+ heroku ps:restart
27
+
28
+ # tira o app do modo manutenção
29
+ heroku maintenance:off
30
+
31
+ # atualiza repositório
32
+ git push -v origin master:master
33
+ git push -v origin develop:develop
34
+ git push -v --tags origin
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+ source $(dirname $0)"/_heroku_vars.sh"
3
+
4
+ export HEROKU_APP=$PRODUCTION_APP
5
+
6
+ heroku plugins:install git://github.com/heroku/heroku-pipeline.git
7
+ heroku labs:enable pipelines
8
+
9
+ heroku addons:add heroku-postgresql
10
+ heroku addons:add adminium:petproject
11
+ #heroku addons:add cloudinary:starter
12
+ heroku addons:add pgbackups:auto-month
13
+ heroku addons:add newrelic:stark
14
+ heroku config:set NEW_RELIC_APP_NAME=$PRODUCTION_APP_NAME
15
+
16
+ heroku domains:add $APP_DOMAIN
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+ source $(dirname $0)"/_heroku_vars.sh"
3
+
4
+ export HEROKU_APP=$STAGING_APP
5
+
6
+ heroku plugins:install git://github.com/heroku/heroku-pipeline.git
7
+ heroku labs:enable pipelines
8
+
9
+ heroku addons:add heroku-postgresql
10
+ heroku addons:add adminium:petproject
11
+ #heroku addons:add cloudinary:starter
12
+ heroku addons:add pgbackups:auto-month
13
+ heroku addons:add newrelic:stark
14
+ heroku config:set NEW_RELIC_APP_NAME=$STAGING_APP_NAME
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ # executa rubocop apenas nos arquivos que serao comitados
3
+ # filtra apenas arquivos rb
4
+ # ou utiliza rubocop-selec, mas duas vezes mais lento
5
+ # xargs -0 bundle exec rubocop-select
6
+ git diff --cached --name-only --diff-filter=AM \
7
+ | grep "\.rb$" \
8
+ | xargs bundle exec rubocop -F --force-exclusion
@@ -0,0 +1,13 @@
1
+ default: &default
2
+ adapter: mysql2
3
+ username: root
4
+ database: database_name
5
+ pool: 5
6
+ timeout: 5000
7
+
8
+ development:
9
+ <<: *default
10
+
11
+ test:
12
+ <<: *default
13
+ database: database_name_test
@@ -0,0 +1 @@
1
+ gem 'bootstrap-datepicker-rails'
@@ -0,0 +1 @@
1
+ gem 'bootstrap-filestyle-rails'
@@ -0,0 +1 @@
1
+ gem 'bootstrap_flash_messages'
@@ -0,0 +1 @@
1
+ gem 'bootstrap-sass'
@@ -0,0 +1 @@
1
+ gem 'default_value_for', '~> 3.0.0'
@@ -0,0 +1,3 @@
1
+ gem 'devise'
2
+ gem 'devise-i18n'
3
+ gem 'devise-bootstrap-views'
@@ -0,0 +1,3 @@
1
+ # Autoload dotenv in Rails.
2
+ # [dotenv-rails](https://github.com/bkeepers/dotenv)
3
+ gem 'dotenv-rails', groups: [:development, :test]
@@ -0,0 +1,2 @@
1
+ # Lorem Ipsum generator
2
+ gem 'forgery'
@@ -0,0 +1,2 @@
1
+ # https://github.com/plataformatec/has_scope
2
+ gem 'has_scope'
@@ -0,0 +1,5 @@
1
+ group :production do
2
+ gem 'rails_12factor' # https://devcenter.heroku.com/articles/getting-started-with-rails4#heroku-gems
3
+ gem 'pg' # https://devcenter.heroku.com/articles/getting-started-with-rails4#use-postgres
4
+ gem 'unicorn' # https://devcenter.heroku.com/articles/getting-started-with-rails4#webserver
5
+ end
@@ -0,0 +1,2 @@
1
+ # https://github.com/josevalim/inherited_resources
2
+ gem 'inherited_resources'
@@ -0,0 +1,2 @@
1
+ # https://github.com/amatsuda/kaminari
2
+ gem 'kaminari'
@@ -0,0 +1 @@
1
+ gem 'mysql2', group: :development
@@ -0,0 +1 @@
1
+ gem 'nprogress-rails'
@@ -0,0 +1,2 @@
1
+ # https://github.com/svenfuchs/rails-i18n#configuration
2
+ gem 'rails-i18n'
@@ -0,0 +1,2 @@
1
+ # https://github.com/plataformatec/responders
2
+ gem 'responders'
@@ -0,0 +1,5 @@
1
+ group :development, :test do
2
+ gem 'rspec'
3
+ gem 'rspec-rails'
4
+ gem 'shoulda-matchers', require: false
5
+ end
@@ -0,0 +1,2 @@
1
+ gem 'simple_form'
2
+ gem 'simple_form_bootstrap3'
@@ -0,0 +1 @@
1
+ gem 'annotate', group: :development, require: false
@@ -0,0 +1,2 @@
1
+ # https://github.com/presidentbeef/brakeman
2
+ gem 'brakeman', group: :development, require: false
@@ -0,0 +1,2 @@
1
+ # https://github.com/gregorym/bump#usage
2
+ gem 'bump', group: :development, require: false
@@ -0,0 +1,2 @@
1
+ # https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei
2
+ gem 'guard-livereload', group: :development, require: false # https://github.com/guard/guard-livereload#install
@@ -0,0 +1,2 @@
1
+ # https://github.com/brigade/overcommit
2
+ gem 'overcommit', group: :development, require: false
@@ -0,0 +1,2 @@
1
+ # https://github.com/railsbp/rails_best_practices
2
+ gem 'rails_best_practices', group: :development, require: false
@@ -0,0 +1,4 @@
1
+ # https://github.com/bbatsov/rubocop#installation
2
+ gem 'rubocop', group: :development, require: false
3
+ # https://github.com/packsaddle/rubocop-select
4
+ # gem 'rubocop-select', group: :development, require: false
@@ -0,0 +1,12 @@
1
+ = simple_form_for(@<%= singular_table_name %>) do |f|
2
+ = f.error_notification
3
+
4
+ .form-inputs
5
+ <%- attributes.each do |attribute| -%>
6
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
7
+ <%- end -%>
8
+
9
+ .form-actions
10
+ .btn-group
11
+ = back_button <%= table_name %>_path
12
+ = save_button
@@ -0,0 +1,7 @@
1
+ .row
2
+ .col-sm-6.col-sm-offset-3
3
+ .panel.panel-default
4
+ .panel-body
5
+ h2.text-center.text-success Editar <%= singular_table_name %>
6
+
7
+ == render 'form'
@@ -0,0 +1,20 @@
1
+ h2.text-center.text-success Exibindo <%= plural_table_name.titleize %>
2
+
3
+ table.table
4
+ thead
5
+ tr
6
+ <%- attributes.each do |attribute| -%>
7
+ th = han(:<%= attribute.name %>)
8
+ <%- end -%>
9
+ th.text-right = new_button new_<%= singular_table_name %>_path, 'btn-xs'
10
+ tbody
11
+ - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
12
+ tr
13
+ <%- attributes.each do |attribute| -%>
14
+ td = <%= singular_table_name %>.<%= attribute.name %>
15
+ <%- end -%>
16
+ td.text-right
17
+ .btn-group
18
+ = show_button <%= singular_table_name %>, 'btn-xs'
19
+ = edit_button edit_<%= singular_table_name %>_path(<%= singular_table_name %>), 'btn-xs'
20
+ = destroy_button <%= singular_table_name %>, 'btn-xs'
@@ -0,0 +1,7 @@
1
+ .row
2
+ .col-sm-6.col-sm-offset-3
3
+ .panel.panel-default
4
+ .panel-body
5
+ h2.text-center.text-success Novo <%= singular_table_name %>
6
+
7
+ == render 'form'
@@ -0,0 +1,15 @@
1
+ .row
2
+ .col-sm-6.col-sm-offset-3
3
+ .panel.panel-default
4
+ .panel-body
5
+ h2.text-center.text-success Exibindo <%= plural_table_name.titleize %>
6
+
7
+ <%- attributes.reject(&:password_digest?).each do |attribute| -%>
8
+ p
9
+ strong = "#{han(:<%= attribute.name %>)}: "
10
+ = @<%= singular_table_name %>.<%= attribute.name %>
11
+ <%- end -%>
12
+ hr
13
+ .btn-group
14
+ = back_button
15
+ = edit_button edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dfl_rails_config
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Fernando Lourusso
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-07-09 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Basic configuration for rails application
42
+ email:
43
+ - dflourusso@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".travis.yml"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/console
55
+ - bin/setup
56
+ - dfl_rails_config.gemspec
57
+ - lib/dfl_rails_config.rb
58
+ - lib/dfl_rails_config/version.rb
59
+ - lib/generators/dfl_rails_config/USAGE
60
+ - lib/generators/dfl_rails_config/install_generator.rb
61
+ - lib/generators/dfl_rails_config/templates/.overcommit.yml
62
+ - lib/generators/dfl_rails_config/templates/.rubocop.yml
63
+ - lib/generators/dfl_rails_config/templates/application.css.scss
64
+ - lib/generators/dfl_rails_config/templates/application.js
65
+ - lib/generators/dfl_rails_config/templates/bin/_heroku_vars.sh
66
+ - lib/generators/dfl_rails_config/templates/bin/deploy_production
67
+ - lib/generators/dfl_rails_config/templates/bin/deploy_staging
68
+ - lib/generators/dfl_rails_config/templates/bin/heroku_setup
69
+ - lib/generators/dfl_rails_config/templates/bin/heroku_setup_staging
70
+ - lib/generators/dfl_rails_config/templates/bin/rubocop-precommit
71
+ - lib/generators/dfl_rails_config/templates/database.yml
72
+ - lib/generators/dfl_rails_config/templates/gemfiles/bootstrap_datepicker_rails.rb
73
+ - lib/generators/dfl_rails_config/templates/gemfiles/bootstrap_filestyle_rails.rb
74
+ - lib/generators/dfl_rails_config/templates/gemfiles/bootstrap_flash_messages.rb
75
+ - lib/generators/dfl_rails_config/templates/gemfiles/bootstrap_sass.rb
76
+ - lib/generators/dfl_rails_config/templates/gemfiles/default_value_for.rb
77
+ - lib/generators/dfl_rails_config/templates/gemfiles/devise.rb
78
+ - lib/generators/dfl_rails_config/templates/gemfiles/dotenv_rails.rb
79
+ - lib/generators/dfl_rails_config/templates/gemfiles/enum_help.rb
80
+ - lib/generators/dfl_rails_config/templates/gemfiles/forgery.rb
81
+ - lib/generators/dfl_rails_config/templates/gemfiles/has_scope.rb
82
+ - lib/generators/dfl_rails_config/templates/gemfiles/heroku.rb
83
+ - lib/generators/dfl_rails_config/templates/gemfiles/inherited_resources.rb
84
+ - lib/generators/dfl_rails_config/templates/gemfiles/kaminari.rb
85
+ - lib/generators/dfl_rails_config/templates/gemfiles/mandrill_api.rb
86
+ - lib/generators/dfl_rails_config/templates/gemfiles/mysql.rb
87
+ - lib/generators/dfl_rails_config/templates/gemfiles/nprogress_rails.rb
88
+ - lib/generators/dfl_rails_config/templates/gemfiles/rails_i18n.rb
89
+ - lib/generators/dfl_rails_config/templates/gemfiles/ransak.rb
90
+ - lib/generators/dfl_rails_config/templates/gemfiles/responders.rb
91
+ - lib/generators/dfl_rails_config/templates/gemfiles/rspec.rb
92
+ - lib/generators/dfl_rails_config/templates/gemfiles/simple_form.rb
93
+ - lib/generators/dfl_rails_config/templates/gemfiles/slim_rails.rb
94
+ - lib/generators/dfl_rails_config/templates/gemfiles/tools/annotate.rb
95
+ - lib/generators/dfl_rails_config/templates/gemfiles/tools/brakeman.rb
96
+ - lib/generators/dfl_rails_config/templates/gemfiles/tools/bump.rb
97
+ - lib/generators/dfl_rails_config/templates/gemfiles/tools/guard_livereload.rb
98
+ - lib/generators/dfl_rails_config/templates/gemfiles/tools/overcommit.rb
99
+ - lib/generators/dfl_rails_config/templates/gemfiles/tools/rails_best_practices.rb
100
+ - lib/generators/dfl_rails_config/templates/gemfiles/tools/rubocop.rb
101
+ - lib/generators/dfl_rails_config/templates/slim/scaffold/_form.html.slim
102
+ - lib/generators/dfl_rails_config/templates/slim/scaffold/edit.html.slim
103
+ - lib/generators/dfl_rails_config/templates/slim/scaffold/index.html.slim
104
+ - lib/generators/dfl_rails_config/templates/slim/scaffold/new.html.slim
105
+ - lib/generators/dfl_rails_config/templates/slim/scaffold/show.html.slim
106
+ homepage: https://github.com/dflourusso
107
+ licenses:
108
+ - MIT
109
+ metadata:
110
+ allowed_push_host: https://rubygems.org
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.4.5
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Prepare rails application for develop
131
+ test_files: []