-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
76 lines (60 loc) · 1.86 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
require "rubygems"
require "rake/gempackagetask"
require "rake/rdoctask"
require "rake/testtask"
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList["test/**/*_test.rb"]
t.verbose = true
end
task :default => ["test"]
spec = Gem::Specification.new do |s|
s.name = "rrrex"
s.version = "0.1.0"
s.author = "Ian Young"
s.email = "[email protected]"
s.summary = "Really Readable Regexps"
s.description = <<-EOF
Rrrex is a new syntax for regular expressions.
Less compact, but human-readable. By regular humans.
EOF
s.homepage = "https://github.com/iangreenleaf/rrrex"
s.files = Dir[ 'lib/**/*.rb', 'test/**/*', '[A-Z]*' ]
s.has_rdoc = true
s.extra_rdoc_files = %w(README.md)
s.rdoc_options = %w(--main README.md)
s.add_development_dependency("mocha")
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
end
desc "Build the gemspec file #{spec.name}.gemspec"
task :gemspec do
file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
File.open(file, "w") {|f| f << spec.to_ruby }
end
task :package => :gemspec
Rake::RDocTask.new do |rd|
rd.main = "README.md"
rd.rdoc_files.include("README.md", "lib/**/*.rb")
rd.rdoc_dir = "rdoc"
end
desc 'Clear out RDoc and generated packages'
task :clean => [:clobber_rdoc, :clobber_package] do
rm "#{spec.name}.gemspec"
end
desc 'Tag the repository in git with gem version number'
task :tag => [:gemspec, :package] do
if `git diff --cached`.empty?
if `git tag`.split("\n").include?("v#{spec.version}")
raise "Version #{spec.version} has already been released"
end
`git add #{File.expand_path("../#{spec.name}.gemspec", __FILE__)}`
`git commit -m "Released version #{spec.version}"`
`git tag v#{spec.version}`
`git push --tags`
`git push`
else
raise "Unstaged changes still waiting to be committed"
end
end