8000 Housekeeping by n-rodriguez · Pull Request #230 · thoughtbot/appraisal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Housekeeping #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7018db7
Improve debug output
n-rodriguez Aug 20, 2024
c4a24cd
Silence Bundler warnings
n-rodriguez Aug 20, 2024
9450d90
Remove useless file
n-rodriguez Aug 20, 2024
fe800ac
Ignore MacOS files
n-rodriguez Aug 20, 2024
e455cd6
Move development gems in Gemfile
n-rodriguez Aug 20, 2024
347694c
Cleanup gemspec
n-rodriguez Aug 20, 2024
ca75334
Coding style: use double quotes everywhere
n-rodriguez Aug 21, 2024
d9636b0
Coding style: use the new Ruby 1.9 hash syntax
n-rodriguez Aug 21, 2024
bd1a0d0
Coding style: use uppercase heredoc delimiters
n-rodriguez Aug 21, 2024
679cfb6
Coding style: add parentheses to nested method call
n-rodriguez Aug 21, 2024
4574b52
Coding style: add missing frozen string literal comment
n-rodriguez Aug 21, 2024
a98ed40
Coding style: %w-literals should be delimited by [ and ]
n-rodriguez Aug 21, 2024
aa55d55
Coding style: space inside } is missing
n-rodriguez Aug 21, 2024
9595b60
Coding style: fix indentation
n-rodriguez Aug 21, 2024
c81816f
Coding style: avoid comma after the last parameter of a method call
n-rodriguez Aug 21, 2024
b831d32
Coding style: remove unnecessary disabling of Layout/LineLength
n-rodriguez Aug 21, 2024
19e03b3
Coding style: remove unnecessary spacing
n-rodriguez Aug 21, 2024
e2b580d
Coding style: use hash literal {} instead of Hash.new
n-rodriguez Aug 21, 2024
7be8feb
Coding style: place the . on the next line, together with the method …
n-rodriguez Aug 21, 2024
c75f958
Coding style: use 2 spaces for indentation in a heredoc by using <<~ …
n-rodriguez Aug 21, 2024
83cd735
Coding style: fix indentation
n-rodriguez Aug 21, 2024
0a3520b
Coding style: make sure that the block will be associated with the PA…
n-rodriguez Aug 21, 2024
077e99b
Coding style: use class << self instead of def self. to define class …
n-rodriguez Aug 21, 2024
2c1c7bf
Fix: make .strip_heredoc private
n-rodriguez Aug 21, 2024
7982141
Coding style: add missing space
n-rodriguez Aug 21, 2024
69b21a2
Add GithubAction config
n-rodriguez Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
8000
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: CI

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
rspec:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby:
- '3.3'
- '3.2'
- '3.1'
- '3.0'
- 'head'
- jruby
- jruby-head
- truffleruby
- truffleruby-head

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Update bundler
env:
RUBY_VERSION: ${{ matrix.ruby }}
run: |
case ${RUBY_VERSION} in
truffleruby|truffleruby-head)
gem install bundler -v 2.5.18
;;

*)
gem update --system
;;
esac

bundle install

- name: RSpec
run: bin/rspec
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ pkg
*.gem
Gemfile.lock
.bundle
.DS_Store
1 change: 0 additions & 1 deletion .rspec

This file was deleted.

4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ gemspec

# This here to make sure appraisal works with Rails 3.0.0.
gem "thor", "~> 0.14.0"

# Development gems
gem "activesupport", ">= 3.2.21"
gem "rspec", "~> 3.0"
14 changes: 8 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
# frozen_string_literal: true

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

RSpec::Core::RakeTask.new do |t|
t.pattern = 'spec/**/*_spec.rb'
t.pattern = "spec/**/*_spec.rb"
t.ruby_opts = %w[-w]
t.verbose = false
end

desc 'Default: run the rspec examples'
task :default => [:spec]
desc "Default: run the rspec examples"
task default: [:spec]
32 changes: 14 additions & 18 deletions appraisal.gemspec
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "appraisal/version"
# frozen_string_literal: true

