turbot 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +36 -0
- data/bin/turbot +17 -0
- data/data/cacert.pem +3988 -0
- data/lib/turbot/auth.rb +315 -0
- data/lib/turbot/cli.rb +38 -0
- data/lib/turbot/client/cisaurus.rb +25 -0
- data/lib/turbot/client/pgbackups.rb +113 -0
- data/lib/turbot/client/rendezvous.rb +111 -0
- data/lib/turbot/client/ssl_endpoint.rb +25 -0
- data/lib/turbot/client/turbot_postgresql.rb +148 -0
- data/lib/turbot/client.rb +757 -0
- data/lib/turbot/command/auth.rb +85 -0
- data/lib/turbot/command/base.rb +192 -0
- data/lib/turbot/command/bots.rb +326 -0
- data/lib/turbot/command/config.rb +123 -0
- data/lib/turbot/command/help.rb +179 -0
- data/lib/turbot/command/keys.rb +115 -0
- data/lib/turbot/command/logs.rb +34 -0
- data/lib/turbot/command/ssl.rb +43 -0
- data/lib/turbot/command/status.rb +51 -0
- data/lib/turbot/command/update.rb +47 -0
- data/lib/turbot/command/version.rb +23 -0
- data/lib/turbot/command.rb +304 -0
- data/lib/turbot/deprecated/help.rb +38 -0
- data/lib/turbot/deprecated.rb +5 -0
- data/lib/turbot/distribution.rb +9 -0
- data/lib/turbot/errors.rb +28 -0
- data/lib/turbot/excon.rb +11 -0
- data/lib/turbot/helpers/log_displayer.rb +70 -0
- data/lib/turbot/helpers/pg_dump_restore.rb +115 -0
- data/lib/turbot/helpers/turbot_postgresql.rb +213 -0
- data/lib/turbot/helpers.rb +521 -0
- data/lib/turbot/plugin.rb +165 -0
- data/lib/turbot/updater.rb +171 -0
- data/lib/turbot/version.rb +3 -0
- data/lib/turbot.rb +19 -0
- data/lib/vendor/turbot/okjson.rb +598 -0
- data/spec/helper/legacy_help.rb +16 -0
- data/spec/helper/pg_dump_restore_spec.rb +67 -0
- data/spec/schemas/dummy_schema.json +12 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +220 -0
- data/spec/support/display_message_matcher.rb +49 -0
- data/spec/support/dummy_api.rb +120 -0
- data/spec/support/openssl_mock_helper.rb +8 -0
- data/spec/support/organizations_mock_helper.rb +11 -0
- data/spec/turbot/auth_spec.rb +214 -0
- data/spec/turbot/client/pgbackups_spec.rb +43 -0
- data/spec/turbot/client/rendezvous_spec.rb +62 -0
- data/spec/turbot/client/ssl_endpoint_spec.rb +48 -0
- data/spec/turbot/client/turbot_postgresql_spec.rb +71 -0
- data/spec/turbot/client_spec.rb +548 -0
- data/spec/turbot/command/auth_spec.rb +38 -0
- data/spec/turbot/command/base_spec.rb +66 -0
- data/spec/turbot/command/bots_spec.rb +54 -0
- data/spec/turbot/command/config_spec.rb +143 -0
- data/spec/turbot/command/help_spec.rb +90 -0
- data/spec/turbot/command/keys_spec.rb +117 -0
- data/spec/turbot/command/logs_spec.rb +60 -0
- data/spec/turbot/command/status_spec.rb +48 -0
- data/spec/turbot/command/version_spec.rb +16 -0
- data/spec/turbot/command_spec.rb +131 -0
- data/spec/turbot/helpers/turbot_postgresql_spec.rb +181 -0
- data/spec/turbot/helpers_spec.rb +48 -0
- data/spec/turbot/plugin_spec.rb +172 -0
- data/spec/turbot/updater_spec.rb +44 -0
- data/templates/manifest.json +7 -0
- data/templates/scraper.py +5 -0
- data/templates/scraper.rb +6 -0
- metadata +199 -0
@@ -0,0 +1,181 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "turbot/helpers/turbot_postgresql"
|
3
|
+
|
4
|
+
include Turbot::Helpers::TurbotPostgresql
|
5
|
+
|
6
|
+
describe Turbot::Helpers::TurbotPostgresql::Resolver do
|
7
|
+
|
8
|
+
before do
|
9
|
+
@resolver = described_class.new('appname', mock(:api))
|
10
|
+
@resolver.stub(:bot_config_vars) { bot_config_vars }
|
11
|
+
@resolver.stub(:bot_attachments) { bot_attachments }
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:bot_config_vars) do
|
15
|
+
{
|
16
|
+
"DATABASE_URL" => "postgres://default",
|
17
|
+
"TURBOT_POSTGRESQL_BLACK_URL" => "postgres://black",
|
18
|
+
"TURBOT_POSTGRESQL_IVORY_URL" => "postgres://default"
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:bot_attachments) {
|
23
|
+
[ Attachment.new({ 'name' => 'TURBOT_POSTGRESQL_IVORY',
|
24
|
+
'config_var' => 'TURBOT_POSTGRESQL_IVORY_URL',
|
25
|
+
'bot' => {'name' => 'sushi' },
|
26
|
+
'resource' => {'name' => 'softly-mocking-123',
|
27
|
+
'value' => 'postgres://default',
|
28
|
+
'type' => 'turbot-postgresql:baku' }}),
|
29
|
+
Attachment.new({ 'name' => 'TURBOT_POSTGRESQL_BLACK',
|
30
|
+
'config_var' => 'TURBOT_POSTGRESQL_BLACK_URL',
|
31
|
+
'bot' => {'name' => 'sushi' },
|
32
|
+
'resource' => {'name' => 'quickly-yelling-2421',
|
33
|
+
'value' => 'postgres://black',
|
34
|
+
'type' => 'turbot-postgresql:zilla' }})
|
35
|
+
]
|
36
|
+
}
|
37
|
+
|
38
|
+
context "when the DATABASE_URL has query options" do
|
39
|
+
let(:bot_config_vars) do
|
40
|
+
{
|
41
|
+
"DATABASE_URL" => "postgres://default?pool=15",
|
42
|
+
"TURBOT_POSTGRESQL_BLACK_URL" => "postgres://black",
|
43
|
+
"TURBOT_POSTGRESQL_IVORY_URL" => "postgres://default",
|
44
|
+
"SHARED_DATABASE_URL" => "postgres://shared"
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
it "resolves DATABASE" do
|
49
|
+
att = @resolver.resolve('DATABASE')
|
50
|
+
att.display_name.should == "TURBOT_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
51
|
+
att.url.should == "postgres://default"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "when no bot is specified or inferred, and identifier does not have bot::db shorthand" do
|
56
|
+
it 'exits, complaining about the missing bot' do
|
57
|
+
api = mock('api')
|
58
|
+
api.stub(:get_attachments).and_raise("getting this far will cause an inaccurate 'internal server error' message")
|
59
|
+
|
60
|
+
no_bot_resolver = described_class.new(nil, api)
|
61
|
+
no_bot_resolver.should_receive(:error).with { |msg| expect(msg).to match(/No bot specified/) }.and_raise(SystemExit)
|
62
|
+
expect { no_bot_resolver.resolve('black') }.to raise_error(SystemExit)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context "when the identifier has ::" do
|
67
|
+
it 'changes the resolver bot to the left of the ::' do
|
68
|
+
@resolver.bot_name.should == 'appname'
|
69
|
+
att = @resolver.resolve('app2::black')
|
70
|
+
@resolver.bot_name.should == 'app2'
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'resolves database names on the right of the ::' do
|
74
|
+
att = @resolver.resolve('app2::black')
|
75
|
+
att.url.should == "postgres://black" # since we're mocking out the bot_config_vars
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'looks allows nothing after the :: to use the default' do
|
79
|
+
att = @resolver.resolve('app2::', 'DATABASE_URL')
|
80
|
+
att.url.should == "postgres://default"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context "when the DATABASE_URL has no query options" do
|
85
|
+
let(:bot_config_vars) do
|
86
|
+
{
|
87
|
+
"DATABASE_URL" => "postgres://default",
|
88
|
+
"TURBOT_POSTGRESQL_BLACK_URL" => "postgres://black",
|
89
|
+
"TURBOT_POSTGRESQL_IVORY_URL" => "postgres://default",
|
90
|
+
"SHARED_DATABASE_URL" => "postgres://shared"
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
it "resolves DATABASE" do
|
95
|
+
att = @resolver.resolve('DATABASE')
|
96
|
+
att.display_name.should == "TURBOT_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
97
|
+
att.url.should == "postgres://default"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it "resolves default using NAME" do
|
102
|
+
att = @resolver.resolve('IVORY')
|
103
|
+
att.display_name.should == "TURBOT_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
104
|
+
att.url.should == "postgres://default"
|
105
|
+
end
|
106
|
+
|
107
|
+
it "resolves non-default using NAME" do
|
108
|
+
att = @resolver.resolve('BLACK')
|
109
|
+
att.display_name.should == "TURBOT_POSTGRESQL_BLACK_URL"
|
110
|
+
att.url.should == "postgres://black"
|
111
|
+
end
|
112
|
+
|
113
|
+
it "resolves default using NAME_URL" do
|
114
|
+
att = @resolver.resolve('IVORY_URL')
|
115
|
+
att.display_name.should == "TURBOT_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
116
|
+
att.url.should == "postgres://default"
|
117
|
+
end
|
118
|
+
|
119
|
+
it "resolves non-default using NAME_URL" do
|
120
|
+
att = @resolver.resolve('BLACK_URL')
|
121
|
+
att.display_name.should == "TURBOT_POSTGRESQL_BLACK_URL"
|
122
|
+
att.url.should == "postgres://black"
|
123
|
+
end
|
124
|
+
|
125
|
+
it "resolves default using lowercase" do
|
126
|
+
att = @resolver.resolve('ivory')
|
127
|
+
att.display_name.should == "TURBOT_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
128
|
+
att.url.should == "postgres://default"
|
129
|
+
end
|
130
|
+
|
131
|
+
it "resolves non-default using lowercase" do
|
132
|
+
att = @resolver.resolve('black')
|
133
|
+
att.display_name.should == "TURBOT_POSTGRESQL_BLACK_URL"
|
134
|
+
att.url.should == "postgres://black"
|
135
|
+
end
|
136
|
+
|
137
|
+
it "resolves non-default using part of name" do
|
138
|
+
att = @resolver.resolve('bla')
|
139
|
+
att.display_name.should == "TURBOT_POSTGRESQL_BLACK_URL"
|
140
|
+
att.url.should == "postgres://black"
|
141
|
+
end
|
142
|
+
|
143
|
+
it "throws an error if it doesnt exist" do
|
144
|
+
@resolver.should_receive(:error).with("Unknown database: violet. Valid options are: DATABASE_URL, TURBOT_POSTGRESQL_BLACK_URL, TURBOT_POSTGRESQL_IVORY_URL")
|
145
|
+
@resolver.resolve("violet")
|
146
|
+
end
|
147
|
+
|
148
|
+
context "default" do
|
149
|
+
|
150
|
+
it "errors if there is no default" do
|
151
|
+
@resolver.should_receive(:error).with("Unknown database. Valid options are: DATABASE_URL, TURBOT_POSTGRESQL_BLACK_URL, TURBOT_POSTGRESQL_IVORY_URL")
|
152
|
+
@resolver.resolve(nil)
|
153
|
+
end
|
154
|
+
|
155
|
+
it "uses the default if nothing(nil) specified" do
|
156
|
+
att = @resolver.resolve(nil, "DATABASE_URL")
|
157
|
+
att.display_name.should == "TURBOT_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
158
|
+
att.url.should == "postgres://default"
|
159
|
+
end
|
160
|
+
|
161
|
+
it "uses the default if nothing(empty) specified" do
|
162
|
+
att = @resolver.resolve('', "DATABASE_URL")
|
163
|
+
att.display_name.should == "TURBOT_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
164
|
+
att.url.should == "postgres://default"
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'throws an error if given an empty string and asked for the default and there is no default' do
|
168
|
+
bot_config_vars.delete 'DATABASE_URL'
|
169
|
+
@resolver.should_receive(:error).with("Unknown database. Valid options are: TURBOT_POSTGRESQL_BLACK_URL, TURBOT_POSTGRESQL_IVORY_URL")
|
170
|
+
att = @resolver.resolve('', "DATABASE_URL")
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'throws an error if given an empty string and asked for the default and the default doesnt match' do
|
174
|
+
bot_config_vars['DATABASE_URL'] = 'something different'
|
175
|
+
@resolver.should_receive(:error).with("Unknown database. Valid options are: TURBOT_POSTGRESQL_BLACK_URL, TURBOT_POSTGRESQL_IVORY_URL")
|
176
|
+
att = @resolver.resolve('', "DATABASE_URL")
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
end
|
181
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "turbot/helpers"
|
3
|
+
|
4
|
+
module Turbot
|
5
|
+
describe Helpers do
|
6
|
+
include Turbot::Helpers
|
7
|
+
|
8
|
+
context "display_object" do
|
9
|
+
|
10
|
+
it "should display Array correctly" do
|
11
|
+
capture_stdout do
|
12
|
+
display_object([1,2,3])
|
13
|
+
end.should == <<-OUT
|
14
|
+
1
|
15
|
+
2
|
16
|
+
3
|
17
|
+
OUT
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should display { :header => [] } list correctly" do
|
21
|
+
capture_stdout do
|
22
|
+
display_object({:first_header => [1,2,3], :last_header => [7,8,9]})
|
23
|
+
end.should == <<-OUT
|
24
|
+
=== first_header
|
25
|
+
1
|
26
|
+
2
|
27
|
+
3
|
28
|
+
|
29
|
+
=== last_header
|
30
|
+
7
|
31
|
+
8
|
32
|
+
9
|
33
|
+
|
34
|
+
OUT
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should display String properly" do
|
38
|
+
capture_stdout do
|
39
|
+
display_object('string')
|
40
|
+
end.should == <<-OUT
|
41
|
+
string
|
42
|
+
OUT
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "turbot/plugin"
|
3
|
+
|
4
|
+
module Turbot
|
5
|
+
describe Plugin do
|
6
|
+
include SandboxHelper
|
7
|
+
|
8
|
+
it "lives in ~/.turbot/plugins" do
|
9
|
+
Plugin.stub!(:home_directory).and_return('/home/user')
|
10
|
+
Plugin.directory.should == '/home/user/.turbot/plugins'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "extracts the name from git urls" do
|
14
|
+
Plugin.new('git://github.com/turbot/plugin.git').name.should == 'plugin'
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "management" do
|
18
|
+
before(:each) do
|
19
|
+
@sandbox = "/tmp/turbot_plugins_spec_#{Process.pid}"
|
20
|
+
FileUtils.mkdir_p(@sandbox)
|
21
|
+
Dir.stub!(:pwd).and_return(@sandbox)
|
22
|
+
Plugin.stub!(:directory).and_return(@sandbox)
|
23
|
+
end
|
24
|
+
|
25
|
+
after(:each) do
|
26
|
+
FileUtils.rm_rf(@sandbox)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "lists installed plugins" do
|
30
|
+
FileUtils.mkdir_p(@sandbox + '/plugin1')
|
31
|
+
FileUtils.mkdir_p(@sandbox + '/plugin2')
|
32
|
+
Plugin.list.should include 'plugin1'
|
33
|
+
Plugin.list.should include 'plugin2'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "installs pulling from the plugin url" do
|
37
|
+
plugin_folder = "/tmp/turbot_plugin"
|
38
|
+
FileUtils.mkdir_p(plugin_folder)
|
39
|
+
`cd #{plugin_folder} && git init && echo 'test' > README && git add . && git commit -m 'my plugin'`
|
40
|
+
Plugin.new(plugin_folder).install
|
41
|
+
File.directory?("#{@sandbox}/turbot_plugin").should be_true
|
42
|
+
File.read("#{@sandbox}/turbot_plugin/README").should == "test\n"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "reinstalls over old copies" do
|
46
|
+
plugin_folder = "/tmp/turbot_plugin"
|
47
|
+
FileUtils.mkdir_p(plugin_folder)
|
48
|
+
`cd #{plugin_folder} && git init && echo 'test' > README && git add . && git commit -m 'my plugin'`
|
49
|
+
Plugin.new(plugin_folder).install
|
50
|
+
Plugin.new(plugin_folder).install
|
51
|
+
File.directory?("#{@sandbox}/turbot_plugin").should be_true
|
52
|
+
File.read("#{@sandbox}/turbot_plugin/README").should == "test\n"
|
53
|
+
end
|
54
|
+
|
55
|
+
context "update" do
|
56
|
+
|
57
|
+
before(:each) do
|
58
|
+
plugin_folder = "/tmp/turbot_plugin"
|
59
|
+
FileUtils.mkdir_p(plugin_folder)
|
60
|
+
`cd #{plugin_folder} && git init && echo 'test' > README && git add . && git commit -m 'my plugin'`
|
61
|
+
Plugin.new(plugin_folder).install
|
62
|
+
`cd #{plugin_folder} && echo 'updated' > README && git add . && git commit -m 'my plugin update'`
|
63
|
+
end
|
64
|
+
|
65
|
+
it "updates existing copies" do
|
66
|
+
Plugin.new('turbot_plugin').update
|
67
|
+
File.directory?("#{@sandbox}/turbot_plugin").should be_true
|
68
|
+
File.read("#{@sandbox}/turbot_plugin/README").should == "updated\n"
|
69
|
+
end
|
70
|
+
|
71
|
+
it "warns on legacy plugins" do
|
72
|
+
`cd #{@sandbox}/turbot_plugin && git config --unset branch.master.remote`
|
73
|
+
stderr = capture_stderr do
|
74
|
+
begin
|
75
|
+
Plugin.new('turbot_plugin').update
|
76
|
+
rescue SystemExit
|
77
|
+
end
|
78
|
+
end
|
79
|
+
stderr.should == <<-STDERR
|
80
|
+
! turbot_plugin is a legacy plugin installation.
|
81
|
+
! Enable updating by reinstalling with `turbot plugins:install`.
|
82
|
+
STDERR
|
83
|
+
end
|
84
|
+
|
85
|
+
it "raises exception on symlinked plugins" do
|
86
|
+
`cd #{@sandbox} && ln -s turbot_plugin turbot_plugin_symlink`
|
87
|
+
lambda { Plugin.new('turbot_plugin_symlink').update }.should raise_error Turbot::Plugin::ErrorUpdatingSymlinkPlugin
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
it "uninstalls removing the folder" do
|
94
|
+
FileUtils.mkdir_p(@sandbox + '/plugin1')
|
95
|
+
Plugin.new('git://github.com/turbot/plugin1.git').uninstall
|
96
|
+
Plugin.list.should == []
|
97
|
+
end
|
98
|
+
|
99
|
+
it "adds the lib folder in the plugin to the load path, if present" do
|
100
|
+
FileUtils.mkdir_p(@sandbox + '/plugin/lib')
|
101
|
+
File.open(@sandbox + '/plugin/lib/my_custom_plugin_file.rb', 'w') { |f| f.write "" }
|
102
|
+
Plugin.load!
|
103
|
+
lambda { require 'my_custom_plugin_file' }.should_not raise_error(LoadError)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "loads init.rb, if present" do
|
107
|
+
FileUtils.mkdir_p(@sandbox + '/plugin')
|
108
|
+
File.open(@sandbox + '/plugin/init.rb', 'w') { |f| f.write "LoadedInit = true" }
|
109
|
+
Plugin.load!
|
110
|
+
LoadedInit.should be_true
|
111
|
+
end
|
112
|
+
|
113
|
+
describe "when there are plugin load errors" do
|
114
|
+
before(:each) do
|
115
|
+
FileUtils.mkdir_p(@sandbox + '/some_plugin/lib')
|
116
|
+
File.open(@sandbox + '/some_plugin/init.rb', 'w') { |f| f.write "require 'some_non_existant_file'" }
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should not throw an error" do
|
120
|
+
capture_stderr do
|
121
|
+
lambda { Plugin.load! }.should_not raise_error
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should fail gracefully" do
|
126
|
+
stderr = capture_stderr do
|
127
|
+
Plugin.load!
|
128
|
+
end
|
129
|
+
stderr.should include('some_non_existant_file (LoadError)')
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should still load other plugins" do
|
133
|
+
FileUtils.mkdir_p(@sandbox + '/some_plugin_2/lib')
|
134
|
+
File.open(@sandbox + '/some_plugin_2/init.rb', 'w') { |f| f.write "LoadedPlugin2 = true" }
|
135
|
+
stderr = capture_stderr do
|
136
|
+
Plugin.load!
|
137
|
+
end
|
138
|
+
stderr.should include('some_non_existant_file (LoadError)')
|
139
|
+
LoadedPlugin2.should be_true
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe "deprecated plugins" do
|
144
|
+
before(:each) do
|
145
|
+
FileUtils.mkdir_p(@sandbox + '/turbot-releases/lib')
|
146
|
+
end
|
147
|
+
|
148
|
+
after(:each) do
|
149
|
+
FileUtils.rm_rf(@sandbox + '/turbot-releases/lib')
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should show confirmation to remove deprecated plugins if in an interactive shell" do
|
153
|
+
old_stdin_isatty = STDIN.isatty
|
154
|
+
STDIN.stub!(:isatty).and_return(true)
|
155
|
+
Plugin.should_receive(:confirm).with("The plugin turbot-releases has been deprecated. Would you like to remove it? (y/N)").and_return(true)
|
156
|
+
Plugin.should_receive(:remove_plugin).with("turbot-releases")
|
157
|
+
Plugin.load!
|
158
|
+
STDIN.stub!(:isatty).and_return(old_stdin_isatty)
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should not prompt for deprecation if not in an interactive shell" do
|
162
|
+
old_stdin_isatty = STDIN.isatty
|
163
|
+
STDIN.stub!(:isatty).and_return(false)
|
164
|
+
Plugin.should_not_receive(:confirm)
|
165
|
+
Plugin.should_not_receive(:remove_plugin).with("turbot-releases")
|
166
|
+
Plugin.load!
|
167
|
+
STDIN.stub!(:isatty).and_return(old_stdin_isatty)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "turbot/updater"
|
3
|
+
require "turbot/version"
|
4
|
+
|
5
|
+
module Turbot
|
6
|
+
describe Updater do
|
7
|
+
|
8
|
+
it "calculates the latest local version" do
|
9
|
+
Turbot::Updater.latest_local_version.should == Turbot::VERSION
|
10
|
+
end
|
11
|
+
|
12
|
+
it "calculates compare_versions" do
|
13
|
+
Turbot::Updater.compare_versions('1.1.1', '1.1.1').should == 0
|
14
|
+
|
15
|
+
Turbot::Updater.compare_versions('2.1.1', '1.1.1').should == 1
|
16
|
+
Turbot::Updater.compare_versions('1.1.1', '2.1.1').should == -1
|
17
|
+
|
18
|
+
Turbot::Updater.compare_versions('1.2.1', '1.1.1').should == 1
|
19
|
+
Turbot::Updater.compare_versions('1.1.1', '1.2.1').should == -1
|
20
|
+
|
21
|
+
Turbot::Updater.compare_versions('1.1.2', '1.1.1').should == 1
|
22
|
+
Turbot::Updater.compare_versions('1.1.1', '1.1.2').should == -1
|
23
|
+
|
24
|
+
Turbot::Updater.compare_versions('2.1.1', '1.2.1').should == 1
|
25
|
+
Turbot::Updater.compare_versions('1.2.1', '2.1.1').should == -1
|
26
|
+
|
27
|
+
Turbot::Updater.compare_versions('2.1.1', '1.1.2').should == 1
|
28
|
+
Turbot::Updater.compare_versions('1.1.2', '2.1.1').should == -1
|
29
|
+
|
30
|
+
Turbot::Updater.compare_versions('1.2.4', '1.2.3').should == 1
|
31
|
+
Turbot::Updater.compare_versions('1.2.3', '1.2.4').should == -1
|
32
|
+
|
33
|
+
Turbot::Updater.compare_versions('1.2.1', '1.2' ).should == 1
|
34
|
+
Turbot::Updater.compare_versions('1.2', '1.2.1').should == -1
|
35
|
+
|
36
|
+
Turbot::Updater.compare_versions('1.1.1.pre1', '1.1.1').should == 1
|
37
|
+
Turbot::Updater.compare_versions('1.1.1', '1.1.1.pre1').should == -1
|
38
|
+
|
39
|
+
Turbot::Updater.compare_versions('1.1.1.pre2', '1.1.1.pre1').should == 1
|
40
|
+
Turbot::Updater.compare_versions('1.1.1.pre1', '1.1.1.pre2').should == -1
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: turbot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Turbot
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: netrc
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.7.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.7.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.6.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.6.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: launchy
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.3.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.3.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubyzip
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json-schema
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: turbot-api
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Client library and command-line tool to deploy and manage apps on Turbot.
|
98
|
+
email: support@turbot.com
|
99
|
+
executables:
|
100
|
+
- turbot
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- README.md
|
105
|
+
- bin/turbot
|
106
|
+
- data/cacert.pem
|
107
|
+
- lib/turbot.rb
|
108
|
+
- lib/turbot/auth.rb
|
109
|
+
- lib/turbot/cli.rb
|
110
|
+
- lib/turbot/client.rb
|
111
|
+
- lib/turbot/client/cisaurus.rb
|
112
|
+
- lib/turbot/client/pgbackups.rb
|
113
|
+
- lib/turbot/client/rendezvous.rb
|
114
|
+
- lib/turbot/client/ssl_endpoint.rb
|
115
|
+
- lib/turbot/client/turbot_postgresql.rb
|
116
|
+
- lib/turbot/command.rb
|
117
|
+
- lib/turbot/command/auth.rb
|
118
|
+
- lib/turbot/command/base.rb
|
119
|
+
- lib/turbot/command/bots.rb
|
120
|
+
- lib/turbot/command/config.rb
|
121
|
+
- lib/turbot/command/help.rb
|
122
|
+
- lib/turbot/command/keys.rb
|
123
|
+
- lib/turbot/command/logs.rb
|
124
|
+
- lib/turbot/command/ssl.rb
|
125
|
+
- lib/turbot/command/status.rb
|
126
|
+
- lib/turbot/command/update.rb
|
127
|
+
- lib/turbot/command/version.rb
|
128
|
+
- lib/turbot/deprecated.rb
|
129
|
+
- lib/turbot/deprecated/help.rb
|
130
|
+
- lib/turbot/distribution.rb
|
131
|
+
- lib/turbot/errors.rb
|
132
|
+
- lib/turbot/excon.rb
|
133
|
+
- lib/turbot/helpers.rb
|
134
|
+
- lib/turbot/helpers/log_displayer.rb
|
135
|
+
- lib/turbot/helpers/pg_dump_restore.rb
|
136
|
+
- lib/turbot/helpers/turbot_postgresql.rb
|
137
|
+
- lib/turbot/plugin.rb
|
138
|
+
- lib/turbot/updater.rb
|
139
|
+
- lib/turbot/version.rb
|
140
|
+
- lib/vendor/turbot/okjson.rb
|
141
|
+
- spec/helper/legacy_help.rb
|
142
|
+
- spec/helper/pg_dump_restore_spec.rb
|
143
|
+
- spec/schemas/dummy_schema.json
|
144
|
+
- spec/spec.opts
|
145
|
+
- spec/spec_helper.rb
|
146
|
+
- spec/support/display_message_matcher.rb
|
147
|
+
- spec/support/dummy_api.rb
|
148
|
+
- spec/support/openssl_mock_helper.rb
|
149
|
+
- spec/support/organizations_mock_helper.rb
|
150
|
+
- spec/turbot/auth_spec.rb
|
151
|
+
- spec/turbot/client/pgbackups_spec.rb
|
152
|
+
- spec/turbot/client/rendezvous_spec.rb
|
153
|
+
- spec/turbot/client/ssl_endpoint_spec.rb
|
154
|
+
- spec/turbot/client/turbot_postgresql_spec.rb
|
155
|
+
- spec/turbot/client_spec.rb
|
156
|
+
- spec/turbot/command/auth_spec.rb
|
157
|
+
- spec/turbot/command/base_spec.rb
|
158
|
+
- spec/turbot/command/bots_spec.rb
|
159
|
+
- spec/turbot/command/config_spec.rb
|
160
|
+
- spec/turbot/command/help_spec.rb
|
161
|
+
- spec/turbot/command/keys_spec.rb
|
162
|
+
- spec/turbot/command/logs_spec.rb
|
163
|
+
- spec/turbot/command/status_spec.rb
|
164
|
+
- spec/turbot/command/version_spec.rb
|
165
|
+
- spec/turbot/command_spec.rb
|
166
|
+
- spec/turbot/helpers/turbot_postgresql_spec.rb
|
167
|
+
- spec/turbot/helpers_spec.rb
|
168
|
+
- spec/turbot/plugin_spec.rb
|
169
|
+
- spec/turbot/updater_spec.rb
|
170
|
+
- templates/manifest.json
|
171
|
+
- templates/scraper.py
|
172
|
+
- templates/scraper.rb
|
173
|
+
homepage: http://turbot.com/
|
174
|
+
licenses:
|
175
|
+
- MIT
|
176
|
+
metadata: {}
|
177
|
+
post_install_message: ! " ! The `turbot` gem has been deprecated and replaced with
|
178
|
+
the Turbot Toolbelt.\n ! Download and install from: https://toolbelt.turbot.com\n
|
179
|
+
! For API access, see: https://github.com/turbot/turbot.rb\n"
|
180
|
+
rdoc_options: []
|
181
|
+
require_paths:
|
182
|
+
- lib
|
183
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ! '>='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 1.9.2
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ! '>='
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubyforge_project:
|
195
|
+
rubygems_version: 2.2.2
|
196
|
+
signing_key:
|
197
|
+
specification_version: 4
|
198
|
+
summary: Client library and CLI to deploy apps on Turbot.
|
199
|
+
test_files: []
|