-
Notifications
You must be signed in to change notification settings - Fork 34
/
commands.thor
executable file
·57 lines (43 loc) · 1.08 KB
/
commands.thor
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
#!/usr/bin/env ruby
$LOAD_PATH.unshift File.expand_path("lib", File.dirname(__FILE__))
require "thor"
require "google_translate/version"
require "gemspec_deps_gen/gemspec_deps_gen"
class Commands < Thor
def initialize *params
super
@version = GoogleTranslate::VERSION
@project_name = File.basename(Dir.pwd)
end
no_commands do
def generate
generator = GemspecDepsGen.new
generator.generate_dependencies "spec", "#{@project_name}.gemspec.erb", "#{@project_name}.gemspec"
end
end
desc "build", "build"
def build
generate
system "gem build #{@project_name}.gemspec"
end
desc "install", "install"
def install
system "gem install #{@project_name}-#{@version}.gem"
end
desc "uninstall", "uninstall"
def uninstall
system "gem uninstall #{@project_name}"
end
desc "release", "release"
def release
invoke :build
system "gem push #{@project_name}-#{@version}.gem"
end
desc "rspec", "rspec"
def rspec *args
system "`which rspec` #{args.join(' ')}"
end
end
if File.basename($0) != 'thor'
Commands.start
end