turbot 0.1.36 → 0.2.0

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 (102) 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/Gemfile +4 -0
  6. data/LICENSE +22 -0
  7. data/README.md +44 -25
  8. data/Rakefile +16 -0
  9. data/appveyor.yml +35 -0
  10. data/bin/turbot +2 -16
  11. data/data/schema.json +134 -0
  12. data/{templates → data/templates}/LICENSE.txt +0 -0
  13. data/{templates → data/templates}/manifest.json +0 -0
  14. data/{templates → data/templates}/python/scraper.py +0 -0
  15. data/{templates → data/templates}/ruby/scraper.rb +0 -0
  16. data/dist/deb.rake +32 -0
  17. data/dist/gem.rake +16 -0
  18. data/dist/manifest.rake +9 -0
  19. data/dist/pkg.rake +60 -0
  20. data/dist/resources/deb/control +10 -0
  21. data/dist/resources/deb/postinst +45 -0
  22. data/dist/resources/deb/turbot +25 -0
  23. data/dist/resources/deb/turbot-release-key.txt +30 -0
  24. data/dist/resources/pkg/Distribution.erb +15 -0
  25. data/dist/resources/pkg/PackageInfo.erb +6 -0
  26. data/dist/resources/pkg/postinstall +45 -0
  27. data/dist/resources/pkg/turbot +24 -0
  28. data/dist/resources/tgz/turbot +24 -0
  29. data/dist/rpm.rake +35 -0
  30. data/dist/tgz.rake +26 -0
  31. data/dist/zip.rake +40 -0
  32. data/lib/turbot/cli.rb +10 -27
  33. data/lib/turbot/command/auth.rb +72 -34
  34. data/lib/turbot/command/base.rb +21 -60
  35. data/lib/turbot/command/bots.rb +245 -300
  36. data/lib/turbot/command/help.rb +57 -110
  37. data/lib/turbot/command/version.rb +6 -10
  38. data/lib/turbot/command.rb +53 -196
  39. data/lib/turbot/handlers/base_handler.rb +21 -0
  40. data/lib/turbot/handlers/dump_handler.rb +10 -0
  41. data/lib/turbot/handlers/preview_handler.rb +30 -0
  42. data/lib/turbot/handlers/validation_handler.rb +17 -0
  43. data/lib/turbot/helpers/api_helper.rb +41 -0
  44. data/lib/turbot/helpers/netrc_helper.rb +66 -0
  45. data/lib/turbot/helpers/shell_helper.rb +36 -0
  46. data/lib/turbot/helpers.rb +14 -482
  47. data/lib/turbot/version.rb +1 -1
  48. data/lib/turbot.rb +17 -15
  49. data/spec/fixtures/bad_permissions +0 -0
  50. data/spec/fixtures/empty +0 -0
  51. data/spec/fixtures/netrc +6 -0
  52. data/spec/spec_helper.rb +17 -219
  53. data/spec/support/bot_helper.rb +100 -0
  54. data/spec/support/command_helper.rb +20 -0
  55. data/spec/support/custom_matchers.rb +5 -0
  56. data/spec/support/fixture_helper.rb +9 -0
  57. data/spec/support/netrc_helper.rb +21 -0
  58. data/spec/turbot/command/auth_spec.rb +202 -20
  59. data/spec/turbot/command/base_spec.rb +22 -58
  60. data/spec/turbot/command/bots_spec.rb +558 -89
  61. data/spec/turbot/command/help_spec.rb +32 -75
  62. data/spec/turbot/command/version_spec.rb +11 -10
  63. data/spec/turbot/command_spec.rb +60 -85
  64. data/turbot.gemspec +31 -0
  65. metadata +86 -178
  66. data/data/cacert.pem +0 -3988
  67. data/lib/turbot/auth.rb +0 -315
  68. data/lib/turbot/client/cisaurus.rb +0 -25
  69. data/lib/turbot/client/pgbackups.rb +0 -113
  70. data/lib/turbot/client/rendezvous.rb +0 -111
  71. data/lib/turbot/client/ssl_endpoint.rb +0 -25
  72. data/lib/turbot/client/turbot_postgresql.rb +0 -148
  73. data/lib/turbot/client.rb +0 -757
  74. data/lib/turbot/command/ssl.rb +0 -43
  75. data/lib/turbot/deprecated/help.rb +0 -38
  76. data/lib/turbot/deprecated.rb +0 -5
  77. data/lib/turbot/distribution.rb +0 -9
  78. data/lib/turbot/errors.rb +0 -28
  79. data/lib/turbot/excon.rb +0 -11
  80. data/lib/turbot/helpers/log_displayer.rb +0 -70
  81. data/lib/turbot/helpers/pg_dump_restore.rb +0 -115
  82. data/lib/turbot/helpers/turbot_postgresql.rb +0 -213
  83. data/lib/turbot/plugin.rb +0 -165
  84. data/lib/turbot/updater.rb +0 -171
  85. data/lib/vendor/turbot/okjson.rb +0 -598
  86. data/spec/helper/legacy_help.rb +0 -16
  87. data/spec/helper/pg_dump_restore_spec.rb +0 -67
  88. data/spec/spec.opts +0 -1
  89. data/spec/support/display_message_matcher.rb +0 -49
  90. data/spec/support/dummy_api.rb +0 -120
  91. data/spec/support/openssl_mock_helper.rb +0 -8
  92. data/spec/support/organizations_mock_helper.rb +0 -11
  93. data/spec/turbot/auth_spec.rb +0 -214
  94. data/spec/turbot/client/pgbackups_spec.rb +0 -43
  95. data/spec/turbot/client/rendezvous_spec.rb +0 -62
  96. data/spec/turbot/client/ssl_endpoint_spec.rb +0 -48
  97. data/spec/turbot/client/turbot_postgresql_spec.rb +0 -71
  98. data/spec/turbot/client_spec.rb +0 -548
  99. data/spec/turbot/helpers/turbot_postgresql_spec.rb +0 -181
  100. data/spec/turbot/helpers_spec.rb +0 -48
  101. data/spec/turbot/plugin_spec.rb +0 -172
  102. data/spec/turbot/updater_spec.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 600a90ef755d445465dc39413bb127d8aef1e61d
