Skip to content

Commit a61dc49

Browse files
committed
Just use the gemspec file inside the Rakefile and don't completely recreate it
1 parent 8e32c44 commit a61dc49

File tree

2 files changed

+9
-46
lines changed

2 files changed

+9
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ Gemfile.lock
88
.bundle
99
*.gem
1010
*.patch
11+
vendor/bundle/*

Rakefile

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,19 @@
1-
require 'rubygems'
2-
require 'rake/gempackagetask'
3-
require 'rubygems/specification'
4-
require 'date'
5-
require 'spec/rake/spectask'
1+
require 'rubygems/package_task'
2+
require 'rspec/core/rake_task'
63

7-
GEM = "htmldiff"
8-
GEM_VERSION = "0.0.1"
9-
AUTHOR = "Nathan Herald"
10-
11-
HOMEPAGE = "http://github.com/myobie/htmldiff"
12-
SUMMARY = "HTML diffs of text (borrowed from a wiki software I no longer remember)"
4+
spec = Gem::Specification.load(File.expand_path('htmldiff.gemspec', __dir__))
135

14-
spec = Gem::Specification.new do |s|
15-
s.name = GEM
16-
s.version = GEM_VERSION
17-
s.platform = Gem::Platform::RUBY
18-
s.has_rdoc = true
19-
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
20-
s.summary = SUMMARY
21-
s.description = s.summary
22-
s.author = AUTHOR
23-
s.email = EMAIL
24-
s.homepage = HOMEPAGE
25-
26-
# Uncomment this to add a dependency
27-
# s.add_dependency "foo"
28-
29-
s.require_path = 'lib'
30-
s.autorequire = GEM
31-
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
6+
RSpec::Core::RakeTask.new(:spec) do |t|
7+
t.pattern = 'spec/**/*_spec.rb'
328
end
339

3410
task :default => :spec
3511

36-
desc "Run specs"
37-
Spec::Rake::SpecTask.new do |t|
38-
t.spec_files = FileList['spec/**/*_spec.rb']
39-
t.spec_opts = %w(-fs --color)
40-
end
41-
42-
43-
Rake::GemPackageTask.new(spec) do |pkg|
12+
Gem::PackageTask.new(spec) do |pkg|
4413
pkg.gem_spec = spec
4514
end
4615

47-
desc "install the gem locally"
16+
desc "Install the gem locally"
4817
task :install => [:package] do
49-
sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
18+
sh "gem install pkg/#{GEM}-#{GEM_VERSION}.gem"
5019
end
51-
52-
desc "create a gemspec file"
53-
task :make_spec do
54-
File.open("#{GEM}.gemspec", "w") do |file|
55-
file.puts spec.to_ruby
56-
end
57-
end

0 commit comments

Comments
 (0)