Skip to content

Commit

Permalink
Gemified.
Browse files Browse the repository at this point in the history
  • Loading branch information
grimen committed Nov 21, 2009
1 parent 55ec28e commit 2b83a79
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 74 deletions.
7 changes: 4 additions & 3 deletions .gitignore
@@ -1,4 +1,5 @@
.DS_Store
*~
*.tmproj
pkg
*.iml
*.ipr
*.iws
coverage
85 changes: 66 additions & 19 deletions Rakefile
@@ -1,27 +1,74 @@
require 'spec/rake/spectask'
# coding: utf-8
require 'rubygems'
require 'rake'
require 'rake/rdoctask'

task :default => :spec
Spec::Rake::SpecTask.new
begin
require 'spec/rake/spectask'
rescue LoadError
begin
gem 'rspec-rails', '>= 1.0.0'
require 'spec/rake/spectask'
rescue LoadError
puts "RSpec - or one of it's dependencies - is not available. Install it with: sudo gem install rspec-rails"
end
end

NAME = "rspec_tag_matchers"
SUMMARY = %Q{Implementation of have_tag() RSpec matcher using Nokogiri.}
DESCRIPTION = <<-END
rspec_tag_matchers provides an implementation of rspec_on_rails'
have_tag() matcher which does not depend on Rails' assert_select().
Using Nokogiri instead, the matcher is available to non-Rails projects,
and enjoys the full flexibility of Nokogiri's advanced and blazing fast
CSS and XPath selector support. Forked from rspec_hpricot_matchers.
END
HOMEPAGE = "http://github.com/grimen/#{NAME}"
AUTHOR = "Kyle Hargraves"
EMAIL = "pd@krh.me"
SUPPORT_FILES = %w(README)

begin
gem 'jeweler', '>= 1.0.0'
require 'jeweler'

Jeweler::Tasks.new do |gemspec|
gemspec.name = 'rspec_hpricot_matchers'
gemspec.author = 'Kyle Hargraves'
gemspec.email = 'pd@krh.me'
gemspec.summary = "Implementation of have_tag() rspec matcher using Hpricot"
gemspec.description = <<-END
rspec_hpricot_matchers provides an implementation of rspec_on_rails'
have_tag() matcher which does not depend on Rails' assert_select.
Using Hpricot instead, the matcher is available to non-Rails projects,
and enjoys the full flexibility of Hpricot's advanced CSS and XPath
selector support.
END

# Really, I don't care about rubyforge. Maybe I'll get this
# working some day.
# gemspec.rubyforge_project = 'rspec-hpricot'
gemspec.name = NAME
gemspec.summary = SUMMARY
gemspec.description = DESCRIPTION
gemspec.homepage = HOMEPAGE
gemspec.author = AUTHOR
gemspec.email = EMAIL

gemspec.require_paths = %w{lib}
gemspec.files = SUPPORT_FILES << %w(MIT-LICENSE Rakefile) << Dir.glob(File.join(*%w[{generators,lib,test} ** *]).to_s)
gemspec.extra_rdoc_files = SUPPORT_FILES

gemspec.add_dependency 'nokogiri', '>= 1.4.0'
gemspec.add_dependency 'rspec-rails', '>= 1.2.6'
end

Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler unavailable, packaging tasks can not be run. Install it, thanks."
puts "Jeweler - or one of it's dependencies - is not available. Install it with: sudo gem install jeweler -s http://gemcutter.org"
end

desc 'Default: Run specs.'
task :default => :spec

desc %Q{Generate documentation.}
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = NAME
rdoc.options << '--line-numbers' << '--inline-source' << '--charset=UTF-8'
rdoc.rdoc_files.include(SUPPORT_FILES)
rdoc.rdoc_files.include(File.join(*%w[lib ** *.rb]))
end

#if defined?(Spec)
desc 'Run specs.'
Spec::Rake::SpecTask.new('spec') do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = ['-c']
end
#end
3 changes: 2 additions & 1 deletion lib/rspec_hpricot_matchers.rb → lib/rspec_tag_matchers.rb
@@ -1,7 +1,8 @@
# coding: utf-8
require 'rubygems'
require 'nokogiri'

require 'rspec_hpricot_matchers/have_tag'
require 'rspec_tag_matchers/have_tag'

class Nokogiri::XML::Element
alias body inner_html
Expand Down
@@ -1,4 +1,6 @@
module RspecHpricotMatchers
# coding: utf-8

module RspecTagMatchers
class HaveTag
def initialize(selector, inner_text_or_options, options, &block)
@selector = selector
Expand Down
46 changes: 0 additions & 46 deletions rspec_hpricot_matchers.gemspec

This file was deleted.

59 changes: 59 additions & 0 deletions rspec_tag_matchers.gemspec
@@ -0,0 +1,59 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{rspec_tag_matchers}
s.version = "1.2.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Kyle Hargraves"]
s.date = %q{2009-11-22}
s.description = %q{ rspec_tag_matchers provides an implementation of rspec_on_rails'
have_tag() matcher which does not depend on Rails' assert_select().
Using Nokogiri instead, the matcher is available to non-Rails projects,
and enjoys the full flexibility of Nokogiri's advanced and blazing fast
CSS and XPath selector support. Forked from rspec_hpricot_matchers.
}
s.email = %q{pd@krh.me}
s.extra_rdoc_files = [
"MIT-LICENSE",
"README",
"Rakefile",
"lib/rspec_tag_matchers.rb",
"lib/rspec_tag_matchers/have_tag.rb"
]
s.files = [
"MIT-LICENSE",
"README",
"Rakefile",
"lib/rspec_tag_matchers.rb",
"lib/rspec_tag_matchers/have_tag.rb"
]
s.homepage = %q{http://github.com/grimen/rspec_tag_matchers}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
s.summary = %q{Implementation of have_tag() RSpec matcher using Nokogiri.}
s.test_files = [
"spec/rspec_tag_matchers/have_tag_spec.rb",
"spec/spec_helper.rb"
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.0"])
s.add_runtime_dependency(%q<rspec-rails>, [">= 1.2.6"])
else
s.add_dependency(%q<nokogiri>, [">= 1.4.0"])
s.add_dependency(%q<rspec-rails>, [">= 1.2.6"])
end
else
s.add_dependency(%q<nokogiri>, [">= 1.4.0"])
s.add_dependency(%q<rspec-rails>, [">= 1.2.6"])
end
end
@@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../spec_helper'
# coding: utf-8
require File.join(File.dirname(__FILE__), *%w[.. spec_helper])

describe 'have_tag' do
before(:each) do
Expand Down
7 changes: 4 additions & 3 deletions spec/spec_helper.rb
@@ -1,8 +1,9 @@
$: << File.dirname(__FILE__) + '/../lib'
require 'rspec_hpricot_matchers'
# coding: utf-8
$: << File.join(File.dirname(__FILE__), *%w[.. lib])
require 'rspec_tag_matchers'

Spec::Runner.configure do |config|
config.include(RspecHpricotMatchers)
config.include(RspecTagMatchers)
end

unless defined?(SpecFailed)
Expand Down

0 comments on commit 2b83a79

Please sign in to comment.