cf 5.2.1.rc8 → 5.2.1.rc9

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YThiM2I0YjhiZjFkYWFmNmZhYWU2ZmU2MDUzODYyZGU0OThhNDhkMw==
4
+ OTJjODEwNDUzYmM5NzU1ZmM0OWZhODFlNzgyY2UwMmMwMDU5NzZjNQ==
5
5
  data.tar.gz: !binary |-
6
- MTdhZGNhNDA2YTBmMTBhMzBkNzBjZmJiY2IwYjVhMjI5NzJkOGZlYg==
6
+ OGYwYWQzZjA1NDBmZGZlZDdjZDdjMGQyOGJkZWMwZmVhYTkwMjljZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZGY3N2JkY2U5YWVmMzc5NDRhZjY5YTQ4YWU2YTI5YWI5MjQ3YzM3Y2Q0ZTY0
10
- MTQyM2VjNGExNzEzYjgzOGIxNDJkMjkxNWJmY2FkMTYyYjkzNDg2M2U0OWMw
11
- MzVmZDc3YzNjNjAxNmU1ZGY0ZGIxMWQwZTNjMWFhYWZiNzAxODI=
9
+ ODg3YTQ4MjY3ZWJkNTY5ZWU0MDZkZWI1ZjQxZDUxYmU0MDYzM2UxNzY3NjM1
10
+ MWFkOTEyMDJhYjQxMGU2YjcyMDQ4ZmVjMDZlNjQxNTJjNDNlZjgwOGY1N2I0
11
+ OTVkNmQ2NzBlOGM0NzlhOTA1MTVhOGM0MjI1ZWVhNjQxM2IxMzA=
12
12
  data.tar.gz: !binary |-
13
- ZmY2ZWFjYzA1YWQ1MDc3Y2Y4YjUyMjhkZGFmYzFmY2Y3YThlZTlhMGU3NTIy
14
- MWRhZWVhN2U5MGQ5NjVlYjZhN2M4NTJhOGIwZmVhNTFkMzdmODFhZDU2ZGRi
15
- MTk4YzQxN2RkZDE3YmUzY2YyODk5NGFiMGU3MmYxMmFjMzA0YzY=
13
+ Y2IxNTAyNzQxNDUzN2MzMzA3NjllY2IxMzU3OGE5YmIxODAxNWFmYTExNTI2
14
+ MzYxODYwYmRlNzExZDdiZjc4MTU4ZDZmYzgyNGE3MmI4MzMyYTAyMDZmNDU2
15
+ NzFhY2E4YzZhNTEzMjg4ZjY4YWQyMmFkZjFlZDA1NTc2ZWM1YjU=
data/bin/cf CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # vim: ft=ruby
3
+ libdir = File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
4
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
3
5
 
4
6
  require "rubygems"
5
7
 
@@ -1,9 +1,10 @@
1
1
  require "yaml"
2
2
  require "socket"
3
3
  require "net/http"
4
+ require "json/ext"
4
5
  require "multi_json"
6
+ require "multi_json/adapters/json_gem"
5
7
  require "fileutils"
6
-
7
8
  require "mothership"
8
9
 
9
10
  require "cfoundry"
@@ -321,11 +322,7 @@ EOS
321
322
  end
322
323
 
323
324
  def sane_target_url(url)
324
- unless url =~ /^https?:\/\//
325
- prefix = can_connect_on_https?(url) ? "https://" : "http://"
326
- url = prefix + url
327
- end
328
-
325
+ url = "https://#{url}" if url !~ /^http/
329
326
  url.gsub(/\/$/, "")
330
327
  end
331
328
 
@@ -487,17 +484,6 @@ EOS
487
484
 
488
485
  private
489
486
 
490
- def can_connect_on_https?(unqualified_url)
491
- begin
492
- Timeout.timeout(1) do
493
- TCPSocket.new(unqualified_url, Net::HTTP.https_default_port)
494
- end
495
- true
496
- rescue Errno::ECONNREFUSED, SocketError, Timeout::Error, Errno::ETIMEDOUT
497
- false
498
- end
499
- end
500
-
501
487
  def target_file
502
488
  File.expand_path(CF::TARGET_FILE)