4
- data.tar.gz: 94c59e97d4fb228f4fbc9801eaa49888e7264790
3
+ metadata.gz: 3f0ab307a669b16bddf151198102baf92d2a7cde
4
+ data.tar.gz: 687db33bf9d6c883fd34df56116bfdd41dff4db8
5
5
  SHA512:
6
- metadata.gz: 416a5437e004a0fe9359bd7683627a746b78a7cc812fe65da65d88ec86d3406cfd99ed5356ae801c3473dbf6aaea75b82accc6dc4d82cbf6cc36040227945f86
7
- data.tar.gz: 86982d3095fae7977793d857b696f0b44d563715eb5f6c08027758b8db2e5c1c465697ab81656543a5a7117f75561c45a9df7eaf0dd2302752aae72a4a1973cc
6
+ metadata.gz: ebee66e048f815818f5263b84817c9dd0b0b95d5828f420e26c86a427cecb2ef8e266643559d2834dd8bcbc9f429c306d6ed96490ed2d726fb4ff0102d3d28f3
7
+ data.tar.gz: f2d2eb912d29965e70b53412ae210d78128d6a8d39e999f43668464486ca7984213f04f1e545591ea9adba18a71504d18184332743f9253fb95ab14da362c8a3
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ *.gem
2
+ .bundle
3
+ .yardoc
4
+ coverage
5
+ Gemfile.lock
6
+ doc/*
7
+ pkg/*
8
+ spec/fixtures/writable
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --order random
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 1.9.3
6
+ before_script:
7
+ - git config --global user.email "bot@turbot.com"
8
+ - git config --global user.name "Turbot Bot (Travis CI)"
9
+ notifications:
10
+ email: false
11
+ webhooks:
12
+ on_success: always
13
+ on_failure: always
14
+ urls:
15
+ - http://dx-helper.turbotapp.com/travis
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in the gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © Turbot 2008 - 2012
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,46 +1,65 @@
1
- Turbot CLI
2
- ==========
1
+ # Turbot CLI
3
2
 
4
3
  [![Gem Version](https://badge.fury.io/rb/turbot.svg)](https://badge.fury.io/rb/turbot)
5
4
  [![Build Status](https://secure.travis-ci.org/openc/turbot-client.png)](https://travis-ci.org/openc/turbot-client)
5
+ [![Build Status](https://ci.appveyor.com/api/projects/status/sdq0ifdye4rgx8i1?svg=true)](https://ci.appveyor.com/project/jpmckinney/turbot-client)
6
6
  [![Dependency Status](https://gemnasium.com/openc/turbot-client.png)](https://gemnasium.com/openc/turbot-client)
7
7
  [![Coverage Status](https://coveralls.io/repos/openc/turbot-client/badge.png)](https://coveralls.io/r/openc/turbot-client)
8
8
  [![Code Climate](https://codeclimate.com/github/openc/turbot-client.png)](https://codeclimate.com/github/openc/turbot-client)
9
9
 
10
- The Turbot CLI is used to manage Turbot apps from the command line.
10
+ The Turbot CLI is used to manage Turbot bots from the command line.
11
11
 
12
- Setup
13
- -----
12
+ ## Getting Started
14
13
 
15
- (Platform-specific installers to follow)
14
+ gem install turbot
16
15
 
17
- Once installed, you'll have access to the `turbot` command from your command shell. Log in using the email address and password you used when creating your Turbot account:
16
+ You now have access to the `turbot` command. Log in using your Turbot account's email and password:
18
17
 
19
18
  $ turbot login
20
- Enter your Turbot credentials.
21
- Email: adam@example.com
22
- Password:
23
- Could not find an existing public key.
24
- Would you like to generate one? [Yn]
25
- Generating new SSH public key.
26
- Uploading SSH public key /Users/adam/.ssh/id_rsa.pub
19
+ Enter your Turbot email and password.
20
+ Email: email@example.com
21
+ Password (typing will be hidden):
27
22
 
28
- Press enter at the prompt to upload your existing `SSH` key or create a new one, used for pushing code later on.
23
+ You can then generate a bot:
29
24
 
30
- Development
31
- -----------
25
+ turbot bots:generate --bot my_amazing_bot
26
+ cd my_amazing_bot
32
27
 
33
- If you're working on the CLI and you can smoke-test your changes:
28
+ Register the bot with Turbot:
34
29
 
35
- $ bundle exec turbot
30
+ turbot bots:register
36
31
 
37
- If you need to do this from a different folder, try:
32
+ Run your bot locally:
38
33
 
39
- alias tb="RBENV_GEMSETS=.gems TURBOT_HOST=http://localhost:3000 RBENV_VERSION=[version] BUNDLE_GEMFILE=/path/to/turbot-client/Gemfile bundle exec turbot"
34
+ turbot bots:dump
40
35
 
41
- Meta
42
- ----
36
+ Ensure your bot is valid:
43
37
 
44
- Released under the MIT license; see the file License.
38
+ turbot bots:validate
45
39
 
46
- Based on the Heroku client created by [Adam Wiggins and others](https://github.com/turbot/turbot/contributors)
40
+ And push your code to Turbot when ready:
41
+
42
+ turbot bots:push
43
+
44
+ To read about Turbot's other commands:
45
+
46
+ turbot help
47
+
48
+ ## Environment variables
49
+
50
+ * `TURBOT_API_KEY`: Overrides the API key in the `.netrc` file. Allows you to skip authentication.
51
+
52
+ * `TURBOT_BOT`: Overrides the bot in the current directory, but not the bot set with the `--bot` option.
53
+
54
+ * `TURBOT_HOST`: Overrides the base URL of the Turbot server, which is `http://turbot.opencorporates.com` by default.
55
+
56
+ ## Releasing a new version
57
+
58
+ Bump the version in `lib/turbot/version.rb` according to the [Semantic Versioning](http://semver.org/) convention, then:
59
+
60
+ git commit lib/turbot/version.rb -m 'Release new version'
61
+ rake release # requires Rubygems credentials
62
+
63
+ Based on the [Heroku CLI](https://github.com/heroku/heroku).
64
+
65
+ Copyright (c) 2015 Chrinon Ltd, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
8
+
9
+ begin
10
+ require 'yard'
11
+ YARD::Rake::YardocTask.new
12
+ rescue LoadError
13
+ task :yard do
14
+ abort 'YARD is not available. In order to run yard, you must: gem install yard'
15
+ end
16
+ end
data/appveyor.yml ADDED
@@ -0,0 +1,35 @@
1
+ # @see https://mattbrictson.com/how-to-test-ruby-windows
2
+ # @see https://github.com/apiaryio/apiary-client/blob/master/appveyor.yml
3
+ version: '{build}'
4
+ skip_tags: true
5
+ install:
6
+ - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
7
+ - ruby --version
8
+ - gem --version
9
+ - gem install bundler --no-ri --no-rdoc
10
+ - bundler --version
11
+ build_script:
12
+ - bundle install --jobs=3 --retry=3
13
+ test_script:
14
+ - bundle exec rspec -b < Nul
15
+ artifacts:
16
+ - path: pkg\*.gem
17
+ environment:
18
+ matrix:
19
+ - ruby_version: "193"
20
+ - ruby_version: "200"
21
+ - ruby_version: "200-x64"
22
+ - ruby_version: "21"
23
+ - ruby_version: "21-x64"
24
+ - ruby_version: "22"
25
+ - ruby_version: "22-x64"
26
+ # @see https://www.appveyor.com/docs/build-cache
27
+ cache:
28
+ - C:\Ruby193\bin -> appveyor.yml
29
+ - C:\Ruby193\lib\ruby\gems\1.9.1 -> appveyor.yml
30
+ - C:\Ruby200\bin -> appveyor.yml
31
+ - C:\Ruby200\lib\ruby\gems\2.0.0 -> appveyor.yml
32
+ - C:\Ruby21\bin -> appveyor.yml
33
+ - C:\Ruby21\lib\ruby\gems\2.1.0 -> appveyor.yml
34
+ - C:\Ruby22\bin -> appveyor.yml
35
+ - C:\Ruby22\lib\ruby\gems\2.2.0 -> appveyor.yml
data/bin/turbot CHANGED
@@ -1,17 +1,3 @@
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 self to libpath
9
- $:.unshift File.expand_path("../../lib", bin_file)
10
-
11
- require "turbot/updater"
12
- Turbot::Updater.disable("`turbot update` is only available from Turbot Toolbelt.\nDownload and install from https://toolbelt.turbot.com")
13
-
14
- # start up the CLI
15
- require "turbot/cli"
16
- Turbot.user_agent = "turbot-gem/#{Turbot::VERSION} (#{RUBY_PLATFORM}) ruby/#{RUBY_VERSION}"
1
+ #!/usr/bin/env ruby
2
+ require 'turbot'
17
3
  Turbot::CLI.start(*ARGV)
data/data/schema.json ADDED
@@ -0,0 +1,134 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "bot_id": {
5
+ "type": "string",
6
+ "pattern": "^[A-Za-z0-9._-]+$"
7
+ },
8
+ "title": {
9
+ "type": "string"
10
+ },
11
+ "description": {
12
+ "type": "string"
13
+ },
14
+ "language": {
15
+ "type": "string",
16
+ "enum": [
17
+ "python",
18
+ "ruby"
19
+ ]
20
+ },
21
+ "data_type": {
22
+ "type": "string"
23
+ },
24
+ "identifying_fields": {
25
+ "$ref": "#/definitions/string_array"
26
+ },
27
+ "files": {
28
+ "$ref": "#/definitions/string_array",
29
+ "minItems": 1
30
+ },
31
+ "frequency": {
32
+ "type": "string",
33
+ "enum": [
34
+ "oneoff",
35
+ "daily",
36
+ "weekly",
37
+ "monthly",
38
+ "yearly",
39
+ "never"
40
+ ]
41
+ },
42
+ "publisher": {
43
+ "type": "object",
44
+ "properties": {
45
+ "name": {
46
+ "type": "string"
47
+ },
48
+ "url": {
49
+ "type": "string",
50
+ "format": "uri"
51
+ },
52
+ "terms": {
53
+ "type": "string"
54
+ },
55
+ "terms_url": {
56
+ "type": "string",
57
+ "format": "uri"
58
+ }
59
+ },
60
+ "additionalProperties": false
61
+ },
62
+ "tags": {
63
+ "$ref": "#/definitions/string_array"
64
+ },
65
+ "manually_end_run": {
66
+ "$ref": "#/definitions/string_boolean"
67
+ },
68
+ "transformers": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "object",
72
+ "properties": {
73
+ "file": {
74
+ "type": "string"
75
+ },
76
+ "data_type": {
77
+ "type": "string"
78
+ },
79
+ "identifying_fields": {
80
+ "$ref": "#/definitions/string_array"
81
+ }
82
+ },
83
+ "required": [
84
+ "file",
85
+ "data_type",
86
+ "identifying_fields"
87
+ ],
88
+ "additionalProperties": false
89
+ }
90
+ },
91
+ "public_repo_url": {
92
+ "type": "string",
93
+ "format": "uri"
94
+ },
95
+ "duplicates_allowed": {
96
+ "$ref": "#/definitions/string_boolean"
97
+ },
98
+ "allow_duplicates": {
99
+ "$ref": "#/definitions/string_boolean"
100
+ },
101
+ "incremental": {
102
+ "$ref": "#/definitions/string_boolean"
103
+ },
104
+ "author": {},
105
+ "company_fields": {},
106
+ "dataset_id": {},
107
+ "domain": {},
108
+ "public_repository": {},
109
+ "source_date": {},
110
+ "source_url": {},
111
+ "stateful": {}
112
+ },
113
+ "required": [
114
+ "bot_id",
115
+ "data_type",
116
+ "identifying_fields",
117
+ "files",
118
+ "language",
119
+ "publisher"
120
+ ],
121
+ "additionalProperties": false,
122
+ "definitions": {
123
+ "string_boolean": {
124
+ "type": ["boolean", "string"],
125
+ "enum": [true, false, "true", "false"]
126
+ },
127
+ "string_array": {
128
+ "type": "array",
129
+ "items": {
130
+ "type": "string"
131
+ }
132
+ }
133
+ }
134
+ }
File without changes
File without changes
File without changes
File without changes
data/dist/deb.rake ADDED
@@ -0,0 +1,32 @@
1
+ file pkg("/apt-#{version}/turbot-#{version}.deb") => distribution_files("deb") do |t|
2
+ mkchdir(File.dirname(t.name)) do
3
+ mkchdir("usr/local/turbot") do
4
+ assemble_distribution
5
+ assemble_gems
6
+ assemble resource("deb/turbot"), "bin/turbot", 0755
7
+ end
8
+
9
+ assemble resource("deb/control"), "control"
10
+ assemble resource("deb/postinst"), "postinst"
11
+
12
+ sh "tar czvf data.tar.gz usr/local/turbot --owner=root --group=root"
13
+ sh "tar czvf control.tar.gz control postinst --owner=root --group=root --preserve-permissions"
14
+
15
+ File.open("debian-binary", "w") do |f|
16
+ f.puts "2.0"
17
+ end
18
+
19
+ deb = File.basename(t.name)
20
+
21
+ sh "ar -r #{t.name} debian-binary control.tar.gz data.tar.gz"
22
+ end
23
+ end
24
+
25
+ desc "Build a .deb package"
26
+ task "deb:build" => pkg("/apt-#{version}/turbot-#{version}.deb")
27
+
28
+ desc "Remove build artifacts for .deb"
29
+ task "deb:clean" do
30
+ clean pkg("turbot-#{version}.deb")
31
+ FileUtils.rm_rf("pkg/apt-#{version}") if Dir.exists?("pkg/apt-#{version}")
32
+ end
data/dist/gem.rake ADDED
@@ -0,0 +1,16 @@
1
+ file pkg("turbot-#{version}.gem") => distribution_files("gem") do |t|
2
+ sh "gem build turbot.gemspec"
3
+ sh "mv turbot-#{version}.gem #{t.name}"
4
+ end
5
+
6
+ task "gem:build" => pkg("turbot-#{version}.gem")
7
+
8
+ task "gem:clean" do
9
+ clean pkg("turbot-#{version}.gem")
10
+ end
11
+
12
+ task "gem:release" => "gem:build" do |t|
13
+ sh "gem push #{pkg("turbot-#{version}.gem")}"
14
+ sh "git tag v#{version}"
15
+ sh "git push origin master --tags"
16
+ end
@@ -0,0 +1,9 @@
1
+ task "manifest:update" do
2
+ tempdir do |dir|
3
+ File.open("VERSION", "w") do |file|
4
+ file.puts version
5
+ end
6
+ puts "Current version: #{version}"
7
+ store "#{dir}/VERSION", "turbot-client/VERSION"
8
+ end
9
+ end
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>