kensa 1.2.1 → 1.3.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.
- data/Gemfile.lock +2 -2
- data/bin/kensa +4 -0
- data/lib/heroku/kensa/check.rb +2 -0
- data/lib/heroku/kensa/client.rb +14 -7
- data/lib/heroku/kensa/manifest.rb +1 -1
- data/lib/heroku/kensa/version.rb +1 -1
- data/test/all_check_test.rb +7 -0
- data/test/helper.rb +17 -0
- data/test/init_test.rb +12 -8
- data/test/options_parsing_test.rb +1 -0
- metadata +5 -5
data/Gemfile.lock
CHANGED
data/bin/kensa
CHANGED
data/lib/heroku/kensa/check.rb
CHANGED
data/lib/heroku/kensa/client.rb
CHANGED
@@ -22,7 +22,9 @@ module Heroku
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def init
|
25
|
-
Manifest.new(@options)
|
25
|
+
manifest = Manifest.new(@options)
|
26
|
+
protect_current_manifest!
|
27
|
+
manifest.write
|
26
28
|
screen.message "Initialized new addon manifest in #{filename}\n"
|
27
29
|
if @options[:foreman]
|
28
30
|
screen.message "Initialized new .env file for foreman\n"
|
@@ -60,6 +62,8 @@ module Heroku
|
|
60
62
|
when "sso"
|
61
63
|
id = @args.shift || abort("! no id specified; see usage")
|
62
64
|
run_check ManifestCheck, SsoCheck, :id => id
|
65
|
+
when "all"
|
66
|
+
run_check AllCheck
|
63
67
|
else
|
64
68
|
abort "! Unknown test '#{check}'; see usage"
|
65
69
|
end
|
@@ -97,12 +101,7 @@ module Heroku
|
|
97
101
|
|
98
102
|
def pull
|
99
103
|
addon = @args.first || abort('usage: kensa pull <add-on name>')
|
100
|
-
|
101
|
-
if manifest_exists?
|
102
|
-
print "Manifest already exists. Replace it? (y/n) "
|
103
|
-
abort unless gets.strip.downcase == 'y'
|
104
|
-
puts
|
105
|
-
end
|
104
|
+
protect_current_manifest!
|
106
105
|
|
107
106
|
user, password = ask_for_credentials
|
108
107
|
host = heroku_host
|
@@ -117,6 +116,14 @@ module Heroku
|
|
117
116
|
end
|
118
117
|
|
119
118
|
private
|
119
|
+
def protect_current_manifest!
|
120
|
+
if manifest_exists?
|
121
|
+
print "Manifest already exists. Replace it? (y/n) "
|
122
|
+
abort unless gets.strip.downcase == 'y'
|
123
|
+
puts
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
120
127
|
def filename
|
121
128
|
@options[:filename]
|
122
129
|
end
|
data/lib/heroku/kensa/version.rb
CHANGED
data/test/all_check_test.rb
CHANGED
@@ -3,6 +3,7 @@ require 'test/helper'
|
|
3
3
|
class AllCheckTest < Test::Unit::TestCase
|
4
4
|
include Heroku::Kensa
|
5
5
|
include ProviderMock
|
6
|
+
include FsMock
|
6
7
|
|
7
8
|
setup do
|
8
9
|
@data = Manifest.new(:method => :get).skeleton
|
@@ -23,4 +24,10 @@ class AllCheckTest < Test::Unit::TestCase
|
|
23
24
|
assert_invalid
|
24
25
|
end
|
25
26
|
|
27
|
+
test "all runs" do
|
28
|
+
assert_nothing_raised do
|
29
|
+
kensa "init"
|
30
|
+
kensa "test all"
|
31
|
+
end
|
32
|
+
end
|
26
33
|
end
|
data/test/helper.rb
CHANGED
@@ -5,6 +5,7 @@ require 'timecop'
|
|
5
5
|
require 'rr'
|
6
6
|
require 'artifice'
|
7
7
|
require 'test/resources/server'
|
8
|
+
require 'fakefs/safe'
|
8
9
|
|
9
10
|
class Test::Unit::TestCase
|
10
11
|
include RR::Adapters::TestUnit
|
@@ -12,10 +13,26 @@ class Test::Unit::TestCase
|
|
12
13
|
module ProviderMock
|
13
14
|
def setup
|
14
15
|
Artifice.activate_with(ProviderServer)
|
16
|
+
super
|
15
17
|
end
|
16
18
|
|
17
19
|
def teardown
|
18
20
|
Artifice.deactivate
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module FsMock
|
26
|
+
def setup
|
27
|
+
FakeFS.activate!
|
28
|
+
@filename = 'addon-manifest.json'
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
def teardown
|
33
|
+
File.unlink(@filename) if @filename && File.exist?(@filename)
|
34
|
+
FakeFS.deactivate!
|
35
|
+
super
|
19
36
|
end
|
20
37
|
end
|
21
38
|
|
data/test/init_test.rb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
require 'test/helper'
|
2
|
-
require 'fakefs/safe'
|
3
2
|
|
4
3
|
class InitTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
include FsMock
|
5
|
+
|
6
|
+
def test_init_doesnt_overwite_addon_manifest
|
7
|
+
File.open(@filename, 'w') { |f| f << '{}' }
|
8
|
+
any_instance_of(Heroku::Kensa::Client) do |client|
|
9
|
+
stub(client).gets { 'n' }
|
10
|
+
stub(client).print
|
11
|
+
stub(client).puts
|
12
|
+
end
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
|
14
|
+
assert_raises SystemExit do
|
15
|
+
kensa "init"
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
def test_init_default_so_sso_post
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kensa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 1.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Blake Mizerany
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2011-12-
|
22
|
+
date: 2011-12-21 00:00:00 -08:00
|
23
23
|
default_executable: kensa
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|