jt_tools 0.0.2 → 0.0.3

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +12 -2
  3. data/.github/FUNDING.yml +4 -0
  4. data/README.md +19 -10
  5. data/_config.yml +2 -1
  6. data/bin/test +17 -5
  7. data/jt_tools.gemspec +1 -1
  8. data/lib/install/.circleci/{config.yml.sample → config.yml} +88 -19
  9. data/lib/install/.dependabot/config.yml +3 -3
  10. data/lib/install/.editorconfig +301 -0
  11. data/lib/install/.erb-lint.yml +2 -2
  12. data/lib/install/.eslintrc.js +8 -11
  13. data/lib/install/.pronto.yml +3 -5
  14. data/lib/install/.reek.yml +3 -6
  15. data/lib/install/.rubocop.yml +22 -19
  16. data/lib/install/.simplecov +17 -0
  17. data/lib/install/{.yamllint → .yamllint.yml} +2 -1
  18. data/lib/install/Brewfile +6 -2
  19. data/lib/install/Gemfile.tools +2 -2
  20. data/lib/install/app.json +17 -46
  21. data/lib/install/bin/git-hooks/post-merge.sample +0 -9
  22. data/lib/install/bin/git-hooks/pre-push.sample +1 -1
  23. data/lib/install/bin/heroku-postdeploy +1 -7
  24. data/lib/install/bin/heroku-release +4 -1
  25. data/lib/install/bin/{lint-github-pr → lint-pr} +0 -0
  26. data/lib/install/bin/tools-setup +1 -1
  27. data/lib/install/bin/tools-upgrade +2 -0
  28. data/lib/install/codecov.yml +5 -4
  29. data/lib/install/config/rails_best_practices.yml +43 -0
  30. data/lib/jt_tools/railtie.rb +2 -0
  31. data/lib/{version.rb → jt_tools/version.rb} +1 -1
  32. data/lib/jt_tools.rb +2 -0
  33. data/lib/tasks/install.rake +3 -1
  34. data/template.rb +36 -17
  35. metadata +11 -12
  36. data/_sample/test_erb.html.erb +0 -2
  37. data/_sample/test_eslint.js +0 -1
  38. data/_sample/test_yamlint.yml +0 -1
  39. data/lib/install/.prettierrc.js +0 -4
  40. data/lib/install/lib/test/coverage.rb +0 -14
@@ -1 +1,4 @@
1
- bin/rake db:migrate
1
+ #!/usr/bin/env bash
2
+
3
+ echo "== Update Database =="
4
+ bin/rake db:prepare
File without changes
@@ -6,4 +6,4 @@ export BUNDLE_GEMFILE=Gemfile.tools
6
6
 
7
7
  bundle check || bundle install --jobs=4 --retry=3
8
8
 
9
- yarn install --link-duplicates --non-interactive
9
+ yarn check || yarn install
@@ -5,3 +5,5 @@ set -e
5
5
  export BUNDLE_GEMFILE=Gemfile.tools
6
6
 
7
7
  bundle update --jobs=4 --retry=3
8
+
9
+ yarn check || yarn install
@@ -1,8 +1,9 @@
1
+ ---
1
2
  codecov:
2
3
  notify:
3
- require_ci_to_pass: yes
4
+ require_ci_to_pass: true
4
5
 
5
6
  comment:
