eac_rails_base0 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +5 -5
  2. data/config/initializers/backport_pg_10_support_to_rails_4.rb +20 -17
  3. data/config/initializers/backtrace_silencers.rb +1 -0
  4. data/config/initializers/cookies_serializer.rb +1 -0
  5. data/config/initializers/filter_parameter_logging.rb +1 -0
  6. data/config/initializers/session_store.rb +1 -0
  7. data/config/initializers/wrap_parameters.rb +1 -0
  8. data/exe/eac_rails_base0_app +4 -2
  9. data/lib/eac_rails_base0/ability.rb +1 -0
  10. data/lib/eac_rails_base0/app_base/application.rb +1 -0
  11. data/lib/eac_rails_base0/app_generator/builder.rb +1 -0
  12. data/lib/eac_rails_base0/app_generator/generator.rb +1 -1
  13. data/lib/eac_rails_base0/app_generator/templates/app/controllers/application_controller.rb +1 -0
  14. data/lib/eac_rails_base0/app_generator/templates/bin/bundle +2 -1
  15. data/lib/eac_rails_base0/app_generator/templates/bin/rails +2 -1
  16. data/lib/eac_rails_base0/app_generator/templates/bin/rake +1 -0
  17. data/lib/eac_rails_base0/app_generator/templates/bin/setup +2 -1
  18. data/lib/eac_rails_base0/app_generator/templates/config/application.rb +1 -1
  19. data/lib/eac_rails_base0/app_generator/templates/config/boot.rb +1 -1
  20. data/lib/eac_rails_base0/app_generator/templates/config/environment.rb +1 -1
  21. data/lib/eac_rails_base0/app_generator/templates/config.ru +1 -0
  22. data/lib/eac_rails_base0/app_generator/templates/lib/local_plugins.rb +1 -0
  23. data/lib/eac_rails_base0/spec_helper/capybara.rb +1 -0
  24. data/lib/eac_rails_base0/spec_helper/eac_users_support.rb +1 -0
  25. data/lib/eac_rails_base0/spec_helper/factory_bot.rb +1 -0
  26. data/lib/eac_rails_base0/spec_helper.rb +1 -0
  27. data/lib/eac_rails_base0/version.rb +1 -1
  28. data/lib/generators/eac_rails_base0/abilities/abilities_generator.rb +1 -1
  29. data/lib/generators/eac_rails_base0/rspec/rspec_generator.rb +1 -1
  30. data/lib/generators/eac_rails_base0/rspec/templates/bin_rspec.rb +1 -1
  31. data/lib/generators/eac_rails_base0/rspec/templates/spec_rails_helper.rb +2 -1
  32. data/lib/generators/eac_rails_base0/rubocop/rubocop_generator.rb +1 -1
  33. data/lib/generators/eac_rails_base0_generator.rb +1 -1
  34. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: ca8d9a8a689385fb318e9f7dd744f1e3ef2acc0a3819a6d229b371eed51fc29c
4
- data.tar.gz: f724b0ed1729a83cf44a0b5e22be1f8bca8351ca241887c925da3a72a312dd79
2
+ SHA1:
3
+ metadata.gz: d5b75b84420f91fb7b110ad7503dcfa6b1628cc2
4
+ data.tar.gz: 54d4fd33dc9e8f4c8a679570d0775ca9c879e0b4
5
5
  SHA512:
6
- metadata.gz: 3c3b4a67e4e74921ada96361f75d4d68865c13dd50fd90085515193ab288282b3f1af2554ad21b78e023a8fb7327fe67edebbe1c5c24fe0da7919b474943f515
7
- data.tar.gz: 27347d249df9056f4499f646e0a597e82bfb71897b0d6a5757de75794e16514558c0d3e7390c98387f406a5929a9215a8e422a65a8262f00583ecf08b10498bd
6
+ metadata.gz: 3f692883bc6c66549431bcdb9f8ac04fc9051e10e62e7caadfad70160075c287134dd581b4810cbc44278fb828dccd64719d8a0cb45dfe3ca78a726bfa1c6ecd
7
+ data.tar.gz: 5a242ea3c7e6632fbb9b6a94e36c3e1705a54c903e2cb493c4098692c88aad240f67c7259713228c9789a027908857186d7fb576f1ee7572028680e9358ba4ea
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'active_record/connection_adapters/postgresql/schema_statements'
3
4
 
4
5
  #
@@ -12,25 +13,27 @@ module ActiveRecord
12
13
  module PostgreSQL
13
14
  module SchemaStatements
14
15
  # Resets the sequence of a table's primary key to the maximum value.
15
- def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:
16
- unless pk && sequence
16
+ def reset_pk_sequence!(table, pkey = nil, sequence = nil) #:nodoc:
17
+ unless pkey && sequence
17
18
  default_pk, default_sequence = pk_and_sequence_for(table)