503
489
  end
@@ -6,8 +6,9 @@ module CF
6
6
  class Target < Base
7
7
  def populate_and_save!
8
8
  organization = CF::Populators::Organization.new(input).populate_and_save!
9
- CF::Populators::Space.new(input, organization).populate_and_save!
9
+
10
+ CF::Populators::Space.new(input, organization).populate_and_save! unless organization.nil?
10
11
  end
11
12
  end
12
13
  end
13
- end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module CF
2
- VERSION = "5.2.1.rc8".freeze
2
+ VERSION = "5.2.1.rc9".freeze
3
3
  end
@@ -0,0 +1,14 @@
1
+ # In order for this to work you'll need to install the following on the Windows box:
2
+ # git
3
+ # RubyInstaller (1.9.3)
4
+ # DevKit from RubyInstaller (tdm 32-bit to match 1.9.3)
5
+ #
6
+ # gem install bundler
7
+ # bundle
8
+ # rake windows:build
9
+ namespace :windows do
10
+ desc "Create a Windows .exe file"
11
+ task :build, [:version] do |_, args|
12
+ system("ocra --console --no-autoload bin/cf")
13
+ end
14
+ end
@@ -1,25 +1,39 @@
1
1
  require "spec_helper"
2
2
 
3
3
  module CF
4
- module Populators
5
- describe Target do
4
+ describe Populators::Target do
6
5
  describe "#populate_and_save!" do
7
6
  let(:input) { double(:input) }
8
- let(:organization) { double(:organization) }
9
- let(:space) { double(:space) }
7
+ let(:organization_populator) { double(Populators::Organization) }
8
+ let(:space_populator) { double(Populators::Space) }
10
9
 
11
10
  def execute_populate_and_save
12
- Target.new(input).populate_and_save!
11
+ Populators::Target.new(input).populate_and_save!
13
12
  end
14
13
 
15
- it "uses a organization then a space populator" do
16
- organization.should_receive(:populate_and_save!).and_return(organization)
17
- space.should_receive(:populate_and_save!)
18
- Organization.should_receive(:new).with(input).and_return(organization)
19
- Space.should_receive(:new).with(input, organization).and_return(space)
14
+ context 'when there are no orgs' do
15
+ it 'does not try to populate the space' do
16
+ Populators::Organization.stub(:new).and_return(organization_populator)
17
+ organization_populator.stub(:populate_and_save!).and_return(nil)
18
+
19
+ Populators::Space.stub(:new).and_return(space_populator)
20
+ space_populator.should_not receive(:populate_and_save!)
21
+
22
+ execute_populate_and_save
23
+ end
24
+ end
25
+
26
+ it "uses a organization_populator then a space_populator populator" do
27
+ Populators::Organization.should_receive(:new).with(input).and_return(organization_populator)
28
+
29
+ cfoundry_organization = double(CFoundry::V2::Organization)
30
+ organization_populator.should_receive(:populate_and_save!).and_return(cfoundry_organization)
31
+
32
+ Populators::Space.should_receive(:new).with(input, cfoundry_organization).and_return(space_populator)
33
+ space_populator.should_receive(:populate_and_save!)
34
+
20
35
  execute_populate_and_save
21
36
  end
22
37
  end
23
38
  end
24
- end
25
39
  end
@@ -59,7 +59,7 @@ module CF
59
59
  subject { cf ["target", target] }
60
60
 
61
61
  context "when the target is not valid" do
62
- before { WebMock.stub_request(:get, "http://#{target}/info").to_return(:body => "{}") }
62
+ before { WebMock.stub_request(:get, "https://#{target}/info").to_return(:body => "{}") }
63
63
 
64
64
  it "should still be able to switch to a valid target after that" do
65
65
  subject
@@ -461,73 +461,13 @@ module CF
461
461
  end
462
462
 
463
463
  describe "#sane_target_url" do
464
- subject(:sane_target_url) { context.sane_target_url(input_url)}
465
- context "when the given url has an http(s) scheme as a prefix" do
466
- let(:input_url) { "http://example.com" }
467
- it "removes any trailing slashes" do
468
- expect(sane_target_url).to eq "http://example.com"
469
- end
464
+ it "removes any trailing slashes" do
465
+ expect(context.sane_target_url("http://example.com/")).to eq "http://example.com"
466
+ expect(context.sane_target_url("https://example.com/")).to eq "https://example.com"
470
467
  end