6
- layout: diff, flags, files
7
- behavior: once
8
- require_changes: no
7
+ layout: 'diff, flags, files'
8
+ behavior: 'once'
9
+ require_changes: false
@@ -0,0 +1,43 @@
1
+ ---
2
+ AddModelVirtualAttributeCheck:
3
+ AlwaysAddDbIndexCheck: {}
4
+ # CheckSaveReturnValueCheck: {}
5
+ # CheckDestroyReturnValueCheck: {}
6
+ DefaultScopeIsEvilCheck: {}
7
+ DryBundlerInCapistranoCheck: {}
8
+ # HashSyntaxCheck: {}
9
+ IsolateSeedDataCheck: {}
10
+ KeepFindersOnTheirOwnModelCheck: {}
11
+ LawOfDemeterCheck: {}
12
+ # LongLineCheck: { max_line_length: 80 }
13
+ MoveCodeIntoControllerCheck: {}
14
+ MoveCodeIntoHelperCheck: { array_count: 3 }
15
+ MoveCodeIntoModelCheck: { use_count: 2 }
16
+ MoveFinderToNamedScopeCheck: {}
17
+ MoveModelLogicIntoModelCheck: { use_count: 4 }
18
+ NeedlessDeepNestingCheck: { nested_count: 2 }
19
+ NotRescueExceptionCheck: {}
20
+ NotUseDefaultRouteCheck: {}
21
+ NotUseTimeAgoInWordsCheck: {}
22
+ OveruseRouteCustomizationsCheck: { customize_count: 3 }
23
+ ProtectMassAssignmentCheck: {}
24
+ RemoveEmptyHelpersCheck: {}
25
+ # RemoveTabCheck: {}
26
+ RemoveTrailingWhitespaceCheck: {}
27
+ # RemoveUnusedMethodsInControllersCheck: { except_methods: [] }
28
+ # RemoveUnusedMethodsInHelpersCheck: { except_methods: [] }
29
+ # RemoveUnusedMethodsInModelsCheck: { except_methods: [] }
30
+ ReplaceComplexCreationWithFactoryMethodCheck: { attribute_assignment_count: 2 }
31
+ ReplaceInstanceVariableWithLocalVariableCheck: {}
32
+ RestrictAutoGeneratedRoutesCheck: {}
33
+ SimplifyRenderInControllersCheck: {}
34
+ SimplifyRenderInViewsCheck: {}
35
+ # UseBeforeFilterCheck: { customize_count: 2 }
36
+ UseModelAssociationCheck: {}
37
+ UseMultipartAlternativeAsContentTypeOfEmailCheck: {}
38
+ # UseParenthesesInMethodDefCheck: {}
39
+ UseObserverCheck: {}
40
+ UseQueryAttributeCheck: {}
41
+ UseSayWithTimeInMigrationsCheck: {}
42
+ UseScopeAccessCheck: {}
43
+ UseTurboSprocketsRails3Check: {}
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/railtie'
2
4
 
3
5
  class JtToolsRailtie < Rails::Railtie
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JtTools
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
data/lib/jt_tools.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'r2m/version'
4
+
3
5
  require 'jt_tools/railtie' if defined?(Rails)
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  install_template_path = File.expand_path('../../template.rb', __dir__).freeze
2
4
  bin_path = ENV['BUNDLE_BIN'] || './bin'
3
5
 
4
6
  namespace :jt_tools do
5
7
  desc 'Install jt-tools in this application'
6
- task :install do
8
+ task install: :environment do
7
9
  exec "#{RbConfig.ruby} #{bin_path}/rails app:template LOCATION=#{install_template_path}"
8
10
  end
9
11
  end
data/template.rb CHANGED
@@ -37,43 +37,53 @@ chmod 'bin', 0o755 & ~File.umask, verbose: false
37
37
  say '=> Copying tools gemfile'
38
38
  copy_file 'lib/install/Gemfile.tools', 'Gemfile.tools'
39
39
 
40
- run 'yarn add -D eslint eslint-config-airbnb-base \
41
- eslint-config-prettier eslint-plugin-import eslint-plugin-prettier prettier'
40
+ run 'yarn add -D eslint'
42
41
 
43
42
  say 'Copying lint configurations'
44
43
  copy_file 'lib/install/.better-html.yml', '.better-html.yml'
45
44
  copy_file 'lib/install/.erb-lint.yml', '.erb-lint.yml'
46
45
  copy_file 'lib/install/.eslintrc.js', '.eslintrc.js'
47
- copy_file 'lib/install/.prettierrc.js', '.prettierrc.js'
48
46
  copy_file 'lib/install/.pronto.yml', '.pronto.yml'
49
47
  copy_file 'lib/install/.pronto_eslint_npm.yml', '.pronto_eslint_npm.yml'
