eivo-rails 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f02b1ae8c4ce69f94cb9b83278b66e08ebc95eb8
4
- data.tar.gz: 546d5981f2cdd574cccee8b89aca1d1af045a310
2
+ SHA256:
3
+ metadata.gz: b137163e46df269715630690d54f5f66d46edee3ab6b271d452439d26b072abf
4
+ data.tar.gz: fc5f72b1bd0ceadb79770bdbf7a8ee304715de2f3cb3a5d41637220d64b3d2bd
5
5
  SHA512:
6
- metadata.gz: 6fef5f71d2087d2aed03c1f01457b093795374b75b990480f939835221db50c788e1788815c32aaf406e5e11ccae24c25cd4a922dcebdde43322f417449e1061
7
- data.tar.gz: b33d8d6c4b633467c2b9f0816281a564ac3d39ca5bce69371e096035a304cab1bf3c1221efc833c4f9cddac1e679f2594138b0fdd4d6bef5337d0d47829a6f82
6
+ metadata.gz: '095feb37201cf1b8424dfcd2ad3c0b618184603b1c850387997fe514801a89aa847e7b83e16990f50a0e0f5e050b5bc84ee0d2e580db220ae997f18812641b5e'
7
+ data.tar.gz: 214f25661ec30acb204a7da6374bb728ed0d227341310d2d3581b8820a526220fab2b37d7c0ecb4ba4e63f8c92e6c179cdec75c0e9b02412a4c456272b518b6c
data/.gitignore CHANGED
@@ -2,3 +2,5 @@
2
2
  /.bundle/
3
3
  /pkg/
4
4
  Gemfile.lock
5
+ .ruby-version
6
+ .ruby-gemset
data/.rubocop.yml ADDED
@@ -0,0 +1,83 @@
1
+ require:
2
+ - rubocop-performance
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - lib/generators/eivo/templates/config/application.rb
7
+
8
+ Bundler/OrderedGems:
9
+ Enabled: false
10
+
11
+ Metrics/AbcSize:
12
+ Enabled: false
13
+
14
+ Metrics/BlockLength:
15
+ Enabled: false
16
+
17
+ Metrics/BlockNesting:
18
+ Enabled: false
19
+
20
+ Metrics/ClassLength:
21
+ Enabled: false
22
+
23
+ Metrics/CyclomaticComplexity:
24
+ Enabled: false
25
+
26
+ Metrics/LineLength:
27
+ Enabled: false
28
+
29
+ Metrics/MethodLength:
30
+ Enabled: false
31
+
32
+ Metrics/ModuleLength:
33
+ Enabled: false
34
+
35
+ Metrics/PerceivedComplexity:
36
+ Enabled: false
37
+
38
+ Naming/AccessorMethodName:
39
+ Enabled: false
40
+
41
+ Naming/PredicateName:
42
+ Enabled: false
43
+
44
+ Naming/VariableNumber:
45
+ EnforcedStyle: snake_case
46
+
47
+ Style/BracesAroundHashParameters:
48
+ EnforcedStyle: context_dependent
49
+
50
+ Style/Documentation:
51
+ Enabled: false
52
+
53
+ Style/GuardClause:
54
+ Enabled: false
55
+
56
+ Style/IfUnlessModifier:
57
+ Enabled: false
58
+
59
+ Style/Lambda:
60
+ EnforcedStyle: literal
61
+
62
+ Style/NegatedIf:
63
+ Enabled: false
64
+
65
+ Style/NumericPredicate:
66
+ EnforcedStyle: comparison
67
+
68
+ Style/RaiseArgs:
69
+ EnforcedStyle: compact
70
+
71
+ Style/RescueStandardError:
72
+ EnforcedStyle: implicit
73
+
74
+ Style/RedundantBegin:
75
+ Enabled: false
76
+
77
+ Style/SymbolArray:
78
+ EnforcedStyle: brackets
79
+
80
+ # Performance
81
+
82
+ Performance/ChainArrayAllocation:
83
+ Enabled: true
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  gemspec
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
@@ -2,10 +2,8 @@
2
2
 
3
3
  module EIVO
4
4
  class ApplicationController < ::ActionController::Base
5
-
6
5
  include EIVO::Concerns::Exception
7
6
 
8
7
  include HttpAcceptLanguage::AutoLocale
9
-
10
8
  end
11
9
  end
@@ -3,7 +3,6 @@
3
3
  module EIVO
4
4
  module Concerns
5
5
  module Exception
6
-
7
6
  extend ::ActiveSupport::Concern
8
7
 
9
8
  included do
