From 65a0b0743fbaae915f38665af395ee091c49f4b4 Mon Sep 17 00:00:00 2001 From: Alfonso Uceda Date: Tue, 12 Nov 2024 17:20:34 +0100 Subject: [PATCH] Gemfile is cleaned up and drop ruby support below 2.5 version --- Gemfile | 7 ------ cells.gemspec | 51 ++++++++++++++++++++++++------------------ lib/cell/view_model.rb | 3 +-- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Gemfile b/Gemfile index 93f5d477..b4e2a20b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,3 @@ source "https://rubygems.org" -gem "minitest", "~> 5.2" -gem "cells-erb"#, path: "../cells-erb" -gem "benchmark-ips" -gem "minitest-line" - gemspec - -# gem "uber", path: "../uber" diff --git a/cells.gemspec b/cells.gemspec index 102c53bb..4df26a76 100644 --- a/cells.gemspec +++ b/cells.gemspec @@ -1,31 +1,38 @@ -lib = File.expand_path("../lib/", __FILE__) -$:.unshift lib unless $:.include?(lib) - -require "cell/version" +require_relative 'lib/cell/version' Gem::Specification.new do |spec| - spec.name = "cells" + spec.name = 'cells' spec.version = Cell::VERSION - spec.platform = Gem::Platform::RUBY - spec.authors = ["Nick Sutterer"] - spec.email = ["apotonick@gmail.com"] - spec.homepage = "https://github.com/apotonick/cells" - spec.summary = %q{View Models for Ruby and Rails.} - spec.description = %q{View Models for Ruby and Rails, replacing helpers and partials while giving you a clean view architecture with proper encapsulation.} - spec.license = "MIT" + spec.authors = ['Nick Sutterer'] + spec.email = ['apotonick@gmail.com'] + spec.homepage = 'https://github.com/trailblazer/cells' + spec.summary = 'View Models for Ruby and Rails.' + spec.description = 'View Models for Ruby and Rails, replacing helpers and partials while giving you a clean view architecture with proper encapsulation.' + spec.license = 'MIT' + + spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues" + spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/HEAD/CHANGES.md" + spec.metadata['documentation_uri'] = 'https://trailblazer.to/2.1/docs/cells' + spec.metadata['homepage_uri'] = spec.homepage + spec.metadata['source_code_uri'] = spec.homepage + spec.metadata['wiki_uri'] = "#{spec.homepage}/wiki" - spec.files = `git ls-files`.split("\n") - spec.test_files = `git ls-files -- {test}/*`.split("\n") - spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } - spec.require_paths = ["lib"] + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |file| + file.start_with?(*%w[.git Gemfile Rakefile TODO test]) + end + end + spec.require_paths = ['lib'] + spec.required_ruby_version = '>= 2.5' - spec.add_dependency "uber", "< 0.2.0" + spec.add_dependency 'declarative-builder', '~> 0.2.0' + spec.add_dependency 'tilt', '>= 1.4', '< 3' spec.add_dependency "declarative-option", "< 0.2.0" - spec.add_dependency "declarative-builder", "< 0.2.0" - spec.add_dependency "tilt", ">= 1.4", "< 3" + spec.add_dependency 'uber', '< 0.2.0' - spec.add_development_dependency "rake" - spec.add_development_dependency "capybara" - spec.add_development_dependency "cells-erb", ">= 0.0.4" + spec.add_development_dependency 'capybara' + spec.add_development_dependency 'cells-erb', '>= 0.1.0' + spec.add_development_dependency 'minitest' + spec.add_development_dependency 'rake' spec.add_development_dependency 'debug' end diff --git a/lib/cell/view_model.rb b/lib/cell/view_model.rb index 64bc213f..eebeb703 100644 --- a/lib/cell/view_model.rb +++ b/lib/cell/view_model.rb @@ -198,8 +198,7 @@ def process_options!(options) # Computes the view name from the call stack in which `render` was invoked. def state_for_implicit_render(options) - _caller = RUBY_VERSION < "2.0" ? caller(3) : caller(3, 1) # TODO: remove case in 5.0 when dropping 1.9. - _caller[0].match(/`(\w+)|#(\w+)'/).captures.compact.first + caller(3, 1)[0].match(/`(\w+)|#(\w+)'/).captures.compact.first end include Layout