Permalink
Browse files

use RSpec2 and Jeweler

  • Loading branch information...
1 parent ab87df9 commit 6f5b6172634522609f7e05e88d7303b871ae3150 @youpy committed Nov 7, 2011
Showing with 32 additions and 114 deletions.
  1. 0 spec/spec.opts → .rspec
  2. +31 −98 Rakefile
  3. +0 −2 spec/analysis_spec.rb
  4. +0 −3 spec/api_spec.rb
  5. +0 −3 spec/echonest_spec.rb
  6. +0 −2 spec/response_spec.rb
  7. +1 −3 spec/spec_helper.rb
  8. +0 −3 spec/track_spec.rb
File renamed without changes.
View
@@ -1,109 +1,42 @@
require 'rubygems'
require 'rake'
-require 'rake/clean'
-require 'rake/testtask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-require 'rake/contrib/sshpublisher'
-require 'spec/rake/spectask'
-require 'fileutils'
-include FileUtils
-$LOAD_PATH.unshift "lib"
-require "echonest"
-
-NAME = "ruby-echonest"
-AUTHOR = "youpy"
-EMAIL = "youpy@buycheapviagraonlinenow.com"
-DESCRIPTION = "An Ruby interface for Echo Nest Developer API"
-RUBYFORGE_PROJECT = "ruby-echonest"
-HOMEPATH = "http://github.com/youpy/ruby-echonest"
-BIN_FILES = %w( )
-VERS = Echonest::VERSION
-
-REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
-CLEAN.include ['**/.*.sw?', '*.gem', '.config']
-RDOC_OPTS = [
- '--title', "#{NAME} documentation",
- "--charset", "utf-8",
- "--opname", "index.html",
- "--line-numbers",
- "--main", "README.rdoc",
- "--inline-source",
-]
-
-task :default => [:spec]
-task :package => [:clean]
-
-Spec::Rake::SpecTask.new do |t|
- t.spec_opts = ['--options', "spec/spec.opts"]
- t.spec_files = FileList['spec/*_spec.rb']
- t.rcov = true
-end
-
-spec = Gem::Specification.new do |s|
- s.name = NAME
- s.version = VERS
- s.platform = Gem::Platform::RUBY
- s.has_rdoc = true
- s.extra_rdoc_files = ["README.rdoc", "ChangeLog"]
- s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
- s.summary = DESCRIPTION
- s.description = DESCRIPTION
- s.author = AUTHOR
- s.email = EMAIL
- s.homepage = HOMEPATH
- s.executables = BIN_FILES
- s.rubyforge_project = RUBYFORGE_PROJECT
- s.bindir = "bin"
- s.require_path = "lib"
- s.test_files = Dir["test/test_*.rb"]
-
- s.add_dependency('libxml-ruby')
- s.add_dependency('httpclient')
- s.add_dependency('hashie')
- #s.required_ruby_version = '>= 1.8.2'
-
- s.files = %w(README.rdoc ChangeLog Rakefile) +
- Dir.glob("{bin,doc,spec,test,lib,templates,generator,extras,website,script}/**/*") +
- Dir.glob("ext/**/*.{h,c,rb}") +
- Dir.glob("examples/**/*.rb") +
- Dir.glob("tools/*.rb")
-
- s.extensions = FileList["ext/**/extconf.rb"].to_a
+begin
+ $LOAD_PATH.unshift "lib"
+ require 'echonest'
+ require 'jeweler'
+ Jeweler::Tasks.new do |gem|
+ gem.name = "ruby-echonest"
+ gem.version = Echonest::VERSION
+ gem.summary = "An Ruby interface for Echo Nest Developer API"
+ gem.description = "An Ruby interface for Echo Nest Developer API"
+ gem.email = "youpy@buycheapviagraonlinenow.com"
+ gem.homepage = "http://github.com/youpy/ruby-echonest"
+ gem.authors = ["youpy"]
+ gem.add_development_dependency "rspec", ">= 2.0.0"
+ gem.add_dependency "httpclient"
+ gem.add_dependency "hashie"
+ gem.add_dependency "libxml-ruby"
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
+ end
+ Jeweler::GemcutterTasks.new
+rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end
-Rake::GemPackageTask.new(spec) do |p|
- p.need_tar = true
- p.gem_spec = spec
-end
+require 'rspec/core/rake_task'
-task :install do
- name = "#{NAME}-#{VERS}.gem"
- sh %{rake package}
- sh %{sudo gem install pkg/#{name}}
+RSpec::Core::RakeTask.new(:core) do |spec|
+ spec.pattern = 'spec/**/*_spec.rb'
end
-task :uninstall => [:clean] do
- sh %{sudo gem uninstall #{NAME}}
-end
+task :core => :check_dependencies
+task :default => :core
+require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
- rdoc.rdoc_dir = 'html'
- rdoc.options += RDOC_OPTS
- rdoc.template = "resh"
- #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
- if ENV['DOC_FILES']
- rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
- else
- rdoc.rdoc_files.include('README', 'ChangeLog')
- rdoc.rdoc_files.include('lib/**/*.rb')
- rdoc.rdoc_files.include('ext/**/*.c')
- end
-end
-
-desc "Show information about the gem"
-task :debug_gem do
- puts spec.to_ruby
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = "echonest %s" % Echonest::VERSION
+ rdoc.rdoc_files.include('README*')
+ rdoc.rdoc_files.include('lib/**/*.rb')
end
@@ -2,8 +2,6 @@
require 'spec_helper'
-include SpecHelper
-
describe Echonest::Analysis do
before do
@analysis = Echonest::Analysis.new(open(fixture('analysis.json')).read)
View
@@ -1,9 +1,6 @@
$:.unshift File.dirname(__FILE__)
require 'spec_helper'
-require "echonest"
-
-include SpecHelper
describe Echonest::Api do
before do
@@ -1,9 +1,6 @@
$:.unshift File.dirname(__FILE__)
require 'spec_helper'
-require "echonest"
-
-include SpecHelper
describe Echonest do
it "should return an instance of Echonest::Api" do
@@ -2,8 +2,6 @@
require 'spec_helper'
-include SpecHelper
-
describe Echonest::Response do
before do
@success = Echonest::Response.new(open(fixture('profile.json')).read)
View
@@ -2,10 +2,8 @@
require 'echonest'
-module SpecHelper
+RSpec.configure do |config|
def fixture(filename)
File.dirname(__FILE__) + '/fixtures/' + filename
end
end
-
-
View
@@ -1,9 +1,6 @@
$:.unshift File.dirname(__FILE__)
require 'spec_helper'
-require "echonest"
-
-include SpecHelper
describe Echonest::ApiMethods::Track do
before do

0 comments on commit 6f5b617

Please sign in to comment.