50
48
  copy_file 'lib/install/.rubocop.yml', '.rubocop.yml'
51
- copy_file 'lib/install/.yamllint', '.yamllint'
49
+ copy_file 'lib/install/.yamllint.yml', '.yamllint.yml'
52
50
  copy_file 'lib/install/.reek.yml', '.reek.yml'
51
+ copy_file 'lib/install/config/rails_best_practices.yml', 'config/rails_best_practices.yml'
52
+ copy_file 'lib/install/.editorconfig', '.editorconfig'
53
53
 
54
54
  say '=> Copying services configuration'
55
- gem 'simplecov', require: false, group: :test
56
-
55
+ copy_file 'lib/install/.simplecov', '.simplecov'
57
56
  copy_file 'lib/install/codecov.yml', 'codecov.yml'
58
- gem 'codecov', require: false, group: :test
59
57
 
60
- directory 'lib/install/.circleci', '.circleci'
61
58
 
62
- # Add helpers to setup Simplecov and codecov loading for tests
63
- directory 'lib/install/lib/test', 'lib/test'
59
+ say '=> Adds service client API gems'
60
+
61
+ gem_group :test do
62
+ gem 'simplecov', require: false, group: :test
63
+ gem 'codecov', require: false, group: :test
64
+ end
65
+
66
+ gem 'oj'
67
+
68
+ gem_group :production, :staging do
69
+ gem 'rollbar'
70
+ gem 'le'
71
+ end
72
+
73
+ directory 'lib/install/.circleci', '.circleci'
64
74
 
65
75
  if File.read('Gemfile').include? 'rspec'
66
76
  gem 'rspec_junit_formatter', require: false, group: :test
67
77
  insert_into_file(
68
78
  'spec/spec_helper.rb',
69
- "require 'test/coverage'\n",
79
+ "require 'simplecov' if ENV['COVERAGE']\n",
70
80
  after: /\A/
71
81
  )
72
82
  else
73
83
  gem 'minitest-ci', require: false, group: :test
74
84
  insert_into_file(
75
85
  'test/test_helper.rb',
76
- "require 'test/coverage'\n",
86
+ "require 'simplecov' if ENV['COVERAGE']\n",
77
87
  after: /\A/
78
88
  )
79
89
  end
@@ -96,8 +106,8 @@ Bundler.with_original_env do
96
106
  run 'bin/tools-setup'
97
107
 
98
108
  say '=> Generate binstubs for linters'
99
- run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub pronto'
100
- run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub rubocop'
109
+ run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force pronto'
110
+ run 'BUNDLE_GEMFILE=Gemfile.tools bundle binstub --force rubocop'
101
111
  end
102
112
 
103
113
  say '=> Set git hooks'
@@ -110,6 +120,9 @@ run <<~BREW_INSTALL
110
120
  || echo "Please install Homebrew: https://brew.sh/"
111
121
  BREW_INSTALL
112
122
 
123
+ say '=> Update development config'
124
+ uncomment_lines 'config/environments/development.rb', /config\.file_watcher = ActiveSupport::EventedFileUpdateChecker/
125
+
113
126
  after_bundle do
114
127
  say '=> Setup default bundle config'
115
128
  run 'bundle config jobs 4'
@@ -119,11 +132,17 @@ end
119
132
  say '**************************************************************************'
120
133
  say '**************************************************************************'
121
134
  say ''
122
- say 'For code coverage report aggregator, running code static analysis'
123
- say 'and auto-update of the tools.'
135
+ say '1. Recommended Heroku Addons: Mailtrap, Rollbar, Cloudinary'
124
136
  say ''
125
- say 'Please, set CODECOV_TOKEN, GITHUB_TOKEN and PRONTO_GITHUB_ACCESS_TOKEN'
137
+ say '2. Setup Git Hooks to auto-check code and cleanup staled branches'
138
+ say '$ `cp bin/git-hooks/pre-push.sample bin/git-hooks/pre-push`'
139
+ say '$ `cp bin/git-hooks/post-merge.sample bin/git-hooks/post-merge`'
140
+ say ''
141
+ say '3. Please, set CODECOV_TOKEN, GITHUB_TOKEN and PRONTO_GITHUB_ACCESS_TOKEN'
126
142
  say 'environment variables in CircleCI and your local env'
