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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +15 -0
  5. data/.yardopts +3 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +22 -0
  8. data/README.md +44 -25
  9. data/Rakefile +16 -0
  10. data/appveyor.yml +35 -0
  11. data/bin/turbot +2 -16
  12. data/data/schema.json +134 -0
  13. data/{templates → data/templates}/LICENSE.txt +0 -0
  14. data/{templates → data/templates}/manifest.json +0 -0
  15. data/{templates → data/templates}/python/scraper.py +0 -0
  16. data/{templates → data/templates}/ruby/scraper.rb +0 -0
  17. data/dist/deb.rake +32 -0
  18. data/dist/gem.rake +16 -0
  19. data/dist/manifest.rake +9 -0
  20. data/dist/pkg.rake +60 -0
  21. data/dist/resources/deb/control +10 -0
  22. data/dist/resources/deb/postinst +45 -0
  23. data/dist/resources/deb/turbot +25 -0
  24. data/dist/resources/deb/turbot-release-key.txt +30 -0
  25. data/dist/resources/pkg/Distribution.erb +15 -0
  26. data/dist/resources/pkg/PackageInfo.erb +6 -0
  27. data/dist/resources/pkg/postinstall +45 -0
  28. data/dist/resources/pkg/turbot +24 -0
  29. data/dist/resources/tgz/turbot +24 -0
  30. data/dist/rpm.rake +35 -0
  31. data/dist/tgz.rake +26 -0
  32. data/dist/zip.rake +40 -0
  33. data/lib/turbot.rb +18 -15
  34. data/lib/turbot/cli.rb +10 -27
  35. data/lib/turbot/command.rb +59 -212
  36. data/lib/turbot/command/auth.rb +72 -34
  37. data/lib/turbot/command/base.rb +22 -61
  38. data/lib/turbot/command/bots.rb +251 -300
  39. data/lib/turbot/command/help.rb +57 -110
  40. data/lib/turbot/command/version.rb +6 -10
  41. data/lib/turbot/handlers/base_handler.rb +21 -0
  42. data/lib/turbot/handlers/dump_handler.rb +10 -0
  43. data/lib/turbot/handlers/preview_handler.rb +30 -0
  44. data/lib/turbot/handlers/validation_handler.rb +17 -0
  45. data/lib/turbot/helpers.rb +14 -482
  46. data/lib/turbot/helpers/api_helper.rb +41 -0
  47. data/lib/turbot/helpers/netrc_helper.rb +66 -0
  48. data/lib/turbot/helpers/shell_helper.rb +36 -0
  49. data/lib/turbot/version.rb +1 -1
  50. data/spec/fixtures/bad_permissions +0 -0
  51. data/spec/fixtures/empty +0 -0
  52. data/spec/fixtures/netrc +6 -0
  53. data/spec/spec_helper.rb +17 -219
  54. data/spec/support/bot_helper.rb +102 -0
  55. data/spec/support/command_helper.rb +20 -0
  56. data/spec/support/custom_matchers.rb +5 -0
  57. data/spec/support/fixture_helper.rb +9 -0
  58. data/spec/support/netrc_helper.rb +21 -0
  59. data/spec/turbot/command/auth_spec.rb +202 -20
  60. data/spec/turbot/command/base_spec.rb +22 -58
  61. data/spec/turbot/command/bots_spec.rb +580 -89
  62. data/spec/turbot/command/help_spec.rb +32 -75
  63. data/spec/turbot/command/version_spec.rb +11 -10
  64. data/spec/turbot/command_spec.rb +55 -87
  65. data/spec/turbot/helpers_spec.rb +28 -44
  66. data/turbot.gemspec +31 -0
  67. metadata +88 -178
  68. data/data/cacert.pem +0 -3988
  69. data/lib/turbot/auth.rb +0 -315
  70. data/lib/turbot/client.rb +0 -757
  71. data/lib/turbot/client/cisaurus.rb +0 -25
  72. data/lib/turbot/client/pgbackups.rb +0 -113
  73. data/lib/turbot/client/rendezvous.rb +0 -111
  74. data/lib/turbot/client/ssl_endpoint.rb +0 -25
  75. data/lib/turbot/client/turbot_postgresql.rb +0 -148
  76. data/lib/turbot/command/ssl.rb +0 -43
  77. data/lib/turbot/deprecated.rb +0 -5
  78. data/lib/turbot/deprecated/help.rb +0 -38
  79. data/lib/turbot/distribution.rb +0 -9
  80. data/lib/turbot/errors.rb +0 -28
  81. data/lib/turbot/excon.rb +0 -11
  82. data/lib/turbot/helpers/log_displayer.rb +0 -70
  83. data/lib/turbot/helpers/pg_dump_restore.rb +0 -115
  84. data/lib/turbot/helpers/turbot_postgresql.rb +0 -213
  85. data/lib/turbot/plugin.rb +0 -165
  86. data/lib/turbot/updater.rb +0 -171
  87. data/lib/vendor/turbot/okjson.rb +0 -598
  88. data/spec/helper/legacy_help.rb +0 -16
  89. data/spec/helper/pg_dump_restore_spec.rb +0 -67
  90. data/spec/spec.opts +0 -1
  91. data/spec/support/display_message_matcher.rb +0 -49
  92. data/spec/support/dummy_api.rb +0 -120
  93. data/spec/support/openssl_mock_helper.rb +0 -8
  94. data/spec/support/organizations_mock_helper.rb +0 -11
  95. data/spec/turbot/auth_spec.rb +0 -214
  96. data/spec/turbot/client/pgbackups_spec.rb +0 -43
  97. data/spec/turbot/client/rendezvous_spec.rb +0 -62
  98. data/spec/turbot/client/ssl_endpoint_spec.rb +0 -48
  99. data/spec/turbot/client/turbot_postgresql_spec.rb +0 -71
  100. data/spec/turbot/client_spec.rb +0 -548
  101. data/spec/turbot/helpers/turbot_postgresql_spec.rb +0 -181
  102. data/spec/turbot/plugin_spec.rb +0 -172
  103. 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 "turbot/client"
2
- require "turbot/updater"
3
- require "turbot/version"
4
- require "turbot_api"
5
- require "turbot/errors"
1
+ require 'fileutils'
2
+ require 'optparse'
3
+ require 'set'
4
+ require 'shellwords'
5
+ require 'socket'
6
6
 
7
- module Turbot
8
-
9
- USER_AGENT = "turbot-gem/#{Turbot::VERSION} (#{RUBY_PLATFORM}) ruby/#{RUBY_VERSION}"
7
+ require 'netrc'
8
+ require 'text/levenshtein'
9
+ require 'zip'
10
10
 
11
- def self.user_agent
12
- @@user_agent ||= USER_AGENT
13
- end
14
-
15
- def self.user_agent=(agent)
16
- @@user_agent = agent
17
- end
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