Skip to content

Commit

Permalink
rubocopify
Browse files Browse the repository at this point in the history
  • Loading branch information
ermolaev committed Sep 28, 2024
1 parent 6a21b2e commit c74b78a
Show file tree
Hide file tree
Showing 15 changed files with 395 additions and 379 deletions.
16 changes: 8 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

gemspec

gem 'dry-types'
gem 'priscilla', github: 'corp-gp/priscilla'
gem 'pry', '~> 0.12'
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.9'
gem 'rubocop-gp', github: 'corp-gp/rubocop-gp'
gem 'sqlite3', '~> 1.4'
gem "dry-types"
gem "priscilla", github: "corp-gp/priscilla"
gem "pry", "~> 0.12"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.9"
gem "rubocop-gp", github: "corp-gp/rubocop-gp"
gem "sqlite3", "~> 1.4"
165 changes: 96 additions & 69 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ GIT

GIT
remote: https://github.com/corp-gp/rubocop-gp.git
revision: 4d390b6cdd2b27f151fe0535bd266525fbf8f25d
revision: 61d6ca243e1a5f7d209e9619417c8fc1d303d181
specs:
rubocop-gp (0.0.2)
rubocop-gp (0.0.4)
rubocop
rubocop-capybara
rubocop-factory_bot
rubocop-performance
rubocop-rails
rubocop-rspec
rubocop-rspec_rails

PATH
remote: .
Expand All @@ -27,95 +30,119 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activemodel (6.1.4.6)
activesupport (= 6.1.4.6)
activerecord (6.1.4.6)
activemodel (= 6.1.4.6)
activesupport (= 6.1.4.6)
activesupport (6.1.4.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
activemodel (7.2.1)
activesupport (= 7.2.1)
activerecord (7.2.1)
activemodel (= 7.2.1)
activesupport (= 7.2.1)
timeout (>= 0.4.0)
activesupport (7.2.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.8)
coderay (1.1.3)
colorize (0.8.1)
concurrent-ruby (1.1.9)
diff-lcs (1.5.0)
dry-configurable (0.14.0)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
diff-lcs (1.5.1)
drb (2.2.1)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
dry-core (~> 0.6)
dry-container (0.9.0)
zeitwerk (~> 2.6)
dry-inflector (1.1.0)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.13, >= 0.13.0)
dry-core (0.7.1)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-types (1.7.2)
bigdecimal (~> 3.0)
concurrent-ruby (~> 1.0)
dry-inflector (0.2.1)
dry-logic (1.2.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
dry-core (~> 0.5, >= 0.5)
dry-types (1.5.1)
concurrent-ruby (~> 1.0)
dry-container (~> 0.3)
dry-core (~> 0.5, >= 0.5)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
i18n (1.9.1)
concurrent-ruby (~> 1.0)
method_source (1.0.0)
minitest (5.15.0)
parallel (1.21.0)
parser (3.1.0.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
logger (1.6.1)
method_source (1.1.0)
minitest (5.25.1)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
pry (0.14.1)
racc
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
rack (2.2.3)
racc (1.8.1)
rack (3.1.7)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.2.1)
rexml (3.2.5)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
rake (13.2.1)
regexp_parser (2.9.2)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (1.25.1)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.15.1, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.15.1)
parser (>= 3.0.1.1)
rubocop-performance (1.13.2)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.13.2)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.26.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-rspec (2.8.0)
rubocop (~> 1.19)
ruby-progressbar (1.11.0)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.5)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
rubocop-rspec (~> 3, >= 3.0.1)
ruby-progressbar (1.13.0)
rumoji (0.5.0)
sqlite3 (1.4.2)
tzinfo (2.0.4)
securerandom (0.3.1)
sqlite3 (1.7.3-arm64-darwin)
sqlite3 (1.7.3-x86_64-darwin)
sqlite3 (1.7.3-x86_64-linux)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
zeitwerk (2.5.4)
unicode-display_width (2.6.0)
zeitwerk (2.6.18)

PLATFORMS
arm64-darwin-21
Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

require 'rubocop/rake_task'
require "rubocop/rake_task"

RuboCop::RakeTask.new

