kensa 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kensa (1.2.1)
4
+ kensa (1.3.0)
5
5
  launchy (>= 0.3.2)
6
6
  mechanize (~> 1.0.0)
7
- rest-client (< 1.7.0, >= 1.4.0)
7
+ rest-client (>= 1.4.0, < 1.7.0)
8
8
  term-ansicolor (~> 1.0)
9
9
 
10
10
  GEM
data/bin/kensa CHANGED
@@ -86,3 +86,7 @@ TEST TYPES
86
86
  manifest
87
87
  Confirm that the manifest is valid. Automatically runs before all tests.
88
88
 
89
+ all
90
+ runs provision, planchange, and deprovision tests.
91
+ defaults to using 'foo' for planchange plan.
92
+
@@ -488,6 +488,8 @@ module Heroku
488
488
  screen.message "End of #{args.first}\n"
489
489
  end
490
490
 
491
+ data[:plan] ||= 'foo'
492
+ run PlanChangeCheck, data
491
493
  run DeprovisionCheck, data
492
494
  end
493
495
 
@@ -22,7 +22,9 @@ module Heroku
22
22
  end
23
23
 
24
24
  def init
25
- Manifest.new(@options).write
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
@@ -4,7 +4,7 @@ module Heroku
4
4
 
5
5
  def initialize(options = {})
6
6
  @method = options.fetch(:method, 'get').to_sym
7
- @filename = options.fetch(:filename, 'addon-manifest.json')
7
+ @filename = options[:filename]
8
8
  @options = options
9
9
  end
10
10
 
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  module Kensa
3
- VERSION = '1.2.1'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
@@ -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
- def setup
6
- FakeFS.activate!
7
- @filename = 'addon-manifest.json'
8
- end
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
- def teardown
11
- File.unlink(@filename) if @filename && File.exist?(@filename)
12
- FakeFS.deactivate!
14
+ assert_raises SystemExit do
15
+ kensa "init"
16
+ end
13
17
  end
14
18
 
15
19
  def test_init_default_so_sso_post
@@ -2,6 +2,7 @@ require 'test/helper'
2
2
 
3
3
  class OptionParsingTest < Test::Unit::TestCase
4
4
  include Heroku::Kensa
5
+ include FsMock
5
6
 
6
7
  def options_for_cmd(string)
7
8
  client = Client.new(string.split)
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 2
9
- - 1
10
- version: 1.2.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-14 00:00:00 -08:00
22
+ date: 2011-12-21 00:00:00 -08:00
23
23
  default_executable: kensa
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency