Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use Bunder

* Move gemspec into a separate file
* Specify development dependencies explicitly
* Remove explicit 'gem' statements
* Remove rubygems dependency
* Use Bundler::GemHelper.install_tasks
  • Loading branch information...
commit 74b5eb08973febeba5c56f62b3b3842c4d330976 1 parent b0d0210
Erik Michaels-Ober sferik authored
1  .gitignore
View
@@ -1,4 +1,5 @@
*.gem
+.bundle
pkg/*
coverage
doc
4 Gemfile
View
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify the gem's dependencies in twitter-text.gemspec
+gemspec
50 Gemfile.lock
View
@@ -0,0 +1,50 @@
+PATH
+ remote: .
+ specs:
+ twitter-text (1.2.4)
+ actionpack
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionpack (3.0.1)
+ activemodel (= 3.0.1)
+ activesupport (= 3.0.1)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4.1)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.12)
+ rack-test (~> 0.5.4)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.1)
+ activesupport (= 3.0.1)
+ builder (~> 2.1.2)
+ i18n (~> 0.4.1)
+ activesupport (3.0.1)
+ builder (2.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ hpricot (0.8.3)
+ i18n (0.4.2)
+ rack (1.2.1)
+ rack-mount (0.6.13)
+ rack (>= 1.0.0)
+ rack-test (0.5.6)
+ rack (>= 1.0)
+ rake (0.8.7)
+ rcov (0.9.9)
+ rspec (1.3.1)
+ tzinfo (0.3.23)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ actionpack
+ hpricot
+ rake
+ rcov
+ rspec (= 1.3.1)
+ twitter-text!
52 Rakefile
View
@@ -1,35 +1,11 @@
-require 'rubygems' unless ENV['NO_RUBYGEMS']
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-require 'rubygems/specification'
-require 'date'
-
-gem 'rspec'
-require 'spec/rake/spectask'
-require 'spec/rake/verify_rcov'
-require 'digest'
-
-spec = Gem::Specification.new do |s|
- s.name = "twitter-text"
- s.version = "1.2.4"
- s.authors = ["Matt Sanford", "Patrick Ewing", "Ben Cherry", "Britt Selvitelle", "Raffi Krikorian"]
- s.email = ["matt@twitter.com", "patrick.henry.ewing@gmail.com", "bcherry@gmail.com", "bs@brittspace.com", "raffi@twitter.com"]
- s.homepage = "http://twitter.com"
- s.description = s.summary = "A gem that provides text handling for Twitter"
-
- s.platform = Gem::Platform::RUBY
- s.has_rdoc = true
- s.summary = "Twitter text handling library"
-
- s.add_dependency "actionpack"
-
- s.require_path = 'lib'
- s.autorequire = ''
- s.files = %w(LICENSE README.rdoc Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
-end
+require 'bundler'
+Bundler::GemHelper.install_tasks
task :default => :spec
+require 'spec'
+require 'spec/rake/spectask'
+require 'spec/rake/verify_rcov'
desc "Run specs"
Spec::Rake::SpecTask.new do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
@@ -45,6 +21,7 @@ Spec::Rake::SpecTask.new('spec:rcov') do |t|
end
def conformance_version(dir)
+ require 'digest'
Dir[File.join(dir, '*')].inject(Digest::SHA1.new){|digest, file| digest.update(Digest::SHA1.file(file).hexdigest) }
end
@@ -85,6 +62,7 @@ namespace :test do
end
end
+require 'rake/rdoctask'
namespace :doc do
Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
@@ -93,22 +71,6 @@ namespace :doc do
end
end
-Rake::GemPackageTask.new(spec) do |pkg|
- pkg.gem_spec = spec
-end
-
-desc "install the gem locally"
-task :install => [:package] do
- sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
-end
-
-desc "create a gemspec file"
-task :make_spec do
- File.open("#{GEM}.gemspec", "w") do |file|
- file.puts spec.to_ruby
- end
-end
-
desc "runs cruise control build"
task :cruise => [:spec, 'test:conformance'] do
end
3  lib/autolink.rb
View
@@ -1,4 +1,3 @@
-
module Twitter
# A module for including Tweet auto-linking in a class. The primary use of this is for helpers/views so they can auto-link
# usernames, lists, hashtags and URLs.
@@ -151,4 +150,4 @@ def auto_link_urls_custom(text, href_options = {})
end
end
-end
+end
1  lib/hithighlighter.rb
View
@@ -1,4 +1,3 @@
-
module Twitter
# Module for doing "hit highlighting" on tweets that have been auto-linked already.
# Useful with the results returned from the Search API.
1  lib/regex.rb
View
@@ -1,5 +1,4 @@
# encoding: utf-8
-
module Twitter
# A collection of regular expressions for parsing Tweet text. The regular expression
# list is frozen at load time to ensure immutability. These reular expressions are
8 lib/twitter-text.rb
View
@@ -1,15 +1,11 @@
-
major, minor, patch = RUBY_VERSION.split('.')
if major == 1 && minor < 9
# Ruby 1.8 KCODE check. Not needed on 1.9 and later.
- raise("twitter-text requires the $KCODE variable be set to 'UTF8' or 'u'") unless ['u','UTF8'].include?($KCODE)
+ raise("twitter-text requires the $KCODE variable be set to 'UTF8' or 'u'") unless ['u', 'UTF8'].include?($KCODE)
end
-require 'rubygems'
-
-# Needed for auto-linking
-gem 'actionpack'
+require 'action_pack'
require 'action_view'
require File.join(File.dirname(__FILE__), 'regex')
4 spec/test_urls.rb
View
@@ -23,12 +23,12 @@ module TestUrls
"http://x.com/has/one/char/domain",
"http://t.co/nwcLTFF",
# "t.co/nwcLTFF"
- ]
+ ] unless defined?(TestUrls::VALID)
INVALID = [
"http://no-tld",
"http://tld-too-short.x",
"http://-doman_dash.com"
- ]
+ ] unless defined?(TestUrls::INVALID)
end
23 twitter-text.gemspec
View
@@ -0,0 +1,23 @@
+spec = Gem::Specification.new do |s|
+ s.name = "twitter-text"
+ s.version = "1.2.4"
+ s.authors = ["Matt Sanford", "Patrick Ewing", "Ben Cherry", "Britt Selvitelle", "Raffi Krikorian"]
+ s.email = ["matt@twitter.com", "patrick.henry.ewing@gmail.com", "bcherry@gmail.com", "bs@brittspace.com", "raffi@twitter.com"]
+ s.homepage = "http://twitter.com"
+ s.description = s.summary = "A gem that provides text handling for Twitter"
+
+ s.platform = Gem::Platform::RUBY
+ s.has_rdoc = true
+ s.summary = "Twitter text handling library"
+
+ s.add_development_dependency "hpricot"
+ s.add_development_dependency "rake"
+ s.add_development_dependency "rcov"
+ s.add_development_dependency "rspec", "1.3.1"
+ s.add_runtime_dependency "actionpack"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+end
Please sign in to comment.
Something went wrong with that request. Please try again.