turbot 0.1.36 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/.rspec +3 -0
- data/.travis.yml +15 -0
- data/.yardopts +3 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +44 -25
- data/Rakefile +16 -0
- data/appveyor.yml +35 -0
- data/bin/turbot +2 -16
- data/data/schema.json +134 -0
- data/{templates → data/templates}/LICENSE.txt +0 -0
- data/{templates → data/templates}/manifest.json +0 -0
- data/{templates → data/templates}/python/scraper.py +0 -0
- data/{templates → data/templates}/ruby/scraper.rb +0 -0
- data/dist/deb.rake +32 -0
- data/dist/gem.rake +16 -0
- data/dist/manifest.rake +9 -0
- data/dist/pkg.rake +60 -0
- data/dist/resources/deb/control +10 -0
- data/dist/resources/deb/postinst +45 -0
- data/dist/resources/deb/turbot +25 -0
- data/dist/resources/deb/turbot-release-key.txt +30 -0
- data/dist/resources/pkg/Distribution.erb +15 -0
- data/dist/resources/pkg/PackageInfo.erb +6 -0
- data/dist/resources/pkg/postinstall +45 -0
- data/dist/resources/pkg/turbot +24 -0
- data/dist/resources/tgz/turbot +24 -0
- data/dist/rpm.rake +35 -0
- data/dist/tgz.rake +26 -0
- data/dist/zip.rake +40 -0
- data/lib/turbot.rb +18 -15
- data/lib/turbot/cli.rb +10 -27
- data/lib/turbot/command.rb +59 -212
- data/lib/turbot/command/auth.rb +72 -34
- data/lib/turbot/command/base.rb +22 -61
- data/lib/turbot/command/bots.rb +251 -300
- data/lib/turbot/command/help.rb +57 -110
- data/lib/turbot/command/version.rb +6 -10
- data/lib/turbot/handlers/base_handler.rb +21 -0
- data/lib/turbot/handlers/dump_handler.rb +10 -0
- data/lib/turbot/handlers/preview_handler.rb +30 -0
- data/lib/turbot/handlers/validation_handler.rb +17 -0
- data/lib/turbot/helpers.rb +14 -482
- data/lib/turbot/helpers/api_helper.rb +41 -0
- data/lib/turbot/helpers/netrc_helper.rb +66 -0
- data/lib/turbot/helpers/shell_helper.rb +36 -0
- data/lib/turbot/version.rb +1 -1
- data/spec/fixtures/bad_permissions +0 -0
- data/spec/fixtures/empty +0 -0
- data/spec/fixtures/netrc +6 -0
- data/spec/spec_helper.rb +17 -219
- data/spec/support/bot_helper.rb +102 -0
- data/spec/support/command_helper.rb +20 -0
- data/spec/support/custom_matchers.rb +5 -0
- data/spec/support/fixture_helper.rb +9 -0
- data/spec/support/netrc_helper.rb +21 -0
- data/spec/turbot/command/auth_spec.rb +202 -20
- data/spec/turbot/command/base_spec.rb +22 -58
- data/spec/turbot/command/bots_spec.rb +580 -89
- data/spec/turbot/command/help_spec.rb +32 -75
- data/spec/turbot/command/version_spec.rb +11 -10
- data/spec/turbot/command_spec.rb +55 -87
- data/spec/turbot/helpers_spec.rb +28 -44
- data/turbot.gemspec +31 -0
- metadata +88 -178
- data/data/cacert.pem +0 -3988
- data/lib/turbot/auth.rb +0 -315
- data/lib/turbot/client.rb +0 -757
- data/lib/turbot/client/cisaurus.rb +0 -25
- data/lib/turbot/client/pgbackups.rb +0 -113
- data/lib/turbot/client/rendezvous.rb +0 -111
- data/lib/turbot/client/ssl_endpoint.rb +0 -25
- data/lib/turbot/client/turbot_postgresql.rb +0 -148
- data/lib/turbot/command/ssl.rb +0 -43
- data/lib/turbot/deprecated.rb +0 -5
- data/lib/turbot/deprecated/help.rb +0 -38
- data/lib/turbot/distribution.rb +0 -9
- data/lib/turbot/errors.rb +0 -28
- data/lib/turbot/excon.rb +0 -11
- data/lib/turbot/helpers/log_displayer.rb +0 -70
- data/lib/turbot/helpers/pg_dump_restore.rb +0 -115
- data/lib/turbot/helpers/turbot_postgresql.rb +0 -213
- data/lib/turbot/plugin.rb +0 -165
- data/lib/turbot/updater.rb +0 -171
- data/lib/vendor/turbot/okjson.rb +0 -598
- data/spec/helper/legacy_help.rb +0 -16
- data/spec/helper/pg_dump_restore_spec.rb +0 -67
- data/spec/spec.opts +0 -1
- data/spec/support/display_message_matcher.rb +0 -49
- data/spec/support/dummy_api.rb +0 -120
- data/spec/support/openssl_mock_helper.rb +0 -8
- data/spec/support/organizations_mock_helper.rb +0 -11
- data/spec/turbot/auth_spec.rb +0 -214
- data/spec/turbot/client/pgbackups_spec.rb +0 -43
- data/spec/turbot/client/rendezvous_spec.rb +0 -62
- data/spec/turbot/client/ssl_endpoint_spec.rb +0 -48
- data/spec/turbot/client/turbot_postgresql_spec.rb +0 -71
- data/spec/turbot/client_spec.rb +0 -548
- data/spec/turbot/helpers/turbot_postgresql_spec.rb +0 -181
- data/spec/turbot/plugin_spec.rb +0 -172
- data/spec/turbot/updater_spec.rb +0 -44
data/dist/pkg.rake
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require "erb"
|
2
|
+
|
3
|
+
file pkg("turbot-#{version}.pkg") => distribution_files("pkg") do |t|
|
4
|
+
tempdir do |dir|
|
5
|
+
mkchdir("turbot-client") do
|
6
|
+
assemble_distribution
|
7
|
+
assemble_gems
|
8
|
+
assemble resource("pkg/turbot"), "bin/turbot", 0755
|
9
|
+
end
|
10
|
+
|
11
|
+
kbytes = %x{ du -ks turbot-client | cut -f 1 }
|
12
|
+
num_files = %x{ find turbot-client | wc -l }
|
13
|
+
|
14
|
+
mkdir_p "pkg"
|
15
|
+
mkdir_p "pkg/Resources"
|
16
|
+
mkdir_p "pkg/turbot-client.pkg"
|
17
|
+
|
18
|
+
dist = File.read(resource("pkg/Distribution.erb"))
|
19
|
+
dist = ERB.new(dist).result(binding)
|
20
|
+
File.open("pkg/Distribution", "w") { |f| f.puts dist }
|
21
|
+
|
22
|
+
dist = File.read(resource("pkg/PackageInfo.erb"))
|
23
|
+
dist = ERB.new(dist).result(binding)
|
24
|
+
File.open("pkg/turbot-client.pkg/PackageInfo", "w") { |f| f.puts dist }
|
25
|
+
|
26
|
+
mkdir_p "pkg/turbot-client.pkg/Scripts"
|
27
|
+
cp resource("pkg/postinstall"), "pkg/turbot-client.pkg/Scripts/postinstall"
|
28
|
+
chmod 0755, "pkg/turbot-client.pkg/Scripts/postinstall"
|
29
|
+
|
30
|
+
sh %{ mkbom -s turbot-client pkg/turbot-client.pkg/Bom }
|
31
|
+
|
32
|
+
Dir.chdir("turbot-client") do
|
33
|
+
sh %{ pax -wz -x cpio . > ../pkg/turbot-client.pkg/Payload }
|
34
|
+
end
|
35
|
+
|
36
|
+
sh %{ curl http://s3.amazonaws.com/static.xavierriley.co.uk/ruby-1.9.3-p194.pkg -o ruby.pkg }
|
37
|
+
sh %{ pkgutil --expand ruby.pkg ruby }
|
38
|
+
package_info_file = "ruby/ruby-1.9.3-p194.pkg/PackageInfo"
|
39
|
+
text = File.read(package_info_file)
|
40
|
+
File.open(package_info_file, "w") { |file| file << text.gsub("heroku", "turbot") }
|
41
|
+
mv "ruby/ruby-1.9.3-p194.pkg", "pkg/ruby.pkg"
|
42
|
+
cp_r resource("pkg/ruby/ruby-1.9.3-p194.pkg"), "pkg/ruby.pkg"
|
43
|
+
|
44
|
+
sh %{ pkgutil --flatten pkg turbot-#{version}.pkg }
|
45
|
+
|
46
|
+
cp_r "turbot-#{version}.pkg", t.name
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "build pkg"
|
51
|
+
task "pkg:build" => pkg("turbot-#{version}.pkg")
|
52
|
+
|
53
|
+
desc "clean pkg"
|
54
|
+
task "pkg:clean" do
|
55
|
+
clean pkg("turbot-#{version}.pkg")
|
56
|
+
end
|
57
|
+
|
58
|
+
task "pkg:release" do
|
59
|
+
raise "pkg:release moved to toolbelt repo"
|
60
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Package: turbot
|
2
|
+
Version: <%= version %>
|
3
|
+
Section: utils
|
4
|
+
Priority: standard
|
5
|
+
Architecture: amd64
|
6
|
+
Depends: ruby (>= 1.9.1), libopenssl-ruby (>= 1.9.1), libreadline-ruby (>= 1.9.1), libssl0.9.8 (>= 0.9.8k) | libssl1.0.0, libc6
|
7
|
+
Maintainer: Turbot <info@opencorporates.com>
|
8
|
+
Description: Client library and CLI to deploy apps on Turbot.
|
9
|
+
Turbot is a command line tool to help validate and post scrapers
|
10
|
+
("bots") to the opencorporates data ingestion pipeline.
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
usershell=$SHELL
|
4
|
+
|
5
|
+
startup_files() {
|
6
|
+
case $(basename $usershell) in
|
7
|
+
zsh)
|
8
|
+
echo ".zlogin .zshrc .zprofile .zshenv"
|
9
|
+
;;
|
10
|
+
bash)
|
11
|
+
echo ".bashrc .bash_profile .bash_login .profile"
|
12
|
+
;;
|
13
|
+
*)
|
14
|
+
echo ".bash_profile .zshrc .profile"
|
15
|
+
;;
|
16
|
+
esac
|
17
|
+
}
|
18
|
+
|
19
|
+
install_path() {
|
20
|
+
for file in $(startup_files); do
|
21
|
+
[ -f $HOME/$file ] || continue
|
22
|
+
(grep "Added by the Turbot" $HOME/$file >/dev/null) && break
|
23
|
+
|
24
|
+
cat <<MESSAGE >>$HOME/$file
|
25
|
+
|
26
|
+
### Added by the Turbot Toolbelt
|
27
|
+
export PATH="/usr/local/turbot/bin:\$PATH"
|
28
|
+
MESSAGE
|
29
|
+
|
30
|
+
# done after we add to one file
|
31
|
+
break
|
32
|
+
done
|
33
|
+
}
|
34
|
+
|
35
|
+
# if the toolbelt is not returned by `which`, let's add to the PATH
|
36
|
+
case $(which turbot) in
|
37
|
+
/usr/bin/turbot|/usr/local/turbot/bin/turbot)
|
38
|
+
;;
|
39
|
+
*)
|
40
|
+
install_path
|
41
|
+
;;
|
42
|
+
esac
|
43
|
+
|
44
|
+
# symlink binary to /usr/bin/turbot
|
45
|
+
ln -sf /usr/local/turbot/bin/turbot /usr/bin/turbot
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require "pathname"
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add locally vendored gems to libpath
|
9
|
+
gem_dir = File.expand_path("../../vendor/gems", bin_file)
|
10
|
+
Dir["#{gem_dir}/**/lib"].each do |libdir|
|
11
|
+
$:.unshift libdir
|
12
|
+
end
|
13
|
+
|
14
|
+
# add self to libpath
|
15
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
16
|
+
|
17
|
+
# inject any code in ~/.turbot/client over top
|
18
|
+
require "turbot/updater"
|
19
|
+
Turbot::Updater.disable("To update this version of the Turbot client please use
|
20
|
+
`apt-get install turbot-toolbelt`")
|
21
|
+
|
22
|
+
# start up the CLI
|
23
|
+
require "turbot/cli"
|
24
|
+
Turbot.user_agent = "turbot-toolbelt/#{Turbot::VERSION} (#{RUBY_PLATFORM}) ruby/#{RUBY_VERSION}"
|
25
|
+
Turbot::CLI.start(*ARGV)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
2
|
+
Version: GnuPG v1.4.11 (Darwin)
|
3
|
+
|
4
|
+
mQENBE5SfAEBCADLp056ZgfdtAMXLWpEuL9zY+dIHIY5qLQcDmUivjHLVE4l3Bi3
|
5
|
+
Mn570K0W9rfk7fHBPEO2XJEDdjk8Bg6mWTAeGjdfZgZaL+qO9NjqQ5QmVR+vgp7s
|
6
|
+
yxJYlfY+JYTZvl/JiDWGhuPHSPggXILCMf3SpqWMHGPqe/3RAK+CHCNv/94uaoS4
|
7
|
+
vi4HQT+k4sRceiM8WqkSRYSoc7rzdDejZn+InCYFfR56VeSFF4G4I6neZs/q5T9d
|
8
|
+
Ty2i5d0gZLaX/Iqc+3Dy0vDKClc0HUQJ6ajDPuUqKLHFUpqyuwfJij60+C3GMi8K
|
9
|
+
ckRPti31EPFVzq3GPHU+GqA+e9j84WHr4uJ5ABEBAAG0L0hlcm9rdSBSZWxlYXNl
|
10
|
+
IEVuZ2luZWVyaW5nIDxyZWxlYXNlQGhlcm9rdS5jb20+iQE4BBMBAgAiBQJOUnwB
|
11
|
+
AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRDJJ+vgDxsFIChECAC9h4Ay
|
12
|
+
Nx4AQFu85cjR9rijyBflPeVqi7Xhzd7IvLg2+kZSexlb2oidj7iVSMy+vy5tG9g9
|
13
|
+
8Az/JqMCVjcZ7ltn60OGU8gIYpJqt6VmH3vfJBxXu/Sm9tym3UCYGVvMAN5Oq6yB
|
14
|
+
HlQkQ8F3p0cW69PmF+fibkgo9RE0EYlBIt2rUHNilTGFS6vXGr5reFFp3/rRHq3k
|
15
|
+
bixnUwFSqNujJgnBKDPwtSYKc4pMpnhuv88xEpLH7vU8NLXQZMitKQguV8XEmcsu
|
16
|
+
43LXlsx5uVr239/XNW+h412gIHFDSzB/YuLWlVUXMfquC96z/wxMqWWZyskDNgr0
|
17
|
+
WDdMgzK6CUfXSqQhuQENBE5SfAEBCADbnGKcXpdVauQpINQLtRnrT0BJIrIo1Yxv
|
18
|
+
LQRb3G7RU+Eq6aHXwk9fSKa6nEv9RsmqiW874yODnr0d/DTUWMHT+jRvPHm1wlbE
|
19
|
+
pGR1aPSo7GgkSUdaT6CVBN3JWZ2kVJGqohNoJMYbfVaWd/kpa/LiMFWzS8LfWT2K
|
20
|
+
xiO2vIh4qBfeRCGR7s8rADCHuHJ0eibADrgqcRfdPrChB1JiYLeTdV4yRmSzJ7TM
|
21
|
+
zWX7OVpGfIFLbCw9NeN65pI9ePs2mSPM7DYkhhKSXWMwJNXFzn1blOGiwAwKb48P
|
22
|
+
a/QpE6TG3PQzbYyTTP0Td1XgKAHcprvbc89a/nAk3a+PJQ/MqvDzABEBAAGJAR8E
|
23
|
+
GAECAAkFAk5SfAECGwwACgkQySfr4A8bBSD4mAgAnCT5WRiDl0259Px9Z9J9Wk8Z
|
24
|
+
SxugDct2Yhzca4aw1Ou4cfaIFCDXzFlBzSJfqk0HoVhp9r2gzEPUCKnSjRDyxaMo
|
25
|
+
wZCUtqigBua+z4NB4AWgeOl/2S06I2ki1K7pfl4piYcHtEThHamnhVPJ2Hi6HsHq
|
26
|
+
mUU+8SxleHE4GCXmKkuvxelUq9jrhHikIkm1RoqFOPb9zV3WRy4YzVHQSYfHmfk0
|
27
|
+
9kXlM/CS0sfNv2UKCX+5e6eFIZv0rdtpp6VEh0tsFmsIClY6Z9MX7bgp8MnUJpyk
|
28
|
+
OeIzOzQgkb4aeT0Whl+EPcTeDZfqIhVBoNXupUanmWNppFcMngxfqG2NGi1vvQ==
|
29
|
+
=aUAq
|
30
|
+
-----END PGP PUBLIC KEY BLOCK-----
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<installer-script minSpecVersion="1.000000" authoringTool="org.ruby-lang.rake" authoringToolVersion="0.8.7">
|
3
|
+
<title>Turbot Client</title>
|
4
|
+
<options customize="allow" allow-external-scripts="no"/>
|
5
|
+
<domains enable_localSystem="true"/>
|
6
|
+
<choices-outline>
|
7
|
+
<line choice="turbot-client"/>
|
8
|
+
</choices-outline>
|
9
|
+
<choice id="turbot-client" title="Turbot Client">
|
10
|
+
<pkg-ref id="com.turbot.client"/>
|
11
|
+
<pkg-ref id="org.ruby-lang.installer"/>
|
12
|
+
</choice>
|
13
|
+
<pkg-ref id="com.turbot.client" installKBytes="<%= kbytes.strip %>" version="<%= version.strip %>" auth="Root">#turbot-client.pkg</pkg-ref>
|
14
|
+
<pkg-ref id="org.ruby-lang.installer" installKBytes="9132" auth="Root">#ruby.pkg</pkg-ref>
|
15
|
+
</installer-script>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<pkg-info format-version="2" identifier="com.turbot.toolbelt" version="<%= version %>" install-location="/usr/local/turbot" auth="root">
|
2
|
+
<payload installKBytes="<%= kbytes.strip %>" numberOfFiles="<%= num_files.strip %>"/>
|
3
|
+
<scripts>
|
4
|
+
<postinstall file="./postinstall"/>
|
5
|
+
</scripts>
|
6
|
+
</pkg-info>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
usershell=$(dscl localhost -read /Local/Default/Users/$USER shell | sed -e 's/[^ ]* //')
|
4
|
+
|
5
|
+
startup_files() {
|
6
|
+
case $(basename $usershell) in
|
7
|
+
zsh)
|
8
|
+
echo ".zlogin .zshrc .zprofile .zshenv"
|
9
|
+
;;
|
10
|
+
bash)
|
11
|
+
echo ".bashrc .bash_profile .bash_login .profile"
|
12
|
+
;;
|
13
|
+
*)
|
14
|
+
echo ".bash_profile .zshrc .profile"
|
15
|
+
;;
|
16
|
+
esac
|
17
|
+
}
|
18
|
+
|
19
|
+
install_path() {
|
20
|
+
for file in $(startup_files); do
|
21
|
+
[ -f $HOME/$file ] || continue
|
22
|
+
(grep "Added by the Turbot" $HOME/$file >/dev/null) && break
|
23
|
+
|
24
|
+
cat <<MESSAGE >>$HOME/$file
|
25
|
+
|
26
|
+
### Added by the Turbot Toolbelt
|
27
|
+
export PATH="/usr/local/turbot/bin:\$PATH"
|
28
|
+
MESSAGE
|
29
|
+
|
30
|
+
# done after we add to one file
|
31
|
+
break
|
32
|
+
done
|
33
|
+
}
|
34
|
+
|
35
|
+
# if the toolbelt is not returned by `which`, let's add to the PATH
|
36
|
+
case $(which turbot) in
|
37
|
+
/usr/bin/turbot|/usr/local/turbot/bin/turbot)
|
38
|
+
;;
|
39
|
+
*)
|
40
|
+
install_path
|
41
|
+
;;
|
42
|
+
esac
|
43
|
+
|
44
|
+
# symlink binary to /usr/bin/turbot
|
45
|
+
ln -sf /usr/local/turbot/bin/turbot /usr/bin/turbot
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/local/turbot/ruby/bin/ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require "pathname"
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add locally vendored gems to libpath
|
9
|
+
gem_dir = File.expand_path("../../vendor/gems", bin_file)
|
10
|
+
Dir["#{gem_dir}/**/lib"].each do |libdir|
|
11
|
+
$:.unshift libdir
|
12
|
+
end
|
13
|
+
|
14
|
+
# add self to libpath
|
15
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
16
|
+
|
17
|
+
# inject any code in ~/.turbot/client over top
|
18
|
+
require "turbot/updater"
|
19
|
+
Turbot::Updater.inject_libpath
|
20
|
+
|
21
|
+
# start up the CLI
|
22
|
+
require "turbot/cli"
|
23
|
+
Turbot.user_agent = "turbot-toolbelt/#{Turbot::VERSION} (#{RUBY_PLATFORM}) ruby/#{RUBY_VERSION}"
|
24
|
+
Turbot::CLI.start(*ARGV)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require "pathname"
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add locally vendored gems to libpath
|
9
|
+
gem_dir = File.expand_path("../../vendor/gems", bin_file)
|
10
|
+
Dir["#{gem_dir}/**/lib"].each do |libdir|
|
11
|
+
$:.unshift libdir
|
12
|
+
end
|
13
|
+
|
14
|
+
# add self to libpath
|
15
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
16
|
+
|
17
|
+
# inject any code in ~/.turbot/client over top
|
18
|
+
require "turbot/updater"
|
19
|
+
Turbot::Updater.inject_libpath
|
20
|
+
|
21
|
+
# start up the CLI
|
22
|
+
require "turbot/cli"
|
23
|
+
Turbot.user_agent = "turbot-toolbelt/#{Turbot::VERSION} (#{RUBY_PLATFORM}) ruby/#{RUBY_VERSION}"
|
24
|
+
Turbot::CLI.start(*ARGV)
|
data/dist/rpm.rake
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# TODO
|
2
|
+
# * signing
|
3
|
+
# * yum repository for updates
|
4
|
+
# * foreman
|
5
|
+
|
6
|
+
file pkg("/yum-#{version}/turbot-#{version}.rpm") => "deb:build" do |t|
|
7
|
+
mkchdir(File.dirname(t.name)) do
|
8
|
+
deb = pkg("/apt-#{version}/turbot-#{version}.deb")
|
9
|
+
sh "alien --keep-version --scripts --generate --to-rpm #{deb}"
|
10
|
+
|
11
|
+
spec = "turbot-#{version}/turbot-#{version}-1.spec"
|
12
|
+
spec_contents = File.read(spec)
|
13
|
+
File.open(spec, "w") do |f|
|
14
|
+
# Add ruby requirement, remove benchmark file with ugly filename
|
15
|
+
f.puts spec_contents.sub(/\n\n/m, "\nRequires: ruby\nBuildArch: noarch\n\n").
|
16
|
+
sub(/^.+has_key-vs-hash\[key\].+$/, "").
|
17
|
+
sub(/^License: .*/, "License: MIT\nURL: http://turbot.com\n").
|
18
|
+
sub(/^%description/, "%description\nClient library and CLI to deploy bots on Turbot.")
|
19
|
+
end
|
20
|
+
sh "sed -i s/ruby1.9.1/ruby/ turbot-#{version}/usr/local/turbot/bin/turbot"
|
21
|
+
|
22
|
+
chdir("turbot-#{version}") do
|
23
|
+
sh "rpmbuild --buildroot $PWD -bb turbot-#{version}-1.spec"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Build an .rpm package"
|
29
|
+
task "rpm:build" => pkg("/yum-#{version}/turbot-#{version}.rpm")
|
30
|
+
|
31
|
+
desc "Remove build artifacts for .rpm"
|
32
|
+
task "rpm:clean" do
|
33
|
+
clean pkg("turbot-#{version}.rpm")
|
34
|
+
FileUtils.rm_rf("pkg/yum-#{version}") if Dir.exists?("pkg/yum-#{version}")
|
35
|
+
end
|
data/dist/tgz.rake
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
file pkg("turbot-#{version}.tgz") => distribution_files("tgz") do |t|
|
2
|
+
tempdir do |dir|
|
3
|
+
mkchdir("turbot-client") do
|
4
|
+
assemble_distribution
|
5
|
+
assemble_gems
|
6
|
+
assemble resource("tgz/turbot"), "bin/turbot", 0755
|
7
|
+
end
|
8
|
+
|
9
|
+
sh "chmod -R go+r turbot-client"
|
10
|
+
sh "sudo chown -R 0:0 turbot-client"
|
11
|
+
sh "tar czf #{t.name} turbot-client"
|
12
|
+
sh "sudo chown -R $(whoami) turbot-client"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
task "tgz:build" => pkg("turbot-#{version}.tgz")
|
17
|
+
|
18
|
+
task "tgz:clean" do
|
19
|
+
clean pkg("turbot-#{version}.tgz")
|
20
|
+
end
|
21
|
+
|
22
|
+
task "tgz:release" => "tgz:build" do |t|
|
23
|
+
store pkg("turbot-#{version}.tgz"), "turbot-client/turbot-client-#{version}.tgz"
|
24
|
+
store pkg("turbot-#{version}.tgz"), "turbot-client/turbot-client-beta.tgz" if beta?
|
25
|
+
store pkg("turbot-#{version}.tgz"), "turbot-client/turbot-client.tgz" unless beta?
|
26
|
+
end
|
data/dist/zip.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "zip"
|
2
|
+
|
3
|
+
file pkg("turbot-#{version}.zip") => distribution_files("zip") do |t|
|
4
|
+
tempdir do |dir|
|
5
|
+
mkchdir("turbot-client") do
|
6
|
+
assemble_distribution
|
7
|
+
assemble_gems
|
8
|
+
Zip::ZipFile.open(t.name, Zip::ZipFile::CREATE) do |zip|
|
9
|
+
Dir["**/*"].each do |file|
|
10
|
+
zip.add(file, file) { true }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
file pkg("turbot-#{version}.zip.sha256") => pkg("turbot-#{version}.zip") do |t|
|
18
|
+
File.open(t.name, "w") do |file|
|
19
|
+
file.puts Digest::SHA256.file(t.prerequisites.first).hexdigest
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
task "zip:build" => pkg("turbot-#{version}.zip")
|
24
|
+
task "zip:sign" => pkg("turbot-#{version}.zip.sha256")
|
25
|
+
|
26
|
+
def zip_signature
|
27
|
+
File.read(pkg("turbot-#{version}.zip.sha256")).chomp
|
28
|
+
end
|
29
|
+
|
30
|
+
task "zip:clean" do
|
31
|
+
clean pkg("turbot-#{version}.zip")
|
32
|
+
end
|
33
|
+
|
34
|
+
task "zip:release" => %w( zip:build zip:sign ) do |t|
|
35
|
+
store pkg("turbot-#{version}.zip"), "turbot-client/turbot-client-#{version}.zip"
|
36
|
+
store pkg("turbot-#{version}.zip"), "turbot-client/turbot-client-beta.zip" if beta?
|
37
|
+
store pkg("turbot-#{version}.zip"), "turbot-client/turbot-client.zip" unless beta?
|
38
|
+
|
39
|
+
sh "turbot config:add UPDATE_HASH=#{zip_signature} -a toolbelt"
|
40
|
+
end
|
data/lib/turbot.rb
CHANGED
@@ -1,19 +1,22 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require 'fileutils'
|
2
|
+
require 'optparse'
|
3
|
+
require 'set'
|
4
|
+
require 'shellwords'
|
5
|
+
require 'socket'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
require 'netrc'
|
8
|
+
require 'text/levenshtein'
|
9
|
+
require 'zip'
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
require 'turbot/helpers'
|
12
|
+
require 'turbot/helpers/api_helper'
|
13
|
+
require 'turbot/helpers/netrc_helper'
|
14
|
+
require 'turbot/helpers/shell_helper'
|
15
|
+
require 'turbot/cli'
|
16
|
+
require 'turbot/command'
|
17
|
+
require 'turbot/command/base'
|
18
|
+
require 'turbot/version'
|
18
19
|
|
20
|
+
module Turbot
|
21
|
+
DEBUG_VERSION = "#{Turbot::VERSION} (#{RUBY_PLATFORM}) ruby/#{RUBY_VERSION}"
|
19
22
|
end
|