Skip to content

Commit

Permalink
Refactor of gem files and rake tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
javierav committed Mar 4, 2024
1 parent fb310df commit a64ce60
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 229 deletions.
23 changes: 3 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
*.a
/.bundle/
*.bundle
/coverage/
/doc/
.DS_Store
/Gemfile.lock
ipaddr.html
mkmf.log
*.o
/pkg/
rdoc
server.rb
*.so
/spec/reports/
*.sw?
/tmp/
/_yardoc/
.idea/
**/*.gem
/coverage
/pkg
/rdoc
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
Changelog
=========
# Changelog

## unreleased

### Added
- Add `bin/*` scripts for better development tasks

### Changed
- **Breaking** Change `Ipaddress::VERSION` to `IPAddress::VERSION` to match the gem main module
- Use `Gemfile` for development dependencies and add `Gemfile.lock` under control version
- Cleanup and improvement of the gemspec
- Cleanup of `Rakefile`
- Changes in `README.md` and `CONTRIBUTING.md` files to reflect the new development process

## 0.8.3 - 2016-02-17

Expand Down
29 changes: 15 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Contributing to the IPAddress Gem

[![Build Status](https://travis-ci.org/ipaddress-gem/ipaddress.svg?branch=master)](https://travis-ci.org/ipaddress-gem/ipaddress) [![Code Climate](https://codeclimate.com/github/ipaddress-gem/ipaddress/badges/gpa.svg)](https://codeclimate.com/github/ipaddress-gem/ipaddress) [![Dependency Status](https://www.versioneye.com/user/projects/57001305fcd19a0051853bde/badge.svg?style=flat)](https://www.versioneye.com/user/projects/57001305fcd19a0051853bde)
[![Build Status](https://github.com/ipaddress-gem/ipaddress/actions/workflows/tests/badge.svg)](https://github.com/ipaddress-gem/ipaddress/actions)
[![Code Climate](https://codeclimate.com/github/ipaddress-gem/ipaddress/badges/gpa.svg)](https://codeclimate.com/github/ipaddress-gem/ipaddress)
[![Dependency Status](https://www.versioneye.com/user/projects/57001305fcd19a0051853bde/badge.svg?style=flat)](https://www.versioneye.com/user/projects/57001305fcd19a0051853bde)

This gem is run by people who have jobs. So please understand if we can't always prioritize PRs and issues.

Expand All @@ -17,23 +19,22 @@ You can help by making your code submissions. We can't promise a specific turna

We will require that you adhere to the [ruby-style-guide](https://github.com/bbatsov/ruby-style-guide) for your code submissions.

## Testing

To run the tests you need to have:

1. The development dependencies installed with `bin/setup`.
2. Then just run the command `bin/rake test`.

## Test Coverage

All submissions of code must include test coverage which describes intent and expected behavior. The test suite used by this gem is [Minitest](https://github.com/seattlerb/minitest)
All submissions of code must include test coverage which describes intent and expected behavior.
The test suite used by this gem is [Minitest](https://github.com/seattlerb/minitest)

Unit tests are expected to execute quickly. We will ask you to revise any long-running tests.

We intend to add [Travis CI](https://travis-ci.org/) for automatic execution of branch tests.

## Versioning: Jeweler and Semantic Versioning
## Versioning

This repo uses [semantic versioning](http://semver.org/) implemented by the [Jeweler Gem](https://github.com/technicalpickles/jeweler). Please do not update the version by editting files, instead, you may increment or modify the version using the Rake tasks added by Jeweler.
This repo uses [semantic versioning](http://semver.org/).

```
$ rake -T | grep version
rake version # Displays the current version
rake version:bump:major # Bump the major version by 1
rake version:bump:minor # Bump the a minor version by 1
rake version:bump:patch # Bump the patch version by 1
rake version:write # Writes out an explicit version
```
Before release, update version in `lib/ipaddress/version.rb` file.
15 changes: 5 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
source "https://rubygems.org"

group :development do
gem 'bundler', '>= 1.0'
gem 'rake', '10.5.0'
gem 'minitest', '~> 5.8', '>= 5.8.4'
gem 'pry', '>= 0.10.1'
gem 'travis', '>= 1.8.2'
gem 'jeweler', '>=2.0.1'
gem 'codeclimate-test-reporter'
gem 'simplecov'
end
gemspec

gem "minitest"
gem "rake"
gem "simplecov", require: false
31 changes: 31 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PATH
remote: .
specs:
ipaddress (0.8.3)

GEM
remote: https://rubygems.org/
specs:
docile (1.4.0)
minitest (5.22.2)
rake (13.1.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)

PLATFORMS
arm64-darwin
x86_64-darwin
x86_64-linux

DEPENDENCIES
ipaddress!
minitest
rake
simplecov

BUNDLED WITH
2.5.6
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009-2015 Marco Ceresa
Copyright (c) 2009-today Marco Ceresa

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
43 changes: 13 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# IPAddress

[![Build Status](https://github.com/ipaddress-gem/ipaddress/actions/workflows/tests/badge.svg)](https://github.com/ipaddress-gem/ipaddress/actions)
[![Code Climate](https://codeclimate.com/github/ipaddress-gem/ipaddress/badges/gpa.svg)](https://codeclimate.com/github/ipaddress-gem/ipaddress)
[![Dependency Status](https://www.versioneye.com/user/projects/57001305fcd19a0051853bde/badge.svg?style=flat)](https://www.versioneye.com/user/projects/57001305fcd19a0051853bde)

IPAddress is a Ruby library designed to make the use of IPv4 and IPv6
addresses simple, powerful and enjoyable. It provides a complete set of
methods to handle IP addresses for any need, from simple scripting to full
Expand All @@ -10,35 +14,11 @@ typical usage.

## Requirements

* Ruby 1.9.3 or later
* Ruby 3.1.0 or later

Please refer to [Travis CI](https://travis-ci.org/ipaddress-gem/ipaddress) for
Please refer to [Github Actions](https://travis-ci.org/ipaddress-gem/ipaddress/actions) for
Build Tests on specific versions of Ruby.

[<img src="https://travis-ci.org/ipaddress-gem/ipaddress.svg?branch=master"
alt="Build Status" />](https://travis-ci.org/ipaddress-gem/ipaddress) [<img
src="https://codeclimate.com/github/ipaddress-gem/ipaddress/badges/gpa.svg"
/>](https://codeclimate.com/github/ipaddress-gem/ipaddress) [<img
src="https://www.versioneye.com/user/projects/57001305fcd19a0051853bde/badge.s
vg?style=flat" alt="Dependency Status"
/>](https://www.versioneye.com/user/projects/57001305fcd19a0051853bde)

IPAddress 0.8.2 was manually tested on:

* ruby-1.8.7-p334 [ i386 ]
* ree-1.8.7-2011.03 [ i386 ]
* rbx-head [ ]
* jruby-1.6.1 [ linux-i386-java ]
* ruby-1.9.1-p431 [ i386 ]
* ruby-1.9.2-p180 [ i386 ]
* ruby-2.0.0-p353 [ x86_64-darwin14.0.0 ]
* ruby-2.1.3-p242 [ x86_64-darwin14.0.0 ]


If you want to contribute, please refer to
[Contributing.md](https://github.com/ipaddress-gem/ipaddress/blob/master/CONTR
IBUTING.md).

## Installation

This gem is installed like any other:
Expand All @@ -57,11 +37,10 @@ The code is fully documented with RDoc. You can generate the
documentation with Rake:

```bash
$ rake rdoc
$ bin/rake rdoc
```

The latest documentation can be found online at
[this address][https://rubydoc.info/gems/ipaddress/]
The latest documentation can be found online at [RubyDoc](https://rubydoc.info/gems/ipaddress/)

## Introduction via examples

Expand Down Expand Up @@ -1036,6 +1015,10 @@ in addition to provide an organic API with logical separation and code structure
We hope that IPAddress will address all these issues and meet all your needs
in network programming.

## Contributing

If you want to contribute, please refer to [CONTRIBUTING.md](CONTRIBUTING.md).

## Community

Want to join the community?
Expand All @@ -1054,4 +1037,4 @@ and Steve Rawlinson for their support, feedback and bug reports.
## Copyright

Copyright (c) 2009-today Marco Ceresa and Mike Mackintosh.
See LICENSE for details.
See [LICENSE.txt](LICENSE.txt) for details.
69 changes: 11 additions & 58 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,69 +1,22 @@
require 'rubygems'
require 'rake'
require 'rake/clean'
require "bundler/gem_tasks"
require "rake/clean"
require "rake/testtask"
require "rdoc/task"

require_relative "lib/ipaddress/version"

require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
test.warning = true
end

begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
test.libs << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
rescue LoadError
task :rcov do
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
end
end


task :default => :test

require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
if File.exist?('VERSION.yml')
config = YAML.load(File.read('VERSION.yml'))
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
else
version = ""
end

rdoc.rdoc_dir = 'rdoc'
rdoc.title = "ipaddress #{version}"
rdoc.title = "ipaddress #{IPAddress::VERSION}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end

desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -I lib -r ipaddress.rb"
end

desc "Look for TODO and FIXME tags in the code"
task :todo do
def egrep(pattern)
Dir['**/*.rb'].each do |fn|
count = 0
open(fn) do |f|
while line = f.gets
count += 1
if line =~ pattern
puts "#{fn}:#{count}:#{line}"
end
end
end
end
end
egrep /(FIXME|TODO|TBD)/
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
test.warning = true
end

Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |raketask| load raketask }
task :default => :test
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

7 changes: 7 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "irb"
require "ipaddress"

IRB.start
27 changes: 27 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rake", "rake")
6 changes: 6 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install
Loading

0 comments on commit a64ce60

Please sign in to comment.