Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup of build system

  • Loading branch information...
commit 519ec0f07dafa80e436cc12e45bc7981bc74acd6 1 parent 9da3b84
@dbussink authored
View
2  .gitignore
@@ -5,3 +5,5 @@ cov
pkg
.DS_Store
coverage/*
+*.un~
+*.swp
View
55 Rakefile
@@ -1,49 +1,22 @@
-lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "lib"))
-$:.unshift(lib_dir)
-$:.uniq!
-
require 'rubygems'
require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-require 'rake/contrib/rubyforgepublisher'
-require 'spec/rake/spectask'
-
-require File.join(File.dirname(__FILE__), 'lib/jsonrpc', 'version')
-
-PKG_DISPLAY_NAME = 'JsonRPC'
-PKG_NAME = PKG_DISPLAY_NAME.downcase
-PKG_VERSION = JsonRPC::VERSION::STRING
-PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
-
-RELEASE_NAME = "REL #{PKG_VERSION}"
+require 'rspec'
+require 'rspec/core/rake_task'
-RUBY_FORGE_PROJECT = PKG_NAME
-RUBY_FORGE_USER = "dbussink"
-RUBY_FORGE_PATH = "/var/www/gforge-projects/#{RUBY_FORGE_PROJECT}"
-RUBY_FORGE_URL = "http://#{RUBY_FORGE_PROJECT}.rubyforge.org/"
+$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
+require "jsonrpc/version"
-PKG_SUMMARY = "JSON RPC implementation"
-PKG_DESCRIPTION = <<-TEXT
-Very simple JSON RPC client implementation
-TEXT
-PKG_FILES = FileList[
- "lib/**/*", "spec/**/*", "vendor/**/*",
- "tasks/**/*", "website/**/*",
- "[A-Z]*", "Rakefile"
-].exclude(/database\.yml/).exclude(/[_\.]git$/)
-
-RCOV_ENABLED = (RUBY_PLATFORM != "java" && RUBY_VERSION =~ /^1\.8/)
-if RCOV_ENABLED
- task :default => "spec:verify"
-else
- task :default => "spec"
+RSpec::Core::RakeTask.new do |t|
+ t.rspec_opts = %w(-fs --color)
end
-WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false
-SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
+desc "Build the gem"
+task :build do
+ system "gem build jsonrpc.gemspec"
+end
-Dir['tasks/**/*.rake'].each { |rake| load rake }
+desc "Release the gem"
+task :release => :build do
+ system "gem push jsonrpc-#{JsonRPC::VERSION}.gem"
+end
View
27 jsonrpc.gemspec
@@ -0,0 +1,27 @@
+# -*- encoding: utf-8 -*-
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
+
+require 'jsonrpc/version'
+
+Gem::Specification.new do |s|
+ s.name = "jsonrpc"
+ s.version = JsonRPC::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Dirkjan Bussink"]
+ s.email = ["d.bussink@gmail.com"]
+ s.homepage = "https://github.com/dbussink/jsonrpc"
+ s.summary = %q{JSON RPC Implementation}
+ s.description = %q{Very simple JSON RPC client implementation}
+
+ s.rubyforge_project = "jsonrpc"
+
+ s.add_dependency "addressable"
+ s.add_development_dependency "rake"
+ s.add_development_dependency "rspec", "~> 2.0"
+
+ # Man files are required because they are ignored by git
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.require_paths = ["lib"]
+end
View
12 lib/jsonrpc/version.rb
@@ -1,11 +1,5 @@
-if !defined?(JsonRPC::VERSION)
- module JsonRPC
- module VERSION #:nodoc:
- MAJOR = 0
- MINOR = 9
- TINY = 2
-
- STRING = [MAJOR, MINOR, TINY].join('.')
- end
+module JsonRPC
+ if !defined?(::JsonRPC::VERSION)
+ VERSION = "0.9.3"
end
end
View
2  tasks/clobber.rake
@@ -1,2 +0,0 @@
-desc "Remove all build products"
-task "clobber"
View
68 tasks/gem.rake
@@ -1,68 +0,0 @@
-require "rake/gempackagetask"
-
-namespace :gem do
- GEM_SPEC = Gem::Specification.new do |s|
- s.name = PKG_NAME
- s.version = PKG_VERSION
- s.summary = PKG_SUMMARY
- s.description = PKG_DESCRIPTION
-
- s.files = PKG_FILES.to_a
-
- s.has_rdoc = true
- s.extra_rdoc_files = %w( README )
- s.rdoc_options.concat ["--main", "README"]
-
- if !s.respond_to?(:add_development_dependency)
- puts "Cannot build Gem with this version of RubyGems."
- exit(1)
- end
-
- s.add_dependency("addressable")
- s.add_development_dependency("rake", ">= 0.7.3")
- s.add_development_dependency("rspec", ">= 1.0.8")
-
- s.require_path = "lib"
-
- s.author = "Dirkjan Bussink"
- s.email = "d.bussink@gmail.com"
- s.homepage = RUBY_FORGE_URL
- s.rubyforge_project = RUBY_FORGE_PROJECT
- end
-
- Rake::GemPackageTask.new(GEM_SPEC) do |p|
- p.gem_spec = GEM_SPEC
- p.need_tar = true
- p.need_zip = true
- end
-
- desc "Show information about the gem"
- task :debug do
- puts GEM_SPEC.to_ruby
- end
-
- desc "Install the gem"
- task :install => ["clobber", "gem:package"] do
- sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
- end
-
- desc "Uninstall the gem"
- task :uninstall do
- installed_list = Gem.source_index.find_name(PKG_NAME)
- if installed_list &&
- (installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
- sh(
- "#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
- "--ignore-dependencies --executables #{PKG_NAME}"
- )
- end
- end
-
- desc "Reinstall the gem"
- task :reinstall => [:uninstall, :install]
-end
-
-desc "Alias to gem:package"
-task "gem" => "gem:package"
-
-task "clobber" => ["gem:clobber_package"]
View
40 tasks/git.rake
@@ -1,40 +0,0 @@
-namespace :git do
- namespace :tag do
- desc "List tags from the Git repository"
- task :list do
- tags = `git tag -l`
- tags.gsub!("\r", "")
- tags = tags.split("\n").sort {|a, b| b <=> a }
- puts tags.join("\n")
- end
-
- desc "Create a new tag in the Git repository"
- task :create do
- changelog = File.open("CHANGELOG", "r") { |file| file.read }
- puts "-" * 80
- puts changelog
- puts "-" * 80
- puts
-
- v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
- abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
-
- tag = "#{PKG_NAME}-#{PKG_VERSION}"
- msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
-
- existing_tags = `git tag -l instrument-*`.split("\n")
- if existing_tags.include?(tag)
- warn("Tag already exists, deleting...")
- unless system "git tag -d #{tag}"
- abort "Tag deletion failed."
- end
- end
- puts "Creating git tag '#{tag}'..."
- unless system "git tag -a -m \"#{msg}\" #{tag}"
- abort "Tag creation failed."
- end
- end
- end
-end
-
-task "gem:release" => "git:tag:create"
View
22 tasks/metrics.rake
@@ -1,22 +0,0 @@
-namespace :metrics do
- task :lines do
- lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
- for file_name in FileList["lib/**/*.rb"]
- f = File.open(file_name)
- while line = f.gets
- lines += 1
- next if line =~ /^\s*$/
- next if line =~ /^\s*#/
- codelines += 1
- end
- puts "L: #{sprintf("%4d", lines)}, " +
- "LOC #{sprintf("%4d", codelines)} | #{file_name}"
- total_lines += lines
- total_codelines += codelines
-
- lines, codelines = 0, 0
- end
-
- puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
- end
-end
View
29 tasks/rdoc.rake
@@ -1,29 +0,0 @@
-require "rake/rdoctask"
-
-namespace :doc do
- desc "Generate RDoc documentation"
- Rake::RDocTask.new do |rdoc|
- rdoc.rdoc_dir = "doc"
- rdoc.title = "#{PKG_NAME}-#{PKG_VERSION} Documentation"
- rdoc.options << "--line-numbers" << "--inline-source" <<
- "--accessor" << "cattr_accessor=object" << "--charset" << "utf-8"
- rdoc.template = "#{ENV["template"]}.rb" if ENV["template"]
- rdoc.rdoc_files.include("README", "CHANGELOG", "LICENSE")
- rdoc.rdoc_files.include("lib/**/*.rb")
- end
-
- desc "Generate ri locally for testing"
- task :ri do
- sh "rdoc --ri -o ri ."
- end
-
- desc "Remove ri products"
- task :clobber_ri do
- rm_r "ri" rescue nil
- end
-end
-
-desc "Alias to doc:rdoc"
-task "doc" => "doc:rdoc"
-
-task "clobber" => ["doc:clobber_rdoc", "doc:clobber_ri"]
View
89 tasks/rubyforge.rake
@@ -1,89 +0,0 @@
-namespace :gem do
- desc 'Package and upload to RubyForge'
- task :release => ["gem:package"] do |t|
- require 'rubyforge'
-
- v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
- abort "Versions don't match #{v} vs #{PROJ.version}" if v != PKG_VERSION
- pkg = "pkg/#{GEM_SPEC.full_name}"
-
- rf = RubyForge.new
- rf.configure
- puts 'Logging in...'
- rf.login
-
- c = rf.userconfig
- changelog = File.open("CHANGELOG") { |file| file.read }
- c['release_changes'] = changelog
- c['preformatted'] = true
-
- files = ["#{pkg}.tgz", "#{pkg}.zip", "#{pkg}.gem"]
-
- puts "Releasing #{PKG_NAME} v. #{PKG_VERSION}"
- rf.add_release RUBY_FORGE_PROJECT, PKG_NAME, PKG_VERSION, *files
- end
-end
-
-namespace :doc do
- desc "Publish RDoc to RubyForge"
- task :release => ["doc:rdoc"] do
- require "rake/contrib/sshpublisher"
- require "yaml"
-
- config = YAML.load(
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
- )
- host = "#{config['username']}@rubyforge.org"
- remote_dir = RUBY_FORGE_PATH + "/api"
- local_dir = "doc"
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
- end
-end
-
-namespace :spec do
- desc "Publish specdoc to RubyForge"
- task :release => ["spec:specdoc"] do
- require "rake/contrib/sshpublisher"
- require "yaml"
-
- config = YAML.load(
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
- )
- host = "#{config['username']}@rubyforge.org"
- remote_dir = RUBY_FORGE_PATH + "/specdoc"
- local_dir = "specdoc"
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
- end
-
- namespace :rcov do
- desc "Publish coverage report to RubyForge"
- task :release => ["spec:rcov"] do
- require "rake/contrib/sshpublisher"
- require "yaml"
-
- config = YAML.load(
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
- )
- host = "#{config['username']}@rubyforge.org"
- remote_dir = RUBY_FORGE_PATH + "/coverage"
- local_dir = "coverage"
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
- end
- end
-end
-
-namespace :website do
- desc "Publish website to RubyForge"
- task :release => ["doc:release", "spec:release", "spec:rcov:release"] do
- require "rake/contrib/sshpublisher"
- require "yaml"
-
- config = YAML.load(
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
- )
- host = "#{config['username']}@rubyforge.org"
- remote_dir = RUBY_FORGE_PATH
- local_dir = "website"
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
- end
-end
View
63 tasks/spec.rake
@@ -1,63 +0,0 @@
-require 'spec/rake/verify_rcov'
-
-namespace :spec do
- Spec::Rake::SpecTask.new(:rcov) do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ['--color', '--format', 'specdoc']
- if RCOV_ENABLED
- t.rcov = true
- else
- t.rcov = false
- end
- t.rcov_opts = [
- '--exclude', 'spec',
- '--exclude', '1\\.8\\/gems',
- '--exclude', '1\\.9\\/gems',
- ]
- end
-
- Spec::Rake::SpecTask.new(:normal) do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ['--color', '--format', 'specdoc']
- t.rcov = false
- end
-
- if RCOV_ENABLED
- RCov::VerifyTask.new(:verify) do |t|
- t.threshold = 100.0
- t.index_html = 'coverage/index.html'
- end
-
- task :verify => :rcov
- end
-
- desc "Generate HTML Specdocs for all specs"
- Spec::Rake::SpecTask.new(:specdoc) do |t|
- specdoc_path = File.expand_path(
- File.join(File.dirname(__FILE__), '../specdoc/'))
- Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
-
- output_file = File.join(specdoc_path, 'index.html')
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
- t.fail_on_error = false
- end
-
- namespace :rcov do
- desc "Browse the code coverage report."
- task :browse => "spec:rcov" do
- require "launchy"
- Launchy::Browser.run("coverage/index.html")
- end
- end
-end
-
-if RCOV_ENABLED
- desc "Alias to spec:verify"
- task "spec" => "spec:verify"
-else
- desc "Alias to spec:normal"
- task "spec" => "spec:normal"
-end
-
-task "clobber" => ["spec:clobber_rcov"]
Please sign in to comment.
Something went wrong with that request. Please try again.