Expand Down
36 changes: 18 additions & 18 deletions enum_machine.gemspec
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# frozen_string_literal: true

require_relative 'lib/enum_machine/version'
require_relative "lib/enum_machine/version"

Gem::Specification.new do |spec|
spec.name = 'enum_machine'
spec.name = "enum_machine"
spec.version = EnumMachine::VERSION
spec.authors = ['Ermolaev Andrey']
spec.email = ['[email protected]']
spec.authors = ["Ermolaev Andrey"]
spec.email = ["[email protected]"]

spec.summary = 'fast and siple usage state machine in your app'
spec.description = 'Enum machine is a library for defining enums and setting state machines for attributes in ActiveRecord models and plain Ruby classes.'
spec.homepage = 'https://github.com/corp-gp/enum_machine'
spec.license = 'MIT'
spec.required_ruby_version = '>= 3.0.0'
spec.summary = "fast and siple usage state machine in your app"
spec.description = "Enum machine is a library for defining enums and setting state machines for attributes in ActiveRecord models and plain Ruby classes."
spec.homepage = "https://github.com/corp-gp/enum_machine"
spec.license = "MIT"
spec.required_ruby_version = ">= 3.0.0"

spec.metadata['allowed_push_host'] = 'https://rubygems.org'
spec.metadata["allowed_push_host"] = "https://rubygems.org"

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/corp-gp/enum_machine'
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/corp-gp/enum_machine"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
Expand All @@ -27,15 +27,15 @@ Gem::Specification.new do |spec|
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
end
end
spec.bindir = 'exe'
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
spec.require_paths = ["lib"]

spec.add_dependency 'activemodel'
spec.add_dependency 'activerecord'
spec.add_dependency 'activesupport'
spec.add_dependency "activemodel"
spec.add_dependency "activerecord"
spec.add_dependency "activesupport"

# For more information and examples about making a new gem, checkout our
# guide at: https://bundler.io/guides/creating_gem.html
spec.metadata['rubygems_mfa_required'] = 'true'
spec.metadata["rubygems_mfa_required"] = "true"
end
20 changes: 10 additions & 10 deletions lib/enum_machine.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# frozen_string_literal: true

require_relative 'enum_machine/version'
require_relative 'enum_machine/driver_simple_class'
require_relative 'enum_machine/build_attribute'
require_relative 'enum_machine/attribute_persistence_methods'
require_relative 'enum_machine/build_class'
require_relative 'enum_machine/machine'
require 'active_support'
require_relative "enum_machine/version"
require_relative "enum_machine/driver_simple_class"
require_relative "enum_machine/build_attribute"
require_relative "enum_machine/attribute_persistence_methods"
require_relative "enum_machine/build_class"
require_relative "enum_machine/machine"
require "active_support"

module EnumMachine

Expand All @@ -20,7 +20,7 @@ def initialize(machine, from, to)
@from = from
@to = to
@enum_const = machine.base_klass.const_get(machine.enum_const_name)
super "Transition #{from.inspect} => #{to.inspect} not defined in enum_machine #{enum_const.name}"
super("Transition #{from.inspect} => #{to.inspect} not defined in enum_machine #{enum_const.name}")
end

end
Expand All @@ -32,6 +32,6 @@ def self.[](args)
end

ActiveSupport.on_load(:active_record) do
require_relative 'enum_machine/driver_active_record'
ActiveRecord::Base.extend(EnumMachine::DriverActiveRecord)
require_relative "enum_machine/driver_active_record"
ActiveSupport.on_load(:active_record) { extend EnumMachine::DriverActiveRecord }
end
4 changes: 2 additions & 2 deletions lib/enum_machine/build_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def self.#{key}

private_class_method def self.const_missing(name)
name_s = name.to_s
return super unless name_s.include?('__')
return super unless name_s.include?("__")

const_set name_s, name_s.split('__').map { |i| const_get(i) }.freeze
const_set name_s, name_s.split("__").map { |i| const_get(i) }.freeze
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/enum_machine/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module EnumMachine

VERSION = '1.0.0'
VERSION = "1.0.0"

end
Loading

0 comments on commit c74b78a

Please sign in to comment.