127
143
  say ''
144
+ say ' For code coverage report aggregator, running code static analysis'
145
+ say 'and auto-update of the tools.'
146
+ say ''
128
147
  say '**************************************************************************'
129
148
  say '**************************************************************************'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jt_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Keen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-19 00:00:00.000000000 Z
11
+ date: 2020-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -32,6 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - ".circleci/config.yml"
35
+ - ".github/FUNDING.yml"
35
36
  - ".github/ISSUE_TEMPLATE/bug_report.md"
36
37
  - ".github/ISSUE_TEMPLATE/custom.md"
37
38
  - ".github/ISSUE_TEMPLATE/feature_request.md"
@@ -42,22 +43,20 @@ files:
42
43
  - README.md
43
44
  - Rakefile
44
45
  - _config.yml
45
- - _sample/test_erb.html.erb
46
- - _sample/test_eslint.js
47
- - _sample/test_yamlint.yml
48
46
  - bin/test
49
47
  - jt_tools.gemspec
50
48
  - lib/install/.better-html.yml
51
- - lib/install/.circleci/config.yml.sample
49
+ - lib/install/.circleci/config.yml
52
50
  - lib/install/.dependabot/config.yml
51
+ - lib/install/.editorconfig
53
52
  - lib/install/.erb-lint.yml
54
53
  - lib/install/.eslintrc.js
55
- - lib/install/.prettierrc.js
56
54
  - lib/install/.pronto.yml
57
55
  - lib/install/.pronto_eslint_npm.yml
58
56
  - lib/install/.reek.yml
59
57
  - lib/install/.rubocop.yml
60
- - lib/install/.yamllint
58
+ - lib/install/.simplecov
59
+ - lib/install/.yamllint.yml
61
60
  - lib/install/Brewfile
62
61
  - lib/install/Gemfile.tools
63
62
  - lib/install/Procfile
@@ -67,15 +66,15 @@ files:
67
66
  - lib/install/bin/git-hooks/pre-push.sample
68
67
  - lib/install/bin/heroku-postdeploy
69
68
  - lib/install/bin/heroku-release
70
- - lib/install/bin/lint-github-pr
69
+ - lib/install/bin/lint-pr
71
70
  - lib/install/bin/tools-setup
72
71
  - lib/install/bin/tools-upgrade
73
72
  - lib/install/codecov.yml
74
- - lib/install/lib/test/coverage.rb
73
+ - lib/install/config/rails_best_practices.yml
75
74
  - lib/jt_tools.rb
76
75
  - lib/jt_tools/railtie.rb
76
+ - lib/jt_tools/version.rb
77
77
  - lib/tasks/install.rake
78
- - lib/version.rb
79
78
  - rejuvenation.rb
80
79
  - template.rb
81
80
  homepage: https://jtway.co
@@ -100,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
99
  - !ruby/object:Gem::Version
101
100
  version: '0'
102
101
  requirements: []
103
- rubygems_version: 3.1.1
102
+ rubygems_version: 3.1.3
104
103
  signing_key:
105
104
  specification_version: 4
106
105
  summary: Setup development scripts to manage code base effectively
@@ -1,2 +0,0 @@
1
- <a onclick="alert(<%= some_data %>)">
2
- <img <%= value %>>
@@ -1 +0,0 @@
1
- const longesssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst_var = 1;
@@ -1 +0,0 @@
1
- asdf: asdf
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- printWidth: 113,
3
- singleQuote: true
4
- };
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Autogenerated file
4
-
5
- if ENV['COVERAGE']
6
- require 'simplecov'
7
-
8
- SimpleCov.start 'rails'
9
-
10
- if ENV['CODECOV_TOKEN']
11
- require 'codecov'
12
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
13
- end
14
- end