@@ -17,7 +16,6 @@ module EIVO
17
16
  request_id: request.request_id
18
17
  )
19
18
  end
20
-
21
19
  end
22
20
  end
23
- end
21
+ end
@@ -46,8 +46,8 @@ module EIVO
46
46
  redirect_to action: :index
47
47
  end
48
48
 
49
- protected
50
-
49
+ protected
50
+
51
51
  def collection
52
52
  raise NotImplementedError
53
53
  end
@@ -63,7 +63,6 @@ module EIVO
63
63
  def object_params_update
64
64
  object_params
65
65
  end
66
-
67
66
  end
68
67
  end
69
68
  end
@@ -50,8 +50,8 @@ module EIVO
50
50
  redirect_to action: :index
51
51
  end
52
52
 
53
- protected
54
-
53
+ protected
54
+
55
55
  def collection
56
56
  raise NotImplementedError
57
57
  end
@@ -71,7 +71,6 @@ module EIVO
71
71
  def object_params_update
72
72
  object_params
73
73
  end
74
-
75
74
  end
76
75
  end
77
76
  end
@@ -2,10 +2,8 @@
2
2
 
3
3
  module EIVO
4
4
  class StatusController < ApplicationController
5
-
6
5
  def index
7
6
  head :ok
8
7
  end
9
-
10
8
  end
11
9
  end
data/bin/eivo CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'eivo-rails/cli'
4
5
 
@@ -3,7 +3,7 @@
3
3
  require 'raven'
4
4
 
5
5
  Raven.configure do |config|
6
- config.environments = %w[ staging production ]
6
+ config.environments = %w[staging production]
7
7
  config.dsn = Rails.application.credentials.dig(:sentry, :dsn)
8
8
  config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
9
9
 
data/config/routes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- EIVO::Engine.routes.draw do
3
+ EIVO::Engine.routes.draw do
4
4
  scope module: 'eivo' do
5
5
  get :status, to: 'status#index'
6
6
  end