18
- pk ||= default_pk
19
+ pkey ||= default_pk
19
20
  sequence ||= default_sequence
20
21
  end
21
- reset_pk_sequence_log(sequence, table, pk)
22
- return unless pk && sequence
23
- reset_pk_sequence_select_value(sequence, table, pk)
22
+ reset_pk_sequence_log(sequence, table, pkey)
23
+ return unless pkey && sequence
24
+
25
+ reset_pk_sequence_select_value(sequence, table, pkey)
24
26
  end
25
27
 
26
28
  private
27
29
 
28
- def reset_pk_sequence_max_pk(table, pk)
29
- select_value("SELECT MAX(#{quote_column_name pk}) FROM #{quote_table_name(table)}")
30
+ def reset_pk_sequence_max_pk(table, pkey)
31
+ select_value("SELECT MAX(#{quote_column_name pkey}) FROM #{quote_table_name(table)}")
30
32
  end
31
33
 
32
34
  def reset_pk_sequence_minvalue(max_pk, quoted_sequence)
33
35
  return nil unless max_pk.nil?
36
+
34
37
  if postgresql_version >= 100_000
35
38
  select_value('SELECT seqmin FROM pg_sequence WHERE seqrelid = ' \
36
39
  "#{quote(quoted_sequence)}::regclass")
@@ -39,19 +42,19 @@ module ActiveRecord
39
42
  end
40
43
  end
41
44
 
42
- def reset_pk_sequence_log(sequence, table, pk)
43
- if @logger && pk && !sequence
44
- @logger.warn "#{table} has primary key #{pk} with no default sequence"
45
- end
45
+ def reset_pk_sequence_log(sequence, table, pkey)
46
+ return unless @logger && pkey && !sequence
47
+
48
+ @logger.warn "#{table} has primary key #{pkey} with no default sequence"
46
49
  end
47
50
 
48
- def reset_pk_sequence_select_value(sequence, table, pk)
51
+ def reset_pk_sequence_select_value(sequence, table, pkey)
49
52
  quoted_sequence = quote_table_name(sequence)
50
- max_pk = reset_pk_sequence_max_pk(table, pk)
53
+ max_pk = reset_pk_sequence_max_pk(table, pkey)
51
54
  minvalue = reset_pk_sequence_minvalue(max_pk, quoted_sequence)
