-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Housekeeping #230
Changes from all commits
7018db7
c4a24cd
9450d90
fe800ac
e455cd6
347694c
ca75334
d9636b0
bd1a0d0
679cfb6
4574b52
a98ed40
aa55d55
9595b60
c81816f
b831d32
19e03b3
e2b580d
7be8feb
c75f958
83cd735
0a3520b
077e99b
2c1c7bf
7982141
69b21a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | 8000
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ pkg | |
*.gem | ||
Gemfile.lock | ||
.bundle | ||
.DS_Store |
This file was deleted.
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] |
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 |
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 |
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 | ||
|
@@ -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 | ||
|
@@ -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}" | ||
) | ||
end | ||
end | ||
|
@@ -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 | ||
|
@@ -148,7 +150,7 @@ def lockfile_path | |
end | ||
|
||
def clean_name | ||
name.gsub(/[^\w\.]/, '_') | ||
name.gsub(/[^\w\.]/, "_") | ||
end | ||
|
||
def bundle_options(options) | ||
|
@@ -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." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [98/80] |
||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [97/80] |
||
end | ||
|
||
|
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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 = {}) | ||
|
@@ -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| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
||
|
There was a problem hiding this comment.
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.