summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Brictson <mattbrictson@users.noreply.github.com>2017-04-17 14:52:54 -0700
committerGitHub <noreply@github.com>2017-04-17 14:52:54 -0700
commite8c8321a1a7db230f23c75517ebbeda0c614e823 (patch)
tree967e057630038e736032d4d576d5e49310398fc8
parent47a3b34ecf744654d8fab3c19c1b4e963f87a871 (diff)
downloadplist-e8c8321a1a7db230f23c75517ebbeda0c614e823.tar.gz
Reorganize project based on `bundle gem` practices (#35)
Remove the custom Rake tasks for packaging and release the gem in favor of a standard layout as suggested by the `bundle gem` command: * Add a Gemfile and gemspec * Use Bundler's built-in `gem_tasks` * Add appropriate file extension to LICENSE * Add development utils in `bin` * Move version number to `plist/version.rb` * Use Bundler's recommended `.gitignore` * Add `gem install bundler` to `.travis.yml` This reorganization allows any Ruby open source developer to easily check out, run tests, and release the gem without any special knowledge or tooling.
-rw-r--r--.gitignore12
-rw-r--r--.travis.yml2
-rw-r--r--Gemfile4
-rw-r--r--LICENSE.txt (renamed from LICENSE)0
-rw-r--r--Rakefile156
-rwxr-xr-xbin/console14
-rwxr-xr-xbin/setup8
-rw-r--r--lib/plist.rb1
-rw-r--r--lib/plist/version.rb3
-rw-r--r--plist.gemspec30
10 files changed, 76 insertions, 154 deletions
diff --git a/.gitignore b/.gitignore
index 1a91cf0..0cb6eeb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,9 @@
-rdoc
-coverage
-pkg
+/.bundle/
+/.yardoc
+/Gemfile.lock
+/_yardoc/
+/coverage/
+/doc/
+/pkg/
+/spec/reports/
+/tmp/
diff --git a/.travis.yml b/.travis.yml
index 1bb6af4..2ab9706 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,4 @@
+sudo: false
language: ruby
rvm:
- 1.9.3
@@ -8,3 +9,4 @@ rvm:
- jruby-head
- 1.8.7
- ree
+before_install: gem install bundler -v '~> 1.14' --conservative
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..304caaa
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,4 @@
+source "https://rubygems.org"
+
+# Specify your gem's dependencies in plist.gemspec
+gemspec
diff --git a/LICENSE b/LICENSE.txt
index 0ccffe7..0ccffe7 100644
--- a/LICENSE
+++ b/LICENSE.txt
diff --git a/Rakefile b/Rakefile
index ac3fcb0..30baabd 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,154 +1,10 @@
-#
-# Plist Rakefile
-#
-# Based heavily on Geoffrey Grosenbach's Rakefile for gruff.
-# Includes whitespace-fixing task based on code from Typo.
-#
-# Copyright 2006-2010 Ben Bleything and Patrick May
-# Distributed under the MIT License
-#
+require "bundler/gem_tasks"
+require "rake/testtask"
-require 'fileutils'
-require 'rubygems'
-require 'rake'
-require 'rake/testtask'
-require 'rake/packagetask'
-require 'rake/contrib/rubyforgepublisher'
-require 'rubygems/package_task'
-
-$:.unshift(File.dirname(__FILE__) + "/lib")
-require 'plist'
-
-PKG_NAME = 'plist'
-PKG_VERSION = Plist::VERSION
-PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
-
-RELEASE_NAME = "REL #{PKG_VERSION}"
-
-RUBYFORGE_PROJECT = "plist"
-RUBYFORGE_USER = ENV['RUBYFORGE_USER']
-
-TEST_FILES = Dir.glob('test/test_*')
-TEST_ASSETS = Dir.glob('test/assets/*')
-LIB_FILES = Dir.glob('lib/**/*')
-RELEASE_FILES = [ "Rakefile", "README.rdoc", "CHANGELOG", "LICENSE" ] + LIB_FILES + TEST_FILES + TEST_ASSETS
-
-task :default => [ :test ]
-# Run the unit tests
-Rake::TestTask.new { |t|
+Rake::TestTask.new(:test) do |t|
t.libs << "test"
- t.test_files = TEST_FILES
- t.verbose = true
-}
-
-desc "Clean pkg, coverage, and rdoc; remove .bak files"
-task :clean => [ :clobber_rdoc, :clobber_package, :clobber_coverage ] do
- puts cmd = "find . -type f -name *.bak -delete"
- `#{cmd}`
-end
-
-task :clobber_coverage do
- puts cmd = "rm -rf coverage"
- `#{cmd}`
-end
-
-desc "Generate coverage analysis with rcov (requires rcov to be installed)"
-task :rcov => [ :clobber_coverage ] do
- puts cmd = "rcov -Ilib --xrefs -T test/*.rb"
- puts `#{cmd}`
-end
-
-desc "Strip trailing whitespace and fix newlines for all release files"
-task :fix_whitespace => [ :clean ] do
- RELEASE_FILES.reject {|i| i =~ /assets/}.each do |filename|
- next if File.directory? filename
-
- File.open(filename) do |file|
- newfile = ''
- needs_love = false
-
- file.readlines.each_with_index do |line, lineno|
- if line =~ /[ \t]+$/
- needs_love = true
- puts "#{filename}: trailing whitespace on line #{lineno}"
- line.gsub!(/[ \t]*$/, '')
- end
-
- if line.chomp == line
- needs_love = true
- puts "#{filename}: no newline on line #{lineno}"
- line << "\n"
- end
-
- newfile << line
- end
-
- if needs_love
- tempname = "#{filename}.new"
-
- File.open(tempname, 'w').write(newfile)
- File.chmod(File.stat(filename).mode, tempname)
-
- FileUtils.ln filename, "#{filename}.bak"
- FileUtils.ln tempname, filename, :force => true
- File.unlink(tempname)
- end
- end
- end
-end
-
-desc "Copy documentation to rubyforge"
-task :update_rdoc => [ :rdoc ] do
- Rake::SshDirPublisher.new("#{RUBYFORGE_USER}@rubyforge.org", "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}", "rdoc").upload
-end
-
-begin
- require 'rdoc/task'
-
- # Generate the RDoc documentation
- RDoc::Task.new do |rdoc|
- rdoc.title = "All-purpose Property List manipulation library"
- rdoc.main = "README.rdoc"
-
- rdoc.rdoc_dir = 'rdoc'
- rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'CHANGELOG')
- rdoc.rdoc_files.include('lib/**')
-
- rdoc.options = [
- '-H', # show hash marks on method names in comments
- '-N', # show line numbers
- ]
- end
-rescue LoadError
- $stderr.puts "Could not load rdoc tasks"
-end
-
-# Create compressed packages
-spec = Gem::Specification.new do |s|
- s.name = PKG_NAME
- s.version = PKG_VERSION
-
- s.summary = "All-purpose Property List manipulation library."
- s.description = <<-EOD
-Plist is a library to manipulate Property List files, also known as plists. It can parse plist files into native Ruby data structures as well as generating new plist files from your Ruby objects.
-EOD
-
- s.authors = "Ben Bleything and Patrick May"
- s.homepage = "http://plist.rubyforge.org"
-
- s.rubyforge_project = RUBYFORGE_PROJECT
-
- s.has_rdoc = true
-
- s.files = RELEASE_FILES
- s.test_files = TEST_FILES
-
- s.autorequire = 'plist'
-end
-
-Gem::PackageTask.new(spec) do |p|
- p.gem_spec = spec
- p.need_tar = true
- p.need_zip = true
+ t.libs << "lib"
+ t.test_files = FileList["test/**/test_*.rb"]
end
+task :default => :test
diff --git a/bin/console b/bin/console
new file mode 100755
index 0000000..90836fa
--- /dev/null
+++ b/bin/console
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+
+require "bundler/setup"
+require "plist"
+
+# 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.
+
+# (If you use this, don't forget to add pry to your Gemfile!)
+# require "pry"
+# Pry.start
+
+require "irb"
+IRB.start(__FILE__)
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 0000000..dce67d8
--- /dev/null
+++ b/bin/setup
@@ -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
diff --git a/lib/plist.rb b/lib/plist.rb
index d13ae8a..3fed788 100644
--- a/lib/plist.rb
+++ b/lib/plist.rb
@@ -17,5 +17,4 @@ require 'plist/generator'
require 'plist/parser'
module Plist
- VERSION = '3.2.0'
end
diff --git a/lib/plist/version.rb b/lib/plist/version.rb
new file mode 100644
index 0000000..bbc5885
--- /dev/null
+++ b/lib/plist/version.rb
@@ -0,0 +1,3 @@
+module Plist
+ VERSION = '3.2.0'.freeze
+end
diff --git a/plist.gemspec b/plist.gemspec
new file mode 100644
index 0000000..343dbcb
--- /dev/null
+++ b/plist.gemspec
@@ -0,0 +1,30 @@
+# coding: utf-8
+
+lib = File.expand_path("../lib", __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require "plist/version"
+
+Gem::Specification.new do |spec|
+ spec.name = "plist"
+ spec.version = Plist::VERSION
+ spec.authors = ["Ben Bleything", "Patrick May"]
+
+ spec.summary = "All-purpose Property List manipulation library"
+ spec.description = "Plist is a library to manipulate Property List files, "\
+ "also known as plists. It can parse plist files into "\
+ "native Ruby data structures as well as generating new "\
+ "plist files from your Ruby objects."
+ spec.homepage = "https://github.com/patsplat/plist"
+ spec.license = "MIT"
+
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
+ f.match(%r{^(test|spec|features)/})
+ end
+ spec.bindir = "exe"
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
+ spec.require_paths = ["lib"]
+
+ spec.add_development_dependency "bundler", "~> 1.14"
+ spec.add_development_dependency "rake", "~> 10.5"
+ spec.add_development_dependency "test-unit", "~> 1.2"
+end