ruby_checker 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e79f1172a7f16cc5fd768291aeaaa80b9cfee2928703dfd167239d05c3733c78
4
- data.tar.gz: ec39b7b666d51613774dc7572f98f569c5a625351f5209827ca191154bcdf213
3
+ metadata.gz: 7d7e15ff3c8888029960319b1444e64379e0699f7b974e8122100ff53a44e1a9
4
+ data.tar.gz: 23452924cc0d17b7d3a4e13f5404fc6d724e12909c9215edcbc71c52124281b2
5
5
  SHA512:
6
- metadata.gz: 460ecd9775931511690147038ad1460a6c471acff771869c9f8763925c03d53877d1cb8de42564b0cbc1c179f8fa2e393f88772faf79abcbb270e6a34f4bb684
7
- data.tar.gz: 8dd18f8fe5c019dbdf42ec586ece3fe631fe0313ae49e3cbf78e9e6fca2b355f6da9b3c2fdbef6716e7fb0fc3b812e4f4b05e2a2cc880d2e9698468c5b36ec11
6
+ metadata.gz: 77d53b1378b651ee38a7a8ff6fefd18955e85cdbf431264ada0c738be56e2d77f6a2574f83806ec3c4b0aa2e356ac8acfcc9d18185c6aad11d5c650b9b8cde43
7
+ data.tar.gz: d9ba900883bb1d1e2f08a2727a45fe344b291ded54cd7f2af652c9e4d213b4118f4cc427473573e845b3d1c2a932715993a763d5b45820cf438c542a14cf773c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ - [8a8c3621fb12](https://github.com/mssola/ruby_checker/commits/8a8c3621fb12) Implemented a railtie with an initializer.
6
+
3
7
  ## 1.0.0
4
8
 
5
9
  - Implemented the basic functionality of `ruby_checker`:
data/README.md CHANGED
@@ -36,6 +36,17 @@ If you are using this gem from within a Ruby on Rails project, you will notice t
36
36
  since it will be guessed from the `.ruby-version` file from the root of your
37
37
  project.
38
38
 
39
+ Moreover, this gem also implements a railtie with an initializer. This means
40
+ that if you require this gem on your Gemfile, you won't have to write any code
41
+ in order to get this gem up and running. That is if you are on this situation:
42
+ you have a `.ruby-version` file and you are using
43
+ [MRI](https://en.wikipedia.org/wiki/Ruby_MRI). If you are using another
44
+ interpreter you can write in your `config/application.rb` the following:
45
+
46
+ ```ruby
47
+ config.ruby_checker.interpreter = ::RubyChecker::JRUBY # or any other interpreter, even ANY.
48
+ ```
49
+
39
50
  ## Contributing
40
51
 
41
52
  Read the [CONTRIBUTING.md](./CONTRIBUTING.md) file.
data/Rakefile CHANGED
@@ -33,6 +33,7 @@ end
33
33
 
34
34
  GitValidation::Task.new(:"git-validation") do |t|
35
35
  t.from = "74a6c20fc4d3"
36
+ t.quiet = ENV["CI"] != "true"
36
37
  end
37
38
 
38
39
  task default: :all
data/lib/ruby_checker.rb CHANGED
@@ -22,3 +22,4 @@ module RubyChecker
22
22
  end
23
23
 
24
24
  require "ruby_checker/ruby_checker"
25
+ require "ruby_checker/railtie" if defined?(Rails)
@@ -31,5 +31,14 @@ module RubyChecker
31
31
  puts "[ruby_checker] Warning: #{msg}"
32
32
  end
33
33
  end
34
+
35
+ # debug logs the given message as a debug message.
36
+ def debug(msg)
37
+ if defined?(Rails)
38
+ Rails.logger.tagged("ruby_checker") { Rails.logger.debug(msg) }
39
+ else
40
+ puts "[ruby_checker] Debug: #{msg}"
41
+ end
42
+ end
34
43
  end
35
44
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # copyright (c) 2020 miquel sabaté solà <mikisabate@gmail.com>
4
+ #
5
+ # this file is part of ruby_checker.
6
+ #
7
+ # ruby_checker is free software: you can redistribute it and/or modify
8
+ # it under the terms of the gnu lesser general public license as published by
9
+ # the free software foundation, either version 3 of the license, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ruby_checker is distributed in the hope that it will be useful,
13
+ # but without any warranty; without even the implied warranty of
14
+ # merchantability or fitness for a particular purpose. see the
15
+ # gnu general public license for more details.
16
+ #
17
+ # you should have received a copy of the gnu lesser general public license
18
+ # along with ruby_checker. if not, see <http://www.gnu.org/licenses/>.
19
+
20
+ require "rails"
21
+
22
+ module RubyChecker
23
+ # Railtie implements a Ruby on Rails initializer so most Rails apps don't have
24
+ # to do anything in order to setup this gem.
25
+ class Railtie < Rails::Railtie
26
+ railtie_name :ruby_checker
27
+
28
+ initializer "ruby_checker" do |app|
29
+ ::RubyChecker::RubyChecker.new(interpreter: app.config.ruby_checker.interpreter).check!
30
+ end
31
+
32
+ config.ruby_checker = ActiveSupport::OrderedOptions.new
33
+ config.ruby_checker.interpreter = ::RubyChecker::MRI
34
+ end
35
+ end
@@ -19,6 +19,7 @@
19
19
 
20
20
  require "ruby_checker/errors"
21
21
  require "ruby_checker/interpreter"
22
+ require "ruby_checker/logger"
22
23
  require "ruby_checker/versions"
23
24
 
24
25
  require "rubygems/version"
@@ -37,7 +38,9 @@ module RubyChecker
37
38
  @supported = parsed_supported_version
38
39
  raise MissingSupportedVersionError if @supported.nil?
39
40
 
40
- perform_checks!
41
+ res = perform_checks!
42
+ Logger.new.debug "OK!" if res
43
+ res
41
44
  end
42
45
 
43
46
  protected
@@ -19,5 +19,5 @@
19
19
 
20
20
  module RubyChecker
21
21
  # The current version of RubyChecker.
22
- VERSION = "1.0.0"
22
+ VERSION = "1.1.0"
23
23
  end
data/ruby_checker.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.required_ruby_version = ">= 2.3"
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 2.1.4"
26
- spec.add_development_dependency "git_validation_task", "~> 1.0.0"
26
+ spec.add_development_dependency "git_validation_task", "~> 1.1.0"
27
27
  spec.add_development_dependency "minitest", "~> 5.14.0"
28
28
  spec.add_development_dependency "rake", "~> 13.0.1"
29
29
  spec.add_development_dependency "rubocop", "~> 0.80.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miquel Sabaté Solà
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-28 00:00:00.000000000 Z
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0
33
+ version: 1.1.0
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: 1.0.0
40
+ version: 1.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -112,6 +112,7 @@ files:
112
112
  - lib/ruby_checker/errors.rb
113
113
  - lib/ruby_checker/interpreter.rb
114
114
  - lib/ruby_checker/logger.rb
115
+ - lib/ruby_checker/railtie.rb
115
116
  - lib/ruby_checker/ruby_checker.rb
116
117
  - lib/ruby_checker/version.rb
117
118
  - lib/ruby_checker/versions.rb