471
468
 
472
- context "when the given url has no http(s) scheme" do
473
- let(:input_url) { "example.com" }
474
- context "when the url can be reached via https" do
475
- before do
476
- TCPSocket.stub(:new).with(input_url, Net::HTTP.https_default_port)
477
- end
478
-
479
- it "prepends 'https' to the url" do
480
- expect(sane_target_url).to eq "https://example.com"
481
- end
482
- end
483
-
484
- context "when the url cannot be reached via https" do
485
- before do
486
- TCPSocket.stub(:new).with(input_url, Net::HTTP.https_default_port).and_raise error
487
- end
488
-
489
- context "due to ECONNREFUSED" do
490
- let(:error) { Errno::ECONNREFUSED }
491
- it "prepends 'http' to the url" do
492
- expect(sane_target_url).to eq "http://example.com"
493
- end
494
- end
495
-
496
- context "due to a SocketError" do
497
- let(:error) { SocketError }
498
- it "prepends 'http' to the url" do
499
- expect(sane_target_url).to eq "http://example.com"
500
- end
501
- end
502
-
503
- context "due to ETIMEDOUT" do
504
- let(:error) { Errno::ETIMEDOUT }
505
- it "prepends 'http' to the url" do
506
- expect(sane_target_url).to eq "http://example.com"
507
- end
508
- end
509
- end
510
-
511
- context "when the TCP connection times out" do
512
- let(:current_time) { Time.now }
513
-
514
- before do
515
- TCPSocket.stub(:new).with(input_url, Net::HTTP.https_default_port) {
516
- sleep 10
517
- }
518
- end
519
-
520
- it "prepends 'http' to the url" do
521
- expect(sane_target_url).to eq "http://example.com"
522
- end
523
-
524
- it "times out after one second" do
525
- start_time = Time.now
526
- sane_target_url
527
- end_time = Time.now
528
- expect(end_time).to be_within(0.5).of(start_time + 1)
529
- end
530
- end
469
+ it "defaults to https when the given url has no http(s) scheme" do
470
+ expect(context.sane_target_url("example.com")).to eq "https://example.com"
531
471
  end
532
472
  end
533
473
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.1.rc8
4
+ version: 5.2.1.rc9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloud Foundry Team
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-27 00:00:00.000000000 Z
12
+ date: 2013-08-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable
@@ -137,6 +137,20 @@ dependencies:
137
137
  - - ~>
138
138
  - !ruby/object:Gem::Version
139
139
  version: '2.1'
140
+ - !ruby/object:Gem::Dependency
141
+ name: anchorman
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ! '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
140
154
  - !ruby/object:Gem::Dependency
141
155
  name: blue-shell
142
156
  requirement: !ruby/object:Gem::Requirement
@@ -207,6 +221,20 @@ dependencies:
207
221
  - - ! '>='
208
222
  - !ruby/object:Gem::Version
209
223
  version: '0'
224
+ - !ruby/object:Gem::Dependency
225
+ name: ocra
226
+ requirement: !ruby/object:Gem::Requirement
227
+ requirements:
228
+ - - ! '>='
229
+ - !ruby/object:Gem::Version
230
+ version: '0'
231
+ type: :development
232
+ prerelease: false
233
+ version_requirements: !ruby/object:Gem::Requirement
234
+ requirements:
235
+ - - ! '>='
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
210
238
  - !ruby/object:Gem::Dependency
211
239
  name: rake
212
240
  requirement: !ruby/object:Gem::Requirement
@@ -400,6 +428,7 @@ files:
400
428
  - lib/micro/switcher/windows.rb
401
429
  - lib/micro/vmrun.rb
402
430
  - lib/tasks/gem_release.rake
431
+ - lib/tasks/windows_build.rake
403
432
  - lib/tunnel/config/clients.yml
404
433
  - lib/tunnel/helper-app/Gemfile
405
434
  - lib/tunnel/helper-app/Gemfile.lock