-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
53 lines (38 loc) · 1.47 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
require 'bundler'
require 'metric_fu'
Bundler::GemHelper.install_tasks
require 'rdoc/task'
require 'sdoc'
task :default => [:test]
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:test) do |spec|
spec.skip_bundler = true
spec.pattern = ['spec/*_spec.rb', 'spec/provisioning/*_spec.rb']
spec.rspec_opts = '--color --format doc'
end
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.title = "connFu DSL #{Connfu::VERSION} documentation"
rdoc.rdoc_files.include('README.rdoc', 'LICENSE.txt')
rdoc.rdoc_files.include('lib/**/*.rb')
#rdoc.rdoc_files.include('examples/**/*.rb')
rdoc.options << '-f' << 'sdoc'
rdoc.options << '-T' << 'connfu'
rdoc.options << '-c' << 'utf-8'
rdoc.options << '-g'
rdoc.options << '-m' << 'README.rdoc'
#rdoc.rdoc_files.include('README*')
end
# extracted from https://github.com/grosser/project_template
desc "Bump version"
rule /^version:bump:.*/ do |t|
sh "git status | grep 'nothing to commit'" # ensure we are not dirty
index = ['major', 'minor','patch'].index(t.name.split(':').last)
file = 'lib/connfu/version.rb'
version_file = File.read(file)
old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
version_parts[index] = version_parts[index].to_i + 1
new_version = version_parts * '.'
File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
sh "bundle && git add -f #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
end