require_relative "lib/appraisal/version"

Gem::Specification.new do |s|
s.name = 'appraisal'
s.name = "appraisal"
s.version = Appraisal::VERSION.dup
s.platform = Gem::Platform::RUBY
s.authors = ['Joe Ferris', 'Prem Sichanugrist']
s.email = ['jferris@thoughtbot.com', 'prem@thoughtbot.com']
s.homepage = 'http://github.com/thoughtbot/appraisal'
s.summary = 'Find out what your Ruby gems are worth'
s.authors = ["Joe Ferris", "Prem Sichanugrist"]
s.email = ["jferris@thoughtbot.com", "prem@thoughtbot.com"]
s.homepage = "http://github.com/thoughtbot/appraisal"
s.summary = "Find out what your Ruby gems are worth"
s.description = 'Appraisal integrates with bundler and rake to test your library against different versions of dependencies in repeatable scenarios called "appraisals."'
s.license = 'MIT'
s.license = "MIT"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- exe/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.bindir = 'exe'
s.executables = `git ls-files -- exe/*`.split("\n").map { |f| File.basename(f) }
s.bindir = "exe"

s.required_ruby_version = ">= 2.3.0"

s.add_runtime_dependency('rake')
s.add_runtime_dependency('bundler')
s.add_runtime_dependency('thor', '>= 0.14.0')

s.add_development_dependency("activesupport", ">= 3.2.21")
s.add_development_dependency('rspec', '~> 3.0')
s.add_dependency("rake")
s.add_dependency("bundler")
s.add_dependency("thor", ">= 0.14.0")
end
10 changes: 6 additions & 4 deletions exe/appraisal
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'appraisal'
require 'appraisal/cli'
# frozen_string_literal: true

require "rubygems"
require "bundler/setup"
require "appraisal"
require "appraisal/cli"

begin
Appraisal::CLI.start
Expand Down
6 changes: 4 additions & 2 deletions lib/appraisal.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require 'appraisal/version'
require 'appraisal/task'
# frozen_string_literal: true

require "appraisal/version"
require "appraisal/task"

Appraisal::Task.new
34 changes: 18 additions & 16 deletions lib/appraisal/appraisal.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
require 'appraisal/gemfile'
require 'appraisal/command'
# frozen_string_literal: true

require "appraisal/gemfile"
require "appraisal/command"
require "appraisal/customize"
require 'appraisal/utils'
require 'fileutils'
require 'pathname'
require "appraisal/utils"
require "fileutils"
require "pathname"

module Appraisal
# Represents one appraisal and its dependencies
Expand Down Expand Up @@ -79,15 +81,15 @@ def install(options = {})
command = commands.join(" || ")

if Bundler.settings[:path]
env = { 'BUNDLE_DISABLE_SHARED_GEMS' => '1' }
Command.new(command, :env => env).run
env = { "BUNDLE_DISABLE_SHARED_GEMS" => "1" }
Command.new(command, env: env).run
else
Command.new(command).run
end
end

def update(gems = [])
Command.new(update_command(gems), :gemfile => gemfile_path).run
Command.new(update_command(gems), gemfile: gemfile_path).run
end

def gemfile_path
Expand All @@ -107,10 +109,10 @@ def relativize
relative_path = current_directory.relative_path_from(gemfile_root).cleanpath
lockfile_content = File.read(lockfile_path)

