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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1821884d9b229f7fb87b4348a3166c3c3aefdfa1
|
4
|
+
data.tar.gz: e136315de66bc9cfe90d4d7c1aa53fd5c56bdfc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6125ddc0bbe53ab79ad88b373f04ca25320641f03dec4897c61c8b81aa5be4e9802e197f30db4252bd4ee7ff05c8ab51ab197fa8346e825942864c5c7420c20
|
7
|
+
data.tar.gz: 97674b5292e3ab0b945b63a8da59d66fe9aedd4cc5e8ef31b2d53653ad6011bcb6b5a8cbace43c7ca358ae9b990d22de98fff3513303a4e5f814f831f7735a8f
|
data/.gitignore
ADDED
data/.rspec
ADDED
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/.yardopts
ADDED
data/Gemfile
ADDED
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
|
[](https://badge.fury.io/rb/turbot)
|
5
4
|
[](https://travis-ci.org/openc/turbot-client)
|
5
|
+
[](https://ci.appveyor.com/project/jpmckinney/turbot-client)
|
6
6
|
[](https://gemnasium.com/openc/turbot-client)
|
7
7
|
[](https://coveralls.io/r/openc/turbot-client)
|
8
8
|
[](https://codeclimate.com/github/openc/turbot-client)
|
9
9
|
|
10
|
-
The Turbot CLI is used to manage Turbot
|
10
|
+
The Turbot CLI is used to manage Turbot bots from the command line.
|
11
11
|
|
12
|
-
|
13
|
-
-----
|
12
|
+
## Getting Started
|
14
13
|
|
15
|
-
|
14
|
+
gem install turbot
|
16
15
|
|
17
|
-
|
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
|
21
|
-
Email:
|
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
|
-
|
23
|
+
You can then generate a bot:
|
29
24
|
|
30
|
-
|
31
|
-
|
25
|
+
turbot bots:generate --bot my_amazing_bot
|
26
|
+
cd my_amazing_bot
|
32
27
|
|
33
|
-
|
28
|
+
Register the bot with Turbot:
|
34
29
|
|
35
|
-
|
30
|
+
turbot bots:register
|
36
31
|
|
37
|
-
|
32
|
+
Run your bot locally:
|
38
33
|
|
39
|
-
|
34
|
+
turbot bots:dump
|
40
35
|
|
41
|
-
|
42
|
-
----
|
36
|
+
Ensure your bot is valid:
|
43
37
|
|
44
|
-
|
38
|
+
turbot bots:validate
|
45
39
|
|
46
|
-
|
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/
|
2
|
-
|
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
|
+
"once",
|
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
|