Skip to content

Commit

Permalink
Pull in the most modern gem stuff from 'bundle gem'
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Dec 15, 2023
1 parent 8f2447d commit c8f2a2e
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 90 deletions.
39 changes: 11 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
## MAC OS
.DS_Store

## TEXTMATE
*.tmproj
tmtags

## EMACS
*~
\#*
.\#*

## VIM
*.swp

## PROJECT::GENERAL
gbin
coverage
doc
rdoc
pkg
vendor/gems
vendor/bundle
.yardoc
.bundle
Gemfile.lock

## PROJECT::SPECIFIC
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
3 changes: 3 additions & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# For available configuration options, see:
# https://github.com/standardrb/standard
ruby_version: 2.6
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec

gem "rake", "~> 13.1"

gem "rspec", "~> 3.0"

gem "standard", "~> 1.3"

gem "simplecov", "~> 0.18"
20 changes: 0 additions & 20 deletions LICENSE

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2009-2023 Martin Emde

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
40 changes: 20 additions & 20 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
require 'bundler/gem_tasks'
# frozen_string_literal: true

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new do |t|
t.rspec_opts = %w[--color]
t.pattern = 'spec/**/*_spec.rb'
end
task :default => :spec
require "bundler/gem_tasks"
require "rspec/core/rake_task"

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

require "standard/rake"

task :coverage => [:coverage_env, :spec]
task default: %i[spec standard]

task coverage: [:coverage_env, :spec]
task :coverage_env do
ENV['COVERAGE'] = '1'
ENV["COVERAGE"] = "1"
end

task :benchmark do
require 'benchmark'
require 'uri'
require File.expand_path('lib/gitable/uri', File.dirname(__FILE__))

n = 10000
require "benchmark/ips"
require "uri"
require File.expand_path("lib/gitable/uri", File.dirname(__FILE__))
scp = "git@github.com:martinemde/gitable.git"
uri = "git://github.com/martinemde/gitable.git"
dup = Gitable::URI.parse(uri)
Benchmark.bmbm do |x|
x.report('dup') { n.times { Gitable::URI.parse(dup) } }
x.report(uri) { n.times { Gitable::URI.parse(uri) } }
x.report(scp) { n.times { Gitable::URI.parse(scp) } }
x.report("addressable") { n.times { Addressable::URI.parse(uri) } }
x.report("uri") { n.times { URI.parse(uri) } }
Benchmark.ips do |x|
x.report("dup") { Gitable::URI.parse(dup) }
x.report(uri) { Gitable::URI.parse(uri) }
x.report(scp) { Gitable::URI.parse(scp) }
x.report("addressable") { Addressable::URI.parse(uri) }
x.report("uri") { URI.parse(uri) }
end
end
11 changes: 11 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "gitable"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

require "irb"
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
48 changes: 29 additions & 19 deletions gitable.gemspec
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "gitable"
s.version = "0.4.0"
s.authors = ["Martin Emde"]
s.email = ["martin.emde@gmail.com"]
s.homepage = "https://github.com/martinemde/gitable"
s.summary = %q{Addressable::URI with additional support for Git "URIs"}
s.description = %q{Addressable::URI for Git "URIs" with special handling for scp-style remotes that Addressable intentionally doesn't parse.}
s.license = 'MIT'
# frozen_string_literal: true

s.add_dependency "addressable", "~> 2.2", ">= 2.2.7"
s.add_development_dependency "rspec", "~> 3.0"
s.add_development_dependency "rake"
s.add_development_dependency "simplecov"
require_relative "lib/gitable/version"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.extra_rdoc_files = ["LICENSE", "README.md"]
Gem::Specification.new do |spec|
spec.name = "gitable"
spec.version = Gitable::VERSION
spec.authors = ["Martin Emde"]
spec.email = ["martin.emde@gmail.com"]
spec.homepage = "https://github.com/martinemde/gitable"
spec.summary = 'Addressable::URI with additional support for Git "URIs"'
spec.description = %q(Addressable::URI for Git "URIs" with special handling for scp-style remotes that Addressable intentionally doesn't parse.)
spec.license = "MIT"

# spec.required_ruby_version = ">= 2.6.0"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/martinemde/gitable"
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."

spec.add_dependency "addressable", "~> 2.2", ">= 2.2.7"

spec.files = Dir.chdir(__dir__) do
`git ls-files -z`.split("\x0").reject do |f|
(File.expand_path(f) == __FILE__) ||
f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
end
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
end
9 changes: 6 additions & 3 deletions lib/gitable.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# @author Martin Emde
# frozen_string_literal: true

require_relative "gitable/version"

module Gitable
end

require 'gitable/uri'
require 'gitable/scp_uri'
require_relative "gitable/uri"
require_relative "gitable/scp_uri"
5 changes: 5 additions & 0 deletions lib/gitable/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module Gitable
VERSION = "1.0.0.pre"
end

0 comments on commit c8f2a2e

Please sign in to comment.