52
- select_value <<-end_sql, 'SCHEMA'
53
- SELECT setval(#{quote(quoted_sequence)}, #{max_pk ? max_pk : minvalue}, #{max_pk ? true : false})
54
- end_sql
55
+ select_value <<-END_SQL, 'SCHEMA'
56
+ SELECT setval(#{quote(quoted_sequence)}, #{max_pk || minvalue}, #{max_pk ? true : false})
57
+ END_SQL
55
58
  end
56
59
  end
57
60
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Be sure to restart your server when you modify this file.
3
4
 
4
5
  # You can add backtrace silencers for libraries that you're using but don't wish to see in your
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Be sure to restart your server when you modify this file.
3
4
 
4
5
  Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Be sure to restart your server when you modify this file.
3
4
 
4
5
  # Configure sensitive parameters which will be filtered from the log file.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Be sure to restart your server when you modify this file.
3
4
 
4
5
  Rails.application.config.session_store :cookie_store, key: '_ehb-utils_session'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Be sure to restart your server when you modify this file.
3
4
 
4
5
  # This file contains settings for ActionController::ParamsWrapper which
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require 'pathname'
3
5
 
4
6
  source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
@@ -7,9 +9,9 @@ $LOAD_PATH << source_path
7
9
  require 'eac_rails_base0/app_generator/generator'
8
10
 
9
11
  if ARGV.empty?
10
- puts "Please provide a path for the new application"
12
+ puts 'Please provide a path for the new application'
11
13
  puts
12
- puts "See --help for more info"
14
+ puts 'See --help for more info'
13
15
  exit 1
14
16
  elsif ['-v', '--version'].include? ARGV[0]
15
17
  puts Suspenders::VERSION
@@ -17,6 +17,7 @@ module EacRailsBase0
17
17
 
18
18
  def administrator_rules(user)
19
19
  return unless user.administrator?
20
+
20
21
  can :manage, ::EacUsersSupport::User
21
22
  end
22
23
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'rails/all'
3
4
 
4
5
  # Require the gems listed in Gemfile, including any gems
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module EacRailsBase0
3
4
  module AppGenerator
4
5
  class Builder < Rails::AppBuilder
@@ -15,7 +15,7 @@ module EacRailsBase0
15
15
 
16
16
  protected
17
17
 
18
- def get_builder_class # rubocop:disable Style/AccessorMethodName
18
+ def get_builder_class # rubocop:disable Naming/AccessorMethodName
19
19
  ::EacRailsBase0::AppGenerator::Builder
20
20
  end
21
21
  end
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class ApplicationController < ::EacRailsBase0::ApplicationController
3
4
  end
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4
5
  load Gem.bin_path('bundler', 'bundle')
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+
4
+ APP_PATH = File.expand_path('../config/application', __dir__)
4
5
  require_relative '../config/boot'
5
6
  require 'rails/commands'
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  require_relative '../config/boot'
4
5
  require 'rake'
5
6
  Rake.application.run
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  require 'pathname'
4
5
 
5
6
  # path to your application root.
6
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
7
+ APP_ROOT = Pathname.new File.expand_path('..', __dir__)
7
8
 
8
9
  Dir.chdir APP_ROOT do
9
10
  # This script is a starting point to setup your application.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  APP_PATH = ::File.dirname(__dir__) unless defined?(APP_PATH)
4
- require File.expand_path('../boot', __FILE__)
4
+ require File.expand_path('boot', __dir__)
5
5
  require 'eac_rails_base0/app_base/application.rb'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4
4
 
5
5
  require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Load the Rails application.
4
- require File.expand_path('../application', __FILE__)
4
+ require File.expand_path('application', __dir__)
5
5
 
6
6
  # Initialize the Rails application.
7
7
  Rails.application.initialize!
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # This file is used by Rack-based servers to start the application.
3
4
 
4
5
  require ::File.expand_path('../config/environment', __FILE__)
@@ -15,6 +15,7 @@ class LocalPlugins
15
15
  Dir.glob("#{root}/*/").each do |plugin_dir|
16
16
  next unless File.directory?(plugin_dir)
17
17
  next unless Dir.entries(plugin_dir).any? { |f| f.match(/\.gemspec/) }
18
+
18
19
  r << LocalPlugin.new(plugin_dir)
19
20
  end
20
21
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'capybara/rspec'
3
4
 
4
5
  RSpec.configure do |config|
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'devise'
3
4
 
4
5
  RSpec.configure do |config|
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'factory_bot_rails'
3
4
 
4
5
  RSpec.configure do |config|
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # This file was generated by the `rails generate rspec:install` command. Conventionally, all
3
4
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
4
5
  # The generated `.rspec` file contains `--require spec_helper` which will cause
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsBase0
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.0'
5
5
  end
@@ -5,7 +5,7 @@ module EacRailsBase0
5
5
  source_root File.expand_path('templates', __dir__)
6
6
 
7
7
  def copy_bin
8
- %w(ability ability_mapping).each do |base|
8
+ %w[ability ability_mapping].each do |base|
9
9
  copy_file "#{base}.rb", "lib/#{base}.rb"
10
10
  end
11
11
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module EacRailsBase0
4
4
  class RspecGenerator < Rails::Generators::Base
5
- source_root File.expand_path('../templates', __FILE__)
5
+ source_root File.expand_path('templates', __dir__)
6
6
 
7
7
  def create_initializer_files
8
8
  copy_file 'rspec.rc', '.rspec'
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
5
5
  system('bundle', 'exec', 'rspec', *ARGV)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  ENV['RAILS_ENV'] ||= 'test'
3
- require File.expand_path('../../config/environment', __FILE__)
4
+ require File.expand_path('../config/environment', __dir__)
4
5
  abort('The Rails environment is running in production mode!') if Rails.env.production?
5
6
  require 'rspec/rails'
6
7
  require 'eac_rails_base0/spec_helper'
@@ -10,7 +10,7 @@ module EacRailsBase0
10
10
 
11
11
  def copy_bin
12
12
  copy_file 'rubocop.rb', 'bin/rubocop'
13
- chmod 'bin', 0755 & ~File.umask, verbose: false
13
+ chmod 'bin', 0o755 & ~File.umask, verbose: false
14
14
  end
15
15
  end
16
16
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class EacRailsBase0Generator < Rails::Generators::Base
4
- SUB_GENERATORS = %w(abilities rspec rubocop).freeze
4
+ SUB_GENERATORS = %w[abilities rspec rubocop].freeze
5
5
 
6
6
  def run_other_generators
7
7
  SUB_GENERATORS.each do |generator|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_rails_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-04 00:00:00.000000000 Z
11
+ date: 2018-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-sass
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: 0.2.1
109
+ version: 0.2.3
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: 0.2.1
116
+ version: 0.2.3
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: factory_bot_rails
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -402,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
402
402
  version: '0'
403
403
  requirements: []
404
404
  rubyforge_project:
405
- rubygems_version: 2.7.7
405
+ rubygems_version: 2.6.14
406
406
  signing_key:
407
407
  specification_version: 4
408
408
  summary: A Rails base for multiple Rails projects developed by Esquilo Azul Company.