-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
59 lines (49 loc) · 1.41 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
# assumes:
# * current directory name is gem name, eg 'cx-finance'
# * gem name has syntax "#{lib_prefix}-#{lib_module}"
# * sub directories are "lib/#{lib_prefix}/#{lib_module}"
# * version is stored in file "lib/#{lib_prefix}/#{lib_module}/version.rb"
# * gem namespace module is "#{lib_prefix.upcase}::#{lib_module.capitalize}"
# * version string is const_get("#{lib_prefix.upcase}::#{lib_module.capitalize}")"::VERSION
gem_name = Dir.pwd.split('/').last
lib_prefix = gem_name.split('-').first
lib_module = gem_name.split('-').last
require_relative "./lib/#{lib_prefix}/#{lib_module}/version"
gem_module = Kernel.const_get("#{lib_prefix.upcase}::#{lib_module.capitalize}")
gem_version = gem_module::VERSION
task :version do
puts "#{gem_name}-#{gem_version}"
end
task :commit do
begin
sh 'git add -A'
sh 'git commit -m "added unicode.rb"'
rescue Exception => x
puts x.message
end
end
task :build_gem do
sh 'rake commit'
sh "gem build #{gem_name}.gemspec"
sh "gem install #{gem_name}-#{gem_version}.gem"
end
task :git_origin do
sh 'rake commit'
sh "git remote add origin https://github.com/balmoral/#{gem_name}.git"
sh 'git push -u origin master'
end
task :push_git do
sh 'rake commit'
sh 'git push'
end
task :push_gem do
sh 'rake push_git'
sh "gem push #{gem_name}-#{gem_version}.gem"
end
task :irb do
sh 'rake build'
sh 'bundle exec irb'
end
task :pry do
sh 'pry -r ./lib/cx/finance'
end