merit 3.0.1 → 3.0.2

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: f485a4853da5aa06c851c133b85206b798755c41
4
- data.tar.gz: c148037a475f47d09b9a774da2fc8669ec016212
2
+ SHA256:
3
+ metadata.gz: b2cbaa14467c3e05f09615f1fccf0fb0b504246ed8e11320245d9c160f2f81c9
4
+ data.tar.gz: 940d31167c9bd59cd1ecaa96055cbf87f6e5bf6e7e1fbb3b433215b0d27d3291
5
5
  SHA512:
6
- metadata.gz: e43c8bb0a86b3d57adfeaa8816d566a8e9d4705d75a9ac926ce5e6dcc9c27eb1fd96bd145c353818275ea241a91475c9d3a7700f0d35d28532b1f54b794864c0
7
- data.tar.gz: 5f137da4113ebfb20f398fd733aa0b65285a3a8f6aa9758dae9536d13bab161fb2bef80da3d492468564cbaa9a933143343146b3dcd4f7d369a6022a6535cb44
6
+ metadata.gz: db2f9a9d70500a9e11985d7dd54d8fc5a891b69a940a72ce8fea8a465d733ae4ab1e197ad1eb11b50f6699321d9d55cffc36f5f1da2ad3c5deebb9d41414380c
7
+ data.tar.gz: 9230dda9fe83d1b137dd5105134b4ed41614d2323308a40ae87f98302931f1309e87f00a13c8f893b8dae8c732b4e23e7d22c3ec8353a49a83a465bfd852579c
data/Gemfile CHANGED
@@ -2,8 +2,12 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- version = ENV['RAILS_VERSION'] || '5.0.3'
6
- gem 'rails', version
5
+ version = ENV['RAILS_VERSION']
6
+ if version =~ /^5.2/
7
+ gem 'rails', github: "rails/rails", branch: "5-2-stable"
8
+ else
9
+ gem 'rails', version
10
+ end
7
11
 
8
12
  case ENV['ORM']
9
13
  when 'active_record'
@@ -14,15 +18,7 @@ end
14
18
 
15
19
  group :development, :test do
16
20
  gem 'activerecord-jdbcsqlite3-adapter', :platforms => [:jruby]
17
- gem 'sqlite3', '~> 1.3.8', :platforms => [:ruby, :mswin, :mingw]
18
- end
19
-
20
- platforms :rbx do
21
- gem 'rubysl', '~> 2.0'
22
- gem 'psych'
23
- gem 'racc'
24
- gem 'minitest', '~> 5.10', '!= 5.10.2'
25
- gem 'rubinius-developer_tools'
21
+ gem 'sqlite3'
26
22
  end
27
23
 
28
24
  gem 'coveralls', require: false
data/NEWS.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  User-visible changes worth mentioning.
4
4
 