data/eivo-rails.gemspec CHANGED
@@ -1,8 +1,10 @@
1
- $:.push File.expand_path("../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
2
4
 
3
5
  Gem::Specification.new do |spec|
4
6
  spec.name = 'eivo-rails'
5
- spec.version = '0.0.4'
7
+ spec.version = '0.0.5'
6
8
  spec.authors = ['Jonathan VUKOVICH-TRIBOUHARET']
7
9
  spec.email = ['jonathan@eivo.co']
8
10
 
@@ -11,7 +13,7 @@ Gem::Specification.new do |spec|
11
13
  spec.homepage = 'https://www.eivo.co'
12
14
  spec.license = 'MIT'
13
15
 
14
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
16
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
15
17
  `git ls-files -z`.split("\x0")
16
18
  end
17
19
  spec.executables << 'eivo'
@@ -19,11 +21,13 @@ Gem::Specification.new do |spec|
19
21
 
20
22
  spec.add_dependency 'thor'
21
23
 
22
- spec.add_dependency 'oj'
23
24
  spec.add_dependency 'multi_json'
25
+ spec.add_dependency 'oj'
24
26
 
25
27
  spec.add_dependency 'sentry-raven'
26
28
 
27
29
  spec.add_development_dependency 'bundler'
28
30
  spec.add_development_dependency 'rake'
31
+ spec.add_development_dependency 'rubocop'
32
+ spec.add_development_dependency 'rubocop-performance'
29
33
  end
@@ -1,12 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
 
3
5
  module EIVO
4
6
  class CLI < Thor
5
-
6
7
  desc 'install', 'Initialize default files'
7
8
  def install(args = nil)
8
9
  system("rails g eivo:install #{args}")
9
10
  end
10
-
11
11
  end
12
12
  end
@@ -51,7 +51,7 @@ module EIVO
51
51
  config.log_level = :debug
52
52
 
53
53
  # Prepend all log lines with the following tags.
54
- config.log_tags = [ :request_id ]
54
+ config.log_tags = [:request_id]
55
55
 
56
56
  # Use a different cache store in production.
57
57
  # config.cache_store = :mem_cache_store
@@ -74,7 +74,7 @@ module EIVO
74
74
  # require 'syslog/logger'
75
75
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
76
76
 
77
- if ENV["RAILS_LOG_TO_STDOUT"].present?
77
+ if ENV['RAILS_LOG_TO_STDOUT'].present?
78
78
  logger = ActiveSupport::Logger.new(STDOUT)
79
79
  logger.formatter = config.log_formatter
80
80
  config.logger = ActiveSupport::TaggedLogging.new(logger)
@@ -6,7 +6,7 @@ module EIVO
6
6
  class InstallGenerator < Rails::Generators::Base
7
7
  include Rails::Generators::Migration
8
8
 
9
- source_root File.expand_path('../templates', __FILE__)
9
+ source_root File.expand_path('templates', __dir__)
10
10
 
11
11
  def self.namespace(name = nil)
12
12
  @namespace ||= super.sub('e_i_v_o', 'eivo')
@@ -27,6 +27,7 @@ module EIVO
27
27
  copy_file 'Procfile'
28
28
  copy_file '.env.example'
29
29
  copy_file '.ruby-version'
30
+ copy_file '.rubocop.yml'
30
31
 
31
32
  create_restart_files
32
33
 
@@ -46,35 +47,36 @@ module EIVO
46
47
  end
47
48
 
48
49
  def create_restart_files
49
- restart_code = <<-'EOF'
50
- ### EIVO begin ###
50
+ restart_code = <<~'EIVO_COMMAND'
51
+ ### EIVO begin ###
51
52
 
52
- bundle exec rails assets:precompile
53
- bundle exec pumactl -F config/puma.rb restart
53
+ bundle exec rails assets:precompile
54
+ bundle exec pumactl -F config/puma.rb restart
54
55
 
55
- ### EIVO end ###
56
- EOF
56
+ ### EIVO end ###
57
+ EIVO_COMMAND
57
58
 
58
- stop_code = <<-'EOF'
59
- ### EIVO begin ###
59
+ stop_code = <<~'EIVO_COMMAND'
60
+ ### EIVO begin ###
60
61
 
61
- bundle exec pumactl -F config/puma.rb stop
62
+ bundle exec pumactl -F config/puma.rb stop
62
63
 
63
- ### EIVO end ###
64
- EOF
64
+ ### EIVO end ###
65
+ EIVO_COMMAND
65
66
 
66
- header_production = <<-'EOF'
67
- #!/usr/bin/env bash
68
- export RACK_ENV="production"
69
- export RAILS_ENV="production"
67
+ header_production = <<~'EIVO_COMMAND'
68
+ #!/usr/bin/env bash
69
+ export RACK_ENV="production"
70
+ export RAILS_ENV="production"
70
71
 
71
- EOF
72
- header_staging = <<-'EOF'
73
- #!/usr/bin/env bash
74
- export RACK_ENV="staging"
75
- export RAILS_ENV="staging"
72
+ EIVO_COMMAND
76
73
 
77
- EOF
74
+ header_staging = <<~'EIVO_COMMAND'
75
+ #!/usr/bin/env bash
76
+ export RACK_ENV="staging"
77
+ export RAILS_ENV="staging"
78
+
79
+ EIVO_COMMAND
78
80
 
79
81
  create_file 'restart_production.sh', header_production, skip: true
80
82
  create_file 'stop_production.sh', header_production, skip: true
@@ -94,11 +96,10 @@ EOF
94
96
  inject_into_file 'restart_staging.sh', restart_code, after: header_staging
95
97
  inject_into_file 'stop_staging.sh', stop_code, after: header_staging
96
98
 
97
- chmod 'restart_production.sh', 0755
98
- chmod 'stop_production.sh', 0755
99
- chmod 'restart_staging.sh', 0755
100
- chmod 'stop_staging.sh', 0755
99
+ chmod 'restart_production.sh', 0o755
100
+ chmod 'stop_production.sh', 0o755
101
+ chmod 'restart_staging.sh', 0o755
102
+ chmod 'stop_staging.sh', 0o755
101
103
  end
102
-
103
104
  end
104
105
  end
@@ -0,0 +1,108 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rails
4
+
5
+ AllCops:
6
+ Exclude:
7
+ - bin/*
8
+ - db/schema.rb
9
+ - spec/rails_helper.rb
10
+ - spec/spec_helper.rb
11
+
12
+ Bundler/OrderedGems:
13
+ Enabled: false
14
+
15
+ Metrics/AbcSize:
16
+ Enabled: false
17
+
18
+ Metrics/BlockLength:
19
+ Enabled: false
20
+
21
+ Metrics/BlockNesting:
22
+ Enabled: false
23
+
24
+ Metrics/ClassLength:
25
+ Enabled: false
26
+
27
+ Metrics/CyclomaticComplexity:
28
+ Enabled: false
29
+
30
+ Metrics/LineLength:
31
+ Enabled: false
32
+
33
+ Metrics/MethodLength:
34
+ Enabled: false
35
+
36
+ Metrics/ModuleLength:
37
+ Enabled: false
38
+
39
+ Metrics/PerceivedComplexity:
40
+ Enabled: false
41
+
42
+ Naming/AccessorMethodName:
43
+ Enabled: false
44
+
45
+ Naming/PredicateName:
46
+ Enabled: false
47
+
48
+ Naming/VariableNumber:
49
+ EnforcedStyle: snake_case
50
+
51
+ Style/BracesAroundHashParameters:
52
+ EnforcedStyle: context_dependent
53
+
54
+ Style/Documentation:
55
+ Enabled: false
56
+
57
+ Style/GuardClause:
58
+ Enabled: false
59
+
60
+ Style/IfUnlessModifier:
61
+ Enabled: false
62
+
63
+ Style/Lambda:
64
+ EnforcedStyle: literal
65
+
66
+ Style/NegatedIf:
67
+ Enabled: false
68
+
69
+ Style/NumericPredicate:
70
+ EnforcedStyle: comparison
71
+
72
+ Style/RaiseArgs:
73
+ EnforcedStyle: compact
74
+
75
+ Style/RescueStandardError:
76
+ EnforcedStyle: implicit
77
+
78
+ Style/RedundantBegin:
79
+ Enabled: false
80
+
81
+ Style/SymbolArray:
82
+ EnforcedStyle: brackets
83
+
84
+ # Performance
85
+
86
+ Performance/ChainArrayAllocation:
87
+ Enabled: true
88
+
89
+ # Rails
90
+
91
+ Rails/BulkChangeTable:
92
+ Enabled: false
93
+
94
+ Rails/NotNullColumn:
95
+ Enabled: false
96
+
97
+ Rails/ReversibleMigration:
98
+ Enabled: false
99
+
100
+ Rails/SkipsModelValidations:
101
+ Enabled: false
102
+
103
+ Rails/UnknownEnv:
104
+ Environments:
105
+ - development
106
+ - test
107
+ - staging
108
+ - production
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
5
 
@@ -27,8 +29,10 @@ group :development, :test do
27
29
  gem 'faker'
28
30
  gem 'rspec-rails'
29
31
  gem 'brakeman'
30
- gem 'rubocop'
31
- gem 'rubocop-rspec'
32
+ gem 'rubocop', require: false
33
+ gem 'rubocop-rails', require: false
34
+ gem 'rubocop-performance', require: false
35
+ gem 'rubocop-rspec', require: false
32
36
  gem 'webmock'
33
37
  end
34
38
 
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ApplicationController < EIVO::ApplicationController
2
4
  end
@@ -4,9 +4,9 @@ workers ENV.fetch('WEB_CONCURRENCY') { 0 }
4
4
  threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
5
5
  threads threads_count, threads_count
6
6
 
7
- environment ENV.fetch('RAILS_ENV') { "development" }
7
+ environment ENV.fetch('RAILS_ENV') { 'development' }
8
8
 
9
- if ['production', 'staging'].include?(ENV['RAILS_ENV'])
9
+ if %w[production staging].include?(ENV['RAILS_ENV'])
10
10
  bind 'unix://tmp/sockets/puma.sock'
11
11
  pidfile 'tmp/pids/puma.pid'
12
12
  state_path 'tmp/pids/puma.state'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eivo-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan VUKOVICH-TRIBOUHARET
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-13 00:00:00.000000000 Z
11
+ date: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: oj
28
+ name: multi_json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: multi_json
42
+ name: oj
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-performance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  description: EIVO Rails
98
126
  email:
99
127
  - jonathan@eivo.co
@@ -103,6 +131,7 @@ extensions: []
103
131
  extra_rdoc_files: []
104
132
  files:
105
133
  - ".gitignore"
134
+ - ".rubocop.yml"
106
135
  - Gemfile
107
136
  - LICENSE
108
137
  - README.md
@@ -126,6 +155,7 @@ files:
126
155
  - lib/generators/eivo/USAGE
127
156
  - lib/generators/eivo/install_generator.rb
128
157
  - lib/generators/eivo/templates/.env.example
158
+ - lib/generators/eivo/templates/.rubocop.yml
129
159
  - lib/generators/eivo/templates/.ruby-version
130
160
  - lib/generators/eivo/templates/Gemfile
131
161
  - lib/generators/eivo/templates/Procfile
@@ -156,8 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
186
  - !ruby/object:Gem::Version
157
187
  version: '0'
158
188
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 2.4.5
189
+ rubygems_version: 3.0.3
161
190
  signing_key:
162
191
  specification_version: 4
163
192
  summary: EIVO Rails