turbot 0.1.36 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 600a90ef755d445465dc39413bb127d8aef1e61d
4
- data.tar.gz: 94c59e97d4fb228f4fbc9801eaa49888e7264790
3
+ metadata.gz: 1821884d9b229f7fb87b4348a3166c3c3aefdfa1
4
+ data.tar.gz: e136315de66bc9cfe90d4d7c1aa53fd5c56bdfc6
5
5
  SHA512:
6
- metadata.gz: 416a5437e004a0fe9359bd7683627a746b78a7cc812fe65da65d88ec86d3406cfd99ed5356ae801c3473dbf6aaea75b82accc6dc4d82cbf6cc36040227945f86
7
- data.tar.gz: 86982d3095fae7977793d857b696f0b44d563715eb5f6c08027758b8db2e5c1c465697ab81656543a5a7117f75561c45a9df7eaf0dd2302752aae72a4a1973cc
6
+ metadata.gz: d6125ddc0bbe53ab79ad88b373f04ca25320641f03dec4897c61c8b81aa5be4e9802e197f30db4252bd4ee7ff05c8ab51ab197fa8346e825942864c5c7420c20
7
+ data.tar.gz: 97674b5292e3ab0b945b63a8da59d66fe9aedd4cc5e8ef31b2d53653ad6011bcb6b5a8cbace43c7ca358ae9b990d22de98fff3513303a4e5f814f831f7735a8f
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/.yardopts ADDED
@@ -0,0 +1,3 @@
1
+ --hide-void-return
2
+ --embed-mixin ClassMethods
3
+ --markup=markdown
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
+ "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
@@ -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