5
+ ## 3.0.2
6
+
7
+ - [#287] Make Sash an optional dependency, fixing issues in Rails 5.1.
8
+ - [#297] Initialize merit once both for API or non-API apps
9
+ - Updates dependencies
10
+
5
11
  ## 3.0.1
6
12
 
7
13
  - [#282] Run action controller load hook only once
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ end
8
8
  require 'rake/testtask'
9
9
 
10
10
  desc 'Default: run tests for all ORMs.'
11
- task default: :test
11
+ task default: [:test, :api_test]
12
12
 
13
13
  Rake::TestTask.new(:test) do |t|
14
14
  t.libs << 'lib'
@@ -17,6 +17,14 @@ Rake::TestTask.new(:test) do |t|
17
17
  t.verbose = true
18
18
  end
19
19
 
20
+ Rake::TestTask.new(:api_test) do |t|
21
+ t.libs << 'lib'
22
+ t.libs << 'test'
23
+ t.test_files = FileList['test/**/*_test.rb'].exclude(/navigation_test.rb/)
24
+ t.verbose = true
25
+ t.options = '-- -api-only'
26
+ end
27
+
20
28
  begin
21
29
  require 'rdoc/task'
22
30
  Rake::RDocTask.new(:rdoc) do |rdoc|
@@ -82,7 +82,7 @@ module Merit
82
82
  initializer 'merit.controller' do |app|
83
83
  extend_orm_with_has_merit
84
84
  require_models
85
- ActiveSupport.on_load(:action_controller, run_once: true) do
85
+ ActiveSupport.on_load(action_controller_hook) do
86
86
  begin
87
87
  # Load app rules on boot up
88
88
  Merit::AppBadgeRules = Merit::BadgeRules.new.defined_rules
@@ -113,5 +113,13 @@ module Merit
113
113
  Mongoid::Document.send :include, Merit
114
114
  end
115
115
  end
116
+
117
+ def action_controller_hook
118
+ if Rails.application.config.api_only
119
+ :action_controller_api
120
+ else
121
+ :action_controller_base
122
+ end
123
+ end
116
124
  end
117
125
  end
@@ -7,7 +7,7 @@ module Merit
7
7
  # That's why MeritableModel belongs_to Sash. Can't use
8
8
  # dependent: destroy as it may raise FK constraint exceptions. See:
9
9
  # https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1079-belongs_to-dependent-destroy-should-destroy-self-before-assocation
10
- belongs_to :sash, class_name: 'Merit::Sash', inverse_of: nil
10
+ belongs_to :sash, class_name: 'Merit::Sash', inverse_of: nil, optional: true
11
11
  attr_accessible :sash if show_attr_accessible?
12
12
 
13
13
  send :"_merit_#{Merit.orm}_specific_config"
@@ -3,7 +3,7 @@ module Merit
3
3
  self.table_name = :merit_activity_logs
4
4
 
5
5
  belongs_to :action, class_name: 'Merit::Action'
6
- belongs_to :related_change, polymorphic: true
6
+ belongs_to :related_change, polymorphic: true, optional: true
7
7
  has_one :sash, through: :related_change
8
8
 
9
9
  if show_attr_accessible?
@@ -6,17 +6,17 @@ Gem::Specification.new do |s|
6
6
  s.files = `git ls-files`.split("\n").reject{|f| f =~ /^\./ }
7
7
  s.test_files = `git ls-files -- test/*`.split("\n")
8
8
  s.license = 'MIT'
9
- s.version = '3.0.1'
9
+ s.version = '3.0.2'
10
10
  s.authors = ["Tute Costa"]
11
11
  s.email = 'tutecosta@gmail.com'
12
12
 
13
- s.required_ruby_version = '>= 2.2.2'
13
+ s.required_ruby_version = '>= 2.3.0'
14
14
 
15
15
  s.add_dependency 'ambry', '~> 1.0.0'
16
- s.add_development_dependency 'rails', '>= 5.0.0'
16
+ s.add_development_dependency 'rails', '>= 5.1.6'
17
17
  s.add_development_dependency 'capybara'
18
18
  s.add_development_dependency 'simplecov'
19
19
  s.add_development_dependency 'rubocop'
20
20
  s.add_development_dependency 'minitest-rails'
21
- s.add_development_dependency 'mocha', '1.1.0'
21
+ s.add_development_dependency 'mocha'
22
22
  end
@@ -11,18 +11,12 @@ require "merit"
11
11
 
12
12
  module Dummy
13
13
  class Application < Rails::Application
14
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
15
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
16
- # config.i18n.default_locale = :de
17
- # config.active_record.whitelist_attributes = true
14
+ if Rails.version >= "5.2"
15
+ config.active_record.sqlite3.represent_boolean_as_integer = true
16
+ end
18
17
 
19
- # http://stackoverflow.com/questions/20361428/rails-i18n-validation-deprecation-warning
20
18
  config.i18n.enforce_available_locales = true
21
-
22
- # Configure the default encoding used in templates for Ruby 1.9.
23
19
  config.encoding = "utf-8"
24
-
25
- # Configure sensitive parameters which will be filtered from the log file.
26
20
  config.filter_parameters += [:password]
27
21
  end
28
22
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "boot"
4
+
5
+ require "rails"
6
+ # Pick the frameworks you want:
7
+ require "active_model/railtie"
8
+ require "active_record/railtie"
9
+ require "action_controller/railtie"
10
+ require "action_view/railtie"
11
+ require "action_mailer/railtie"
12
+
13
+ # require "sprockets/railtie"
14
+ require "rails/test_unit/railtie"
15
+
16
+ # Require the gems listed in Gemfile, including any gems
17
+ # you've limited to :test, :development, or :production.
18
+ Bundler.require
19
+ require "merit"
20
+
21
+ module Dummy
22
+ class Application < Rails::Application
23
+ config.load_defaults 5.2 if ENV["RAILS_VERSION"] =~ /^5.2/
24
+ config.api_only = true
25
+ config.i18n.enforce_available_locales = true
26
+ config.encoding = "utf-8"
27
+ end
28
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the rails application
4
+ require File.expand_path("application_api_only", __dir__)
5
+
6
+ # Initialize the rails application
7
+ Dummy::Application.initialize!
@@ -0,0 +1,3 @@
1
+ if Rails.version >= "5.1"
2
+ Rails.application.config.active_record.belongs_to_required_by_default = true
3
+ end
@@ -1,2 +1,8 @@
1
1
  # Place orm-dependent test preparation here
2
- ActiveRecord::Migrator.migrate File.expand_path("../../dummy/db/migrate/", __FILE__)
2
+ migrations = File.expand_path("../../dummy/db/migrate/", __FILE__)
3
+
4
+ if Rails.version >= "5.2"
5
+ ActiveRecord::MigrationContext.new(migrations).migrate
6
+ else
7
+ ActiveRecord::Migrator.migrate migrations
8
+ end
@@ -1,6 +1,6 @@
1
1
  # Configure Rails Envinronment
2
2
  ENV['RAILS_ENV'] = 'test'
3
- RUBYOPT="-w $RUBYOPT"
3
+ RUBYOPT = "-w $RUBYOPT".freeze
4
4
 
5
5
  if ENV["COVERAGE"]
6
6
  require 'coveralls'
@@ -18,10 +18,15 @@ if ENV["COVERAGE"]
18
18
  SimpleCov.start 'rubygem'
19
19
  end
20
20
 
21
- require File.expand_path('../dummy/config/environment.rb', __FILE__)
22
- require 'rails/test_help'
23
- require 'minitest/rails'
24
- require 'mocha/mini_test'
21
+ if ARGV.include?("-api-only")
22
+ require File.expand_path("dummy/config/environment_api_only.rb", __dir__)
23
+ else
24
+ require File.expand_path("dummy/config/environment.rb", __dir__)
25
+ end
26
+
27
+ require "rails/test_help"
28
+ require "minitest/rails"
29
+ require "mocha/minitest"
25
30
  require "orm/#{Merit.orm}"
26
31
 
27
32
  Rails.backtrace_cleaner.remove_silencers!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tute Costa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-25 00:00:00.000000000 Z
11
+ date: 2018-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ambry
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 5.0.0
33
+ version: 5.1.6
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 5.0.0
40
+ version: 5.1.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: capybara
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: mocha
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.1.0
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.1.0
110
+ version: '0'
111
111
  description: Manage badges, points and rankings (reputation) in your Rails app.
112
112
  email: tutecosta@gmail.com
113
113
  executables: []
@@ -203,9 +203,11 @@ files:
203
203
  - test/dummy/app/views/users/show.html.erb
204
204
  - test/dummy/config.ru
205
205
  - test/dummy/config/application.rb
206
+ - test/dummy/config/application_api_only.rb
206
207
  - test/dummy/config/boot.rb
207
208
  - test/dummy/config/database.yml
208
209
  - test/dummy/config/environment.rb
210
+ - test/dummy/config/environment_api_only.rb
209
211
  - test/dummy/config/environments/development.rb
210
212
  - test/dummy/config/environments/production.rb
211
213
  - test/dummy/config/environments/test.rb
@@ -213,6 +215,7 @@ files:
213
215
  - test/dummy/config/initializers/inflections.rb
214
216
  - test/dummy/config/initializers/merit.rb
215
217
  - test/dummy/config/initializers/mime_types.rb
218
+ - test/dummy/config/initializers/new_framework_defaults.rb
216
219
  - test/dummy/config/initializers/secret_token.rb
217
220
  - test/dummy/config/initializers/session_store.rb
218
221
  - test/dummy/config/locales/en.yml
@@ -274,7 +277,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
274
277
  requirements:
275
278
  - - ">="
276
279
  - !ruby/object:Gem::Version
277
- version: 2.2.2
280
+ version: 2.3.0
278
281
  required_rubygems_version: !ruby/object:Gem::Requirement
279
282
  requirements:
280
283
  - - ">="
@@ -282,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
285
  version: '0'
283
286
  requirements: []
284
287
  rubyforge_project:
285
- rubygems_version: 2.6.13
288
+ rubygems_version: 2.7.6
286
289
  signing_key:
287
290
  specification_version: 4
288
291
  summary: Reputation engine for Rails apps
@@ -317,9 +320,11 @@ test_files:
317
320
  - test/dummy/app/views/users/show.html.erb
318
321
  - test/dummy/config.ru
319
322
  - test/dummy/config/application.rb
323
+ - test/dummy/config/application_api_only.rb
320
324
  - test/dummy/config/boot.rb
321
325
  - test/dummy/config/database.yml
322
326
  - test/dummy/config/environment.rb
327
+ - test/dummy/config/environment_api_only.rb
323
328
  - test/dummy/config/environments/development.rb
324
329
  - test/dummy/config/environments/production.rb
325
330
  - test/dummy/config/environments/test.rb
@@ -327,6 +332,7 @@ test_files:
327
332
  - test/dummy/config/initializers/inflections.rb
328
333
  - test/dummy/config/initializers/merit.rb
329
334
  - test/dummy/config/initializers/mime_types.rb
335
+ - test/dummy/config/initializers/new_framework_defaults.rb
330
336
  - test/dummy/config/initializers/secret_token.rb
331
337
  - test/dummy/config/initializers/session_store.rb
332
338
  - test/dummy/config/locales/en.yml