File.open(lockfile_path, 'w') do |file|
File.open(lockfile_path, "w") do |file|
file.write lockfile_content.gsub(
/ #{current_directory}/,
" #{relative_path}",
" #{relative_path}"
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/TrailingCommaInArguments: Put a comma after the last parameter of a multiline method call.

end
end
Expand All @@ -119,16 +121,16 @@ def relativize

def check_command
gemfile_option = "--gemfile='#{gemfile_path}'"
['bundle', 'check', gemfile_option]
["bundle", "check", gemfile_option]
end

def install_command(options = {})
gemfile_option = "--gemfile='#{gemfile_path}'"
['bundle', 'install', gemfile_option, bundle_options(options)].compact
["bundle", "install", gemfile_option, bundle_options(options)].compact
end

def update_command(gems)
['bundle', 'update', *gems].compact
["bundle", "update", *gems].compact
end

def gemfile_root
Expand All @@ -148,7 +150,7 @@ def lockfile_path
end

def clean_name
name.gsub(/[^\w\.]/, '_')
name.gsub(/[^\w\.]/, "_")
end

def bundle_options(options)
Expand All @@ -159,8 +161,8 @@ def bundle_options(options)
if Utils.support_parallel_installation?
options_strings << "--jobs=#{jobs}"
else
warn 'Your current version of Bundler does not support parallel installation. Please ' +
'upgrade Bundler to version >= 1.4.0, or invoke `appraisal` without `--jobs` option.'
warn "Your current version of Bundler does not support parallel installation. Please " +
"upgrade Bundler to version >= 1.4.0, or invoke `appraisal` without `--jobs` option."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [98/80]

end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [97/80]

end

Expand Down
12 changes: 7 additions & 5 deletions lib/appraisal/appraisal_file.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'appraisal/appraisal'
# frozen_string_literal: true

require "appraisal/appraisal"
require "appraisal/customize"
require 'appraisal/errors'
require 'appraisal/gemfile'
require "appraisal/errors"
require "appraisal/gemfile"

module Appraisal
# Loads and parses Appraisals file
Expand All @@ -15,7 +17,7 @@ def self.each(&block)
def initialize
@appraisals = []
@gemfile = Gemfile.new
@gemfile.load(ENV['BUNDLE_GEMFILE'] || 'Gemfile')
@gemfile.load(ENV["BUNDLE_GEMFILE"] || "Gemfile")

if File.exist? path
run IO.read(path)
Expand Down Expand Up @@ -45,7 +47,7 @@ def run(definitions)
end

def path
'Appraisals'
"Appraisals"
end
end
end
23 changes: 12 additions & 11 deletions lib/appraisal/bundler_dsl.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# frozen_string_literal: true

require "appraisal/dependency_list"

module Appraisal
class BundlerDSL
attr_reader :dependencies

PARTS = %w(source ruby_version gits paths dependencies groups
platforms source_blocks install_if gemspec)
PARTS = %w[source ruby_version gits paths dependencies groups
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/MutableConstant: Freeze mutable objects assigned to constants.

platforms source_blocks install_if gemspec]

def initialize
@sources = []
@ruby_version = nil
@dependencies = DependencyList.new
@gemspecs = []
@groups = Hash.new
@platforms = Hash.new
@gits = Hash.new
@paths = Hash.new
@source_blocks = Hash.new
@groups = {}
@platforms = {}
@gits = {}
@paths = {}
@source_blocks = {}
@git_sources = {}
@install_if = {}
end
Expand Down Expand Up @@ -80,11 +82,11 @@ def path(source, options = {}, &block)
end

def to_s
Utils.join_parts PARTS.map { |part| send("#{part}_entry") }
Utils.join_parts(PARTS.map { |part| send("#{part}_entry") })
end

def for_dup
Utils.join_parts PARTS.map { |part| send("#{part}_entry_for_dup") }
Utils.join_parts(PARTS.map { |part| send("#{part}_entry_for_dup") })
end

def gemspec(options = {})
Expand Down Expand Up @@ -134,8 +136,7 @@ def dependencies_entry_for_dup
@dependencies.for_dup
end

%i[gits paths platforms groups source_blocks install_if].
each do |method_name|
%i[gits paths platforms groups source_blocks install_if].each do |method_name|
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [82/80]

class_eval <<-METHODS, __FILE__, __LINE__
private

Expand Down
Loading
Loading
0