cf 0.6.0.rc3 → 0.6.0.rc4
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/lib/cf/cli/app/app.rb +0 -2
- data/lib/cf/cli/app/apps.rb +1 -12
- data/lib/cf/cli/app/push.rb +0 -4
- data/lib/cf/cli/app/push/create.rb +0 -33
- data/lib/cf/cli/app/push/interactions.rb +0 -8
- data/lib/cf/cli/app/push/sync.rb +0 -4
- data/lib/cf/cli/start/info.rb +4 -63
- data/lib/cf/version.rb +1 -1
- data/spec/cf/cli/app/push/create_spec.rb +2 -156
- data/spec/cf/cli/app/push_spec.rb +3 -53
- data/spec/cf/cli/start/info_spec.rb +3 -56
- data/spec/cf/cli/start/target_spec.rb +1 -3
- data/spec/cf/detect_spec.rb +0 -20
- data/spec/features/push_flow_spec.rb +4 -4
- metadata +9 -9
    
        data/lib/cf/cli/app/app.rb
    CHANGED
    
    | @@ -24,8 +24,6 @@ module CF::App | |
| 24 24 | 
             
                  line "#{c(a.name, :name)}: #{status}"
         | 
| 25 25 |  | 
| 26 26 | 
             
                  indented do
         | 
| 27 | 
            -
                    line "platform: #{b(a.framework.name)} on #{b(a.runtime.name)}"
         | 
| 28 | 
            -
             | 
| 29 27 | 
             
                    start_line "usage: #{b(human_mb(a.memory))}"
         | 
| 30 28 | 
             
                    print " #{d(IS_UTF8 ? "\xc3\x97" : "x")} #{b(a.total_instances)}"
         | 
| 31 29 | 
             
                    print " instance#{a.total_instances == 1 ? "" : "s"}"
         | 
    
        data/lib/cf/cli/app/apps.rb
    CHANGED
    
    | @@ -8,8 +8,6 @@ module CF::App | |
| 8 8 | 
             
                      :default => proc { client.current_space },
         | 
| 9 9 | 
             
                      :from_given => by_name(:space)
         | 
| 10 10 | 
             
                input :name, :desc => "Filter by name regexp"
         | 
| 11 | 
            -
                input :runtime, :desc => "Filter by runtime regexp"
         | 
| 12 | 
            -
                input :framework, :desc => "Filter by framework regexp"
         | 
| 13 11 | 
             
                input :url, :desc => "Filter by url regexp"
         | 
| 14 12 | 
             
                input :full, :desc => "Verbose output format", :default => false
         | 
| 15 13 | 
             
                def apps
         | 
| @@ -58,13 +56,12 @@ module CF::App | |
| 58 56 |  | 
| 59 57 | 
             
                def display_apps_table(apps)
         | 
| 60 58 | 
             
                  table(
         | 
| 61 | 
            -
                    ["name", "status", "usage", "plan", " | 
| 59 | 
            +
                    ["name", "status", "usage", "plan", "url"],
         | 
| 62 60 | 
             
                    apps.collect { |a|
         | 
| 63 61 | 
             
                      [ c(a.name, :name),
         | 
| 64 62 | 
             
                        app_status(a),
         | 
| 65 63 | 
             
                        "#{a.total_instances} x #{human_mb(a.memory)}",
         | 
| 66 64 | 
             
                        a.production ? "prod" : "dev",
         | 
| 67 | 
            -
                        a.runtime.name,
         | 
| 68 65 | 
             
                        if a.urls.empty?
         | 
| 69 66 | 
             
                          d("none")
         | 
| 70 67 | 
             
                        elsif a.urls.size == 1
         | 
| @@ -81,14 +78,6 @@ module CF::App | |
| 81 78 | 
             
                    return false if a.name !~ /#{name}/
         | 
| 82 79 | 
             
                  end
         | 
| 83 80 |  | 
| 84 | 
            -
                  if runtime = options[:runtime]
         | 
| 85 | 
            -
                    return false if a.runtime.name !~ /#{runtime}/
         | 
| 86 | 
            -
                  end
         | 
| 87 | 
            -
             | 
| 88 | 
            -
                  if framework = options[:framework]
         | 
| 89 | 
            -
                    return false if a.framework.name !~ /#{framework}/
         | 
| 90 | 
            -
                  end
         | 
| 91 | 
            -
             | 
| 92 81 | 
             
                  if url = options[:url]
         | 
| 93 82 | 
             
                    return false if a.urls.none? { |u| u =~ /#{url}/ }
         | 
| 94 83 | 
             
                  end
         | 
    
        data/lib/cf/cli/app/push.rb
    CHANGED
    
    | @@ -24,10 +24,6 @@ module CF::App | |
| 24 24 | 
             
                                  }
         | 
| 25 25 | 
             
                input :memory,    :desc => "Memory limit"
         | 
| 26 26 | 
             
                input :instances, :desc => "Number of instances to run", :type => :integer
         | 
| 27 | 
            -
                input :framework, :desc => "Framework to use",
         | 
| 28 | 
            -
                                  :from_given => by_name(:framework)
         | 
| 29 | 
            -
                input :runtime,   :desc => "Runtime to use",
         | 
| 30 | 
            -
                                  :from_given => by_name(:runtime)
         | 
| 31 27 | 
             
                input :command,   :desc => "Startup command"
         | 
| 32 28 | 
             
                input :plan,      :desc => "Application plan", :default => "D100"
         | 
| 33 29 | 
             
                input :start,     :desc => "Start app after pushing?", :default => true
         | 
| @@ -25,35 +25,6 @@ module CF::App | |
| 25 25 | 
             
                  inputs
         | 
| 26 26 | 
             
                end
         | 
| 27 27 |  | 
| 28 | 
            -
                def determine_framework
         | 
| 29 | 
            -
                  return input[:framework] if input.has?(:framework)
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                  if (detected_framework = detector.detect_framework)
         | 
| 32 | 
            -
                    input[:framework, [detected_framework], detected_framework, :other]
         | 
| 33 | 
            -
                  else
         | 
| 34 | 
            -
                    input[:framework, detector.all_frameworks, nil, nil]
         | 
| 35 | 
            -
                  end
         | 
| 36 | 
            -
                end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                def determine_runtime(framework)
         | 
| 39 | 
            -
                  return input[:runtime] if input.has?(:runtime)
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                  detected_runtimes =
         | 
| 42 | 
            -
                    if framework.name == "standalone"
         | 
| 43 | 
            -
                      detector.detect_runtimes
         | 
| 44 | 
            -
                    else
         | 
| 45 | 
            -
                      detector.runtimes(framework)
         | 
| 46 | 
            -
                    end
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                  default_runtime = detected_runtimes.size == 1 ? detected_runtimes.first : nil
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                  if detected_runtimes.empty?
         | 
| 51 | 
            -
                    input[:runtime, detector.all_runtimes, nil, nil]
         | 
| 52 | 
            -
                  else
         | 
| 53 | 
            -
                    input[:runtime, detected_runtimes, default_runtime, :other]
         | 
| 54 | 
            -
                  end
         | 
| 55 | 
            -
                end
         | 
| 56 | 
            -
             | 
| 57 28 | 
             
                def create_app(inputs)
         | 
| 58 29 | 
             
                  app = client.app
         | 
| 59 30 |  | 
| @@ -130,10 +101,6 @@ module CF::App | |
| 130 101 | 
             
                  File.exists?("#@path/Procfile")
         | 
| 131 102 | 
             
                end
         | 
| 132 103 |  | 
| 133 | 
            -
                def can_have_custom_start_command?(framework)
         | 
| 134 | 
            -
                  framework.name == "standalone"
         | 
| 135 | 
            -
                end
         | 
| 136 | 
            -
             | 
| 137 104 | 
             
                def all_instances
         | 
| 138 105 | 
             
                  @all_instances ||= client.service_instances
         | 
| 139 106 | 
             
                end
         | 
| @@ -35,14 +35,6 @@ module CF::App | |
| 35 35 | 
             
                  ask("Instances", :default => 1)
         | 
| 36 36 | 
             
                end
         | 
| 37 37 |  | 
| 38 | 
            -
                def ask_framework(choices, default, other)
         | 
| 39 | 
            -
                  ask_with_other("Framework", client.frameworks, choices, default, other)
         | 
| 40 | 
            -
                end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                def ask_runtime(choices, default, other)
         | 
| 43 | 
            -
                  ask_with_other("Runtime", client.runtimes, choices, default, other)
         | 
| 44 | 
            -
                end
         | 
| 45 | 
            -
             | 
| 46 38 | 
             
                def ask_command
         | 
| 47 39 | 
             
                  command = ask("Custom startup command", :default => "none")
         | 
| 48 40 |  | 
    
        data/lib/cf/cli/app/push/sync.rb
    CHANGED
    
    | @@ -5,8 +5,6 @@ module CF::App | |
| 5 5 | 
             
                  app.total_instances = input[:instances] if input.has?(:instances)
         | 
| 6 6 | 
             
                  app.command = input[:command] if input.has?(:command)
         | 
| 7 7 | 
             
                  app.production = input[:plan].upcase.start_with?("P") if input.has?(:plan)
         | 
| 8 | 
            -
                  app.framework = input[:framework] if input.has?(:framework)
         | 
| 9 | 
            -
                  app.runtime = input[:runtime] if input.has?(:runtime)
         | 
| 10 8 | 
             
                  app.buildpack = input[:buildpack] if input.has?(:buildpack)
         | 
| 11 9 | 
             
                end
         | 
| 12 10 |  | 
| @@ -42,8 +40,6 @@ module CF::App | |
| 42 40 | 
             
                  case attr
         | 
| 43 41 | 
             
                  when :memory
         | 
| 44 42 | 
             
                    human_mb(val)
         | 
| 45 | 
            -
                  when :framework, :runtime
         | 
| 46 | 
            -
                    val.name
         | 
| 47 43 | 
             
                  when :command, :buildpack
         | 
| 48 44 | 
             
                    "'#{val}'"
         | 
| 49 45 | 
             
                  when :production
         | 
    
        data/lib/cf/cli/start/info.rb
    CHANGED
    
    | @@ -8,10 +8,6 @@ module CF::Start | |
| 8 8 |  | 
| 9 9 | 
             
                desc "Display information on the current target, user, etc."
         | 
| 10 10 | 
             
                group :start
         | 
| 11 | 
            -
                input :runtimes, :desc => "List supported runtimes", :alias => "-r",
         | 
| 12 | 
            -
                      :default => false
         | 
| 13 | 
            -
                input :frameworks, :desc => "List supported frameworks", :alias => "-f",
         | 
| 14 | 
            -
                      :default => false
         | 
| 15 11 | 
             
                input :services, :desc => "List supported services", :alias => "-s",
         | 
| 16 12 | 
             
                      :default => false
         | 
| 17 13 | 
             
                input :all, :desc => "Show all information", :alias => "-a",
         | 
| @@ -19,33 +15,14 @@ module CF::Start | |
| 19 15 | 
             
                def info
         | 
| 20 16 | 
             
                  all = input[:all]
         | 
| 21 17 |  | 
| 22 | 
            -
                  if all || input[:runtimes]
         | 
| 23 | 
            -
                    runtimes =
         | 
| 24 | 
            -
                        with_progress("Getting runtimes") do
         | 
| 25 | 
            -
                          client.runtimes
         | 
| 26 | 
            -
                        end
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                  if all || input[:frameworks]
         | 
| 30 | 
            -
                    frameworks =
         | 
| 31 | 
            -
                        with_progress("Getting frameworks") do
         | 
| 32 | 
            -
                          client.frameworks
         | 
| 33 | 
            -
                        end
         | 
| 34 | 
            -
                  end
         | 
| 35 | 
            -
             | 
| 36 18 | 
             
                  if all || input[:services]
         | 
| 37 | 
            -
                    services =
         | 
| 38 | 
            -
                        with_progress("Getting services") do
         | 
| 39 | 
            -
                          client.services
         | 
| 40 | 
            -
                        end
         | 
| 19 | 
            +
                    services = with_progress("Getting services") { client.services }
         | 
| 41 20 | 
             
                  end
         | 
| 42 21 |  | 
| 43 | 
            -
                   | 
| 44 | 
            -
             | 
| 45 | 
            -
                  unless !all && showing_any
         | 
| 22 | 
            +
                  if all || !services
         | 
| 46 23 | 
             
                    info = client.info
         | 
| 47 24 |  | 
| 48 | 
            -
                    line if  | 
| 25 | 
            +
                    line if services
         | 
| 49 26 | 
             
                    line info[:description]
         | 
| 50 27 | 
             
                    line
         | 
| 51 28 | 
             
                    line "target: #{b(client.target)}"
         | 
| @@ -55,48 +32,12 @@ module CF::Start | |
| 55 32 | 
             
                      line "support: #{info[:support]}"
         | 
| 56 33 | 
             
                    end
         | 
| 57 34 |  | 
| 58 | 
            -
                    if user = client.current_user
         | 
| 35 | 
            +
                    if (user = client.current_user)
         | 
| 59 36 | 
             
                      line
         | 
| 60 37 | 
             
                      line "user: #{b(user.email || user.guid)}"
         | 
| 61 38 | 
             
                    end
         | 
| 62 39 | 
             
                  end
         | 
| 63 40 |  | 
| 64 | 
            -
                  if runtimes
         | 
| 65 | 
            -
                    line unless quiet?
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                    if runtimes.empty? && !quiet?
         | 
| 68 | 
            -
                      line "#{d("none")}"
         | 
| 69 | 
            -
                    elsif input[:quiet]
         | 
| 70 | 
            -
                      runtimes.each do |r|
         | 
| 71 | 
            -
                        line r.name
         | 
| 72 | 
            -
                      end
         | 
| 73 | 
            -
                    else
         | 
| 74 | 
            -
                      table(
         | 
| 75 | 
            -
                          %w{runtime description},
         | 
| 76 | 
            -
                          runtimes.sort_by(&:name).collect { |r|
         | 
| 77 | 
            -
                            [c(r.name, :name), r.description]
         | 
| 78 | 
            -
                          })
         | 
| 79 | 
            -
                    end
         | 
| 80 | 
            -
                  end
         | 
| 81 | 
            -
             | 
| 82 | 
            -
                  if frameworks
         | 
| 83 | 
            -
                    line unless quiet?
         | 
| 84 | 
            -
             | 
| 85 | 
            -
                    if frameworks.empty? && !quiet?
         | 
| 86 | 
            -
                      line "#{d("none")}"
         | 
| 87 | 
            -
                    elsif input[:quiet]
         | 
| 88 | 
            -
                      frameworks.each do |f|
         | 
| 89 | 
            -
                        line f.name
         | 
| 90 | 
            -
                      end
         | 
| 91 | 
            -
                    else
         | 
| 92 | 
            -
                      table(
         | 
| 93 | 
            -
                          %w{framework description},
         | 
| 94 | 
            -
                          frameworks.sort_by(&:name).collect { |f|
         | 
| 95 | 
            -
                            [c(f.name, :name), f.description]
         | 
| 96 | 
            -
                          })
         | 
| 97 | 
            -
                    end
         | 
| 98 | 
            -
                  end
         | 
| 99 | 
            -
             | 
| 100 41 | 
             
                  if services
         | 
| 101 42 | 
             
                    line unless quiet?
         | 
| 102 43 |  | 
    
        data/lib/cf/version.rb
    CHANGED
    
    
| @@ -6,24 +6,11 @@ describe CF::App::Create do | |
| 6 6 | 
             
              let(:given) { {} }
         | 
| 7 7 | 
             
              let(:global) { { :color => false, :quiet => true } }
         | 
| 8 8 |  | 
| 9 | 
            -
              let(:frameworks) { fake_list(:framework, 3) }
         | 
| 10 | 
            -
              let(:framework) { buildpack }
         | 
| 11 | 
            -
              let(:buildpack) { fake(:framework, :name => "buildpack") }
         | 
| 12 | 
            -
              let(:standalone) { fake(:framework, :name => "standalone") }
         | 
| 13 | 
            -
             | 
| 14 | 
            -
              let(:runtimes) { fake_list(:runtime, 3) }
         | 
| 15 | 
            -
              let(:runtime) { runtimes.first }
         | 
| 16 | 
            -
             | 
| 17 9 | 
             
              let(:service_instances) { fake_list(:service_instance, 5) }
         | 
| 18 | 
            -
             | 
| 19 10 | 
             
              let(:lucid64) { fake :stack, :name => "lucid64" }
         | 
| 20 11 |  | 
| 21 12 | 
             
              let(:client) do
         | 
| 22 | 
            -
                fake_client(
         | 
| 23 | 
            -
                  :frameworks => frameworks,
         | 
| 24 | 
            -
                  :runtimes => runtimes,
         | 
| 25 | 
            -
                  :service_instances => service_instances,
         | 
| 26 | 
            -
                  :stacks => [lucid64])
         | 
| 13 | 
            +
                fake_client(:service_instances => service_instances, :stacks => [lucid64])
         | 
| 27 14 | 
             
              end
         | 
| 28 15 |  | 
| 29 16 | 
             
              before do
         | 
| @@ -62,11 +49,8 @@ describe CF::App::Create do | |
| 62 49 | 
             
                  its([:total_instances]) { should eq 1 }
         | 
| 63 50 | 
             
                  its([:space]) { should eq client.current_space }
         | 
| 64 51 | 
             
                  its([:production]) { should eq true }
         | 
| 65 | 
            -
                  its([:framework]) { should eq nil }
         | 
| 66 | 
            -
                  its([:runtime]) { should eq nil }
         | 
| 67 52 | 
             
                  its([:command]) { should eq "ruby main.rb" }
         | 
| 68 53 | 
             
                  its([:memory]) { should eq 1024 }
         | 
| 69 | 
            -
                  its([:buildpack]) { should eq "git://example.com" }
         | 
| 70 54 | 
             
                  its([:stack]) { should eq lucid64 }
         | 
| 71 55 | 
             
                end
         | 
| 72 56 |  | 
| @@ -103,14 +87,6 @@ describe CF::App::Create do | |
| 103 87 | 
             
                    subject
         | 
| 104 88 | 
             
                  end
         | 
| 105 89 |  | 
| 106 | 
            -
                  it 'does not ask for the framework' do
         | 
| 107 | 
            -
                    dont_allow_ask('Framework', anything) do |_, options|
         | 
| 108 | 
            -
                      expect(options[:choices]).to eq frameworks.sort_by(&:name)
         | 
| 109 | 
            -
                      framework
         | 
| 110 | 
            -
                    end
         | 
| 111 | 
            -
                    subject
         | 
| 112 | 
            -
                  end
         | 
| 113 | 
            -
             | 
| 114 90 | 
             
                  context 'when the command is not given' do
         | 
| 115 91 | 
             
                    before { given.delete(:command) }
         | 
| 116 92 |  | 
| @@ -134,17 +110,7 @@ describe CF::App::Create do | |
| 134 110 | 
             
                      end
         | 
| 135 111 | 
             
                    end
         | 
| 136 112 |  | 
| 137 | 
            -
                     | 
| 138 | 
            -
                      let(:framework) { buildpack }
         | 
| 139 | 
            -
             | 
| 140 | 
            -
                      include_examples 'an app that can have a custom start command'
         | 
| 141 | 
            -
                    end
         | 
| 142 | 
            -
             | 
| 143 | 
            -
                    context 'when the framework is "standalone"' do
         | 
| 144 | 
            -
                      let(:framework) { standalone }
         | 
| 145 | 
            -
             | 
| 146 | 
            -
                      include_examples 'an app that can have a custom start command'
         | 
| 147 | 
            -
                    end
         | 
| 113 | 
            +
                    include_examples 'an app that can have a custom start command'
         | 
| 148 114 |  | 
| 149 115 | 
             
                    describe "getting the start command" do
         | 
| 150 116 | 
             
                      before do
         | 
| @@ -179,14 +145,6 @@ describe CF::App::Create do | |
| 179 145 | 
             
                    end
         | 
| 180 146 | 
             
                  end
         | 
| 181 147 |  | 
| 182 | 
            -
                  it 'does not ask for the runtime' do
         | 
| 183 | 
            -
                    dont_allow_ask('Runtime', anything) do |_, options|
         | 
| 184 | 
            -
                      expect(options[:choices]).to eq runtimes.sort_by(&:name)
         | 
| 185 | 
            -
                      runtime
         | 
| 186 | 
            -
                    end
         | 
| 187 | 
            -
                    subject
         | 
| 188 | 
            -
                  end
         | 
| 189 | 
            -
             | 
| 190 148 | 
             
                  it 'asks for the memory' do
         | 
| 191 149 | 
             
                    given.delete(:memory)
         | 
| 192 150 |  | 
| @@ -209,116 +167,6 @@ describe CF::App::Create do | |
| 209 167 | 
             
                end
         | 
| 210 168 | 
             
              end
         | 
| 211 169 |  | 
| 212 | 
            -
              describe '#determine_framework' do
         | 
| 213 | 
            -
                subject { create.determine_framework }
         | 
| 214 | 
            -
             | 
| 215 | 
            -
                context 'when framework is given' do
         | 
| 216 | 
            -
                  let(:inputs) { { :framework => framework } }
         | 
| 217 | 
            -
             | 
| 218 | 
            -
                  it 'does not try to get the frameworks' do
         | 
| 219 | 
            -
                    any_instance_of(CF::Detector) do |detector|
         | 
| 220 | 
            -
                      dont_allow(detector).detect_framework
         | 
| 221 | 
            -
                      dont_allow(detector).all_frameworks
         | 
| 222 | 
            -
                    end
         | 
| 223 | 
            -
             | 
| 224 | 
            -
                    dont_allow_ask
         | 
| 225 | 
            -
                    dont_allow(client).frameworks
         | 
| 226 | 
            -
             | 
| 227 | 
            -
                    subject
         | 
| 228 | 
            -
                  end
         | 
| 229 | 
            -
             | 
| 230 | 
            -
                  it { should eq framework }
         | 
| 231 | 
            -
                end
         | 
| 232 | 
            -
             | 
| 233 | 
            -
                context 'when framework is not given' do
         | 
| 234 | 
            -
                  context 'and a framework is detected' do
         | 
| 235 | 
            -
                    it "lists the detected framework and an 'other' option" do
         | 
| 236 | 
            -
                      any_instance_of(CF::Detector) do |detector|
         | 
| 237 | 
            -
                        mock(detector).detect_framework { framework }
         | 
| 238 | 
            -
                      end
         | 
| 239 | 
            -
             | 
| 240 | 
            -
                      mock_ask('Framework', anything) do |_, options|
         | 
| 241 | 
            -
                        expect(options[:choices]).to eq [framework, :other] #frameworks.sort_by(&:name)
         | 
| 242 | 
            -
                        framework
         | 
| 243 | 
            -
                      end
         | 
| 244 | 
            -
             | 
| 245 | 
            -
                      subject
         | 
| 246 | 
            -
                    end
         | 
| 247 | 
            -
                  end
         | 
| 248 | 
            -
             | 
| 249 | 
            -
                  context 'and a framework is not detected' do
         | 
| 250 | 
            -
                    it "lists all available frameworks" do
         | 
| 251 | 
            -
                      any_instance_of(CF::Detector) do |detector|
         | 
| 252 | 
            -
                        stub(detector).detect_framework
         | 
| 253 | 
            -
                      end
         | 
| 254 | 
            -
             | 
| 255 | 
            -
                      mock_ask('Framework', anything) do |_, options|
         | 
| 256 | 
            -
                        expect(options[:choices]).to eq frameworks.sort_by(&:name)
         | 
| 257 | 
            -
                        framework
         | 
| 258 | 
            -
                      end
         | 
| 259 | 
            -
             | 
| 260 | 
            -
                      subject
         | 
| 261 | 
            -
                    end
         | 
| 262 | 
            -
                  end
         | 
| 263 | 
            -
                end
         | 
| 264 | 
            -
              end
         | 
| 265 | 
            -
             | 
| 266 | 
            -
              describe '#detect_runtimes' do
         | 
| 267 | 
            -
                subject { create.determine_runtime(framework) }
         | 
| 268 | 
            -
             | 
| 269 | 
            -
                context 'when runtime is given' do
         | 
| 270 | 
            -
                  let(:inputs) { { :runtime => runtime } }
         | 
| 271 | 
            -
             | 
| 272 | 
            -
                  it 'does not try to get the runtime' do
         | 
| 273 | 
            -
                    any_instance_of(CF::Detector) do |detector|
         | 
| 274 | 
            -
                      dont_allow(detector).detect_runtime
         | 
| 275 | 
            -
                      dont_allow(detector).all_runtimes
         | 
| 276 | 
            -
                    end
         | 
| 277 | 
            -
             | 
| 278 | 
            -
                    dont_allow_ask
         | 
| 279 | 
            -
                    dont_allow(client).runtimes
         | 
| 280 | 
            -
             | 
| 281 | 
            -
                    subject
         | 
| 282 | 
            -
                  end
         | 
| 283 | 
            -
             | 
| 284 | 
            -
                  it { should eq runtime }
         | 
| 285 | 
            -
                end
         | 
| 286 | 
            -
             | 
| 287 | 
            -
                context 'when runtime is not given' do
         | 
| 288 | 
            -
                  context 'and the framework is standalone' do
         | 
| 289 | 
            -
                    let(:framework) { standalone }
         | 
| 290 | 
            -
             | 
| 291 | 
            -
                    it "detects the runtime" do
         | 
| 292 | 
            -
                      any_instance_of(CF::Detector) do |detector|
         | 
| 293 | 
            -
                        mock(detector).detect_runtimes { runtimes }
         | 
| 294 | 
            -
                      end
         | 
| 295 | 
            -
             | 
| 296 | 
            -
                      mock_ask('Runtime', anything) do |_, options|
         | 
| 297 | 
            -
                        expect(options[:choices]).to eq(runtimes.sort_by(&:name) + [:other])
         | 
| 298 | 
            -
                        runtime
         | 
| 299 | 
            -
                      end
         | 
| 300 | 
            -
             | 
| 301 | 
            -
                      subject
         | 
| 302 | 
            -
                    end
         | 
| 303 | 
            -
                  end
         | 
| 304 | 
            -
             | 
| 305 | 
            -
                  context 'and the framework is not standalone' do
         | 
| 306 | 
            -
                    it "gets the runtimes based on the framework" do
         | 
| 307 | 
            -
                      any_instance_of(CF::Detector) do |detector|
         | 
| 308 | 
            -
                        mock(detector).runtimes(framework) { runtimes }
         | 
| 309 | 
            -
                      end
         | 
| 310 | 
            -
             | 
| 311 | 
            -
                      mock_ask('Runtime', anything) do |_, options|
         | 
| 312 | 
            -
                        expect(options[:choices]).to eq(runtimes.sort_by(&:name) + [:other])
         | 
| 313 | 
            -
                        runtime
         | 
| 314 | 
            -
                      end
         | 
| 315 | 
            -
             | 
| 316 | 
            -
                      subject
         | 
| 317 | 
            -
                    end
         | 
| 318 | 
            -
                  end
         | 
| 319 | 
            -
                end
         | 
| 320 | 
            -
              end
         | 
| 321 | 
            -
             | 
| 322 170 | 
             
              describe '#create_app' do
         | 
| 323 171 | 
             
                before { dont_allow_ask }
         | 
| 324 172 |  | 
| @@ -328,8 +176,6 @@ describe CF::App::Create do | |
| 328 176 | 
             
                let(:attributes) do
         | 
| 329 177 | 
             
                  { :name => "some-app",
         | 
| 330 178 | 
             
                    :total_instances => 2,
         | 
| 331 | 
            -
                    :framework => framework,
         | 
| 332 | 
            -
                    :runtime => runtime,
         | 
| 333 179 | 
             
                    :production => false,
         | 
| 334 180 | 
             
                    :memory => 1024,
         | 
| 335 181 | 
             
                    :buildpack => "git://example.com"
         | 
| @@ -81,11 +81,9 @@ describe CF::App::Push do | |
| 81 81 | 
             
                    subject
         | 
| 82 82 | 
             
                  end
         | 
| 83 83 |  | 
| 84 | 
            -
                   | 
| 85 | 
            -
                     | 
| 86 | 
            -
             | 
| 87 | 
            -
                      subject
         | 
| 88 | 
            -
                    end
         | 
| 84 | 
            +
                  it "should not set memory on the app" do
         | 
| 85 | 
            +
                    dont_allow(app).__send__(:memory=)
         | 
| 86 | 
            +
                    subject
         | 
| 89 87 | 
             
                  end
         | 
| 90 88 | 
             
                end
         | 
| 91 89 |  | 
| @@ -133,50 +131,6 @@ describe CF::App::Push do | |
| 133 131 | 
             
                  include_examples 'common tests for inputs', :total_instances, :instances
         | 
| 134 132 | 
             
                end
         | 
| 135 133 |  | 
| 136 | 
            -
                context 'when framework is given' do
         | 
| 137 | 
            -
                  let(:old) { fake(:framework, :name => "Old Framework") }
         | 
| 138 | 
            -
                  let(:new) { fake(:framework, :name => "New Framework") }
         | 
| 139 | 
            -
                  let(:app) { fake(:app, :framework => old) }
         | 
| 140 | 
            -
                  let(:inputs) { { :framework => new } }
         | 
| 141 | 
            -
             | 
| 142 | 
            -
                  it 'updates the app framework' do
         | 
| 143 | 
            -
                    stub(push).line(anything)
         | 
| 144 | 
            -
                    mock(app).update!
         | 
| 145 | 
            -
                    expect { subject }.to change { app.framework }.from(old).to(new)
         | 
| 146 | 
            -
                  end
         | 
| 147 | 
            -
             | 
| 148 | 
            -
                  it 'outputs the changed framework using the name' do
         | 
| 149 | 
            -
                    mock(push).line("Changes:")
         | 
| 150 | 
            -
                    mock(push).line("framework: Old Framework -> New Framework")
         | 
| 151 | 
            -
                    stub(app).update!
         | 
| 152 | 
            -
                    subject
         | 
| 153 | 
            -
                  end
         | 
| 154 | 
            -
             | 
| 155 | 
            -
                  include_examples 'common tests for inputs', :framework
         | 
| 156 | 
            -
                end
         | 
| 157 | 
            -
             | 
| 158 | 
            -
                context 'when runtime is given' do
         | 
| 159 | 
            -
                  let(:old) { fake(:runtime, :name => "Old Runtime") }
         | 
| 160 | 
            -
                  let(:new) { fake(:runtime, :name => "New Runtime") }
         | 
| 161 | 
            -
                  let(:app) { fake(:app, :runtime => old) }
         | 
| 162 | 
            -
                  let(:inputs) { { :runtime => new } }
         | 
| 163 | 
            -
             | 
| 164 | 
            -
                  it 'updates the app runtime' do
         | 
| 165 | 
            -
                    stub(push).line(anything)
         | 
| 166 | 
            -
                    mock(app).update!
         | 
| 167 | 
            -
                    expect { subject }.to change { app.runtime }.from(old).to(new)
         | 
| 168 | 
            -
                  end
         | 
| 169 | 
            -
             | 
| 170 | 
            -
                  it 'outputs the changed runtime using the name' do
         | 
| 171 | 
            -
                    mock(push).line("Changes:")
         | 
| 172 | 
            -
                    mock(push).line("runtime: Old Runtime -> New Runtime")
         | 
| 173 | 
            -
                    stub(app).update!
         | 
| 174 | 
            -
                    subject
         | 
| 175 | 
            -
                  end
         | 
| 176 | 
            -
             | 
| 177 | 
            -
                  include_examples 'common tests for inputs', :runtime
         | 
| 178 | 
            -
                end
         | 
| 179 | 
            -
             | 
| 180 134 | 
             
                context 'when command is given' do
         | 
| 181 135 | 
             
                  let(:old) { "./start" }
         | 
| 182 136 | 
             
                  let(:new) { "./start foo " }
         | 
| @@ -331,15 +285,11 @@ describe CF::App::Push do | |
| 331 285 |  | 
| 332 286 | 
             
              describe '#setup_new_app (integration spec!!)' do
         | 
| 333 287 | 
             
                let(:app) { fake(:app, :guid => nil) }
         | 
| 334 | 
            -
                let(:framework) { fake(:framework) }
         | 
| 335 | 
            -
                let(:runtime) { fake(:runtime) }
         | 
| 336 288 | 
             
                let(:host) { "" }
         | 
| 337 289 | 
             
                let(:domain) { fake(:domain, :name => "example.com") }
         | 
| 338 290 | 
             
                let(:inputs) do
         | 
| 339 291 | 
             
                  { :name => "some-app",
         | 
| 340 292 | 
             
                    :instances => 2,
         | 
| 341 | 
            -
                    :framework => framework,
         | 
| 342 | 
            -
                    :runtime => runtime,
         | 
| 343 293 | 
             
                    :memory => 1024,
         | 
| 344 294 | 
             
                    :host => host,
         | 
| 345 295 | 
             
                    :domain => domain
         | 
| @@ -1,16 +1,11 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe CF::Start::Info do
         | 
| 4 | 
            -
              let(:frameworks) { false }
         | 
| 5 | 
            -
              let(:runtimes) { false }
         | 
| 6 4 | 
             
              let(:services) { false }
         | 
| 7 5 | 
             
              let(:all) { false }
         | 
| 8 6 |  | 
| 9 7 | 
             
              let(:client) do
         | 
| 10 | 
            -
                fake_client : | 
| 11 | 
            -
                  :runtimes => fake_list(:runtime, 3),
         | 
| 12 | 
            -
                  :services => fake_list(:service, 3),
         | 
| 13 | 
            -
                  :token => CFoundry::AuthToken.new("bearer some-access-token")
         | 
| 8 | 
            +
                fake_client :services => fake_list(:service, 3), :token => CFoundry::AuthToken.new("bearer some-access-token")
         | 
| 14 9 | 
             
              end
         | 
| 15 10 |  | 
| 16 11 | 
             
              let(:target_info) do
         | 
| @@ -40,8 +35,6 @@ describe CF::Start::Info do | |
| 40 35 | 
             
                describe 'flags' do
         | 
| 41 36 | 
             
                  subject { command.flags }
         | 
| 42 37 |  | 
| 43 | 
            -
                  its(["-f"]) { should eq :frameworks }
         | 
| 44 | 
            -
                  its(["-r"]) { should eq :runtimes }
         | 
| 45 38 | 
             
                  its(["-s"]) { should eq :services }
         | 
| 46 39 | 
             
                  its(["-a"]) { should eq :all }
         | 
| 47 40 | 
             
                end
         | 
| @@ -53,7 +46,7 @@ describe CF::Start::Info do | |
| 53 46 | 
             
              end
         | 
| 54 47 |  | 
| 55 48 |  | 
| 56 | 
            -
              subject { cf %W[info --#{bool_flag(: | 
| 49 | 
            +
              subject { cf %W[info --#{bool_flag(:services)} --#{bool_flag(:all)} --no-force --no-quiet] }
         | 
| 57 50 |  | 
| 58 51 | 
             
              context 'when given no flags' do
         | 
| 59 52 | 
             
                it "displays target information" do
         | 
| @@ -70,50 +63,6 @@ describe CF::Start::Info do | |
| 70 63 | 
             
                end
         | 
| 71 64 | 
             
              end
         | 
| 72 65 |  | 
| 73 | 
            -
              context 'when given --frameworks' do
         | 
| 74 | 
            -
                let(:frameworks) { true }
         | 
| 75 | 
            -
             | 
| 76 | 
            -
                it 'does not grab /info' do
         | 
| 77 | 
            -
                  dont_allow(client).info
         | 
| 78 | 
            -
                  subject
         | 
| 79 | 
            -
                end
         | 
| 80 | 
            -
             | 
| 81 | 
            -
                it 'lists frameworks on the target' do
         | 
| 82 | 
            -
                  subject
         | 
| 83 | 
            -
             | 
| 84 | 
            -
                  stdout.rewind
         | 
| 85 | 
            -
                  expect(stdout.readline).to match /Getting frameworks.*OK/
         | 
| 86 | 
            -
                  expect(stdout.readline).to eq "\n"
         | 
| 87 | 
            -
                  expect(stdout.readline).to match /framework\s+description/
         | 
| 88 | 
            -
             | 
| 89 | 
            -
                  client.frameworks.sort_by(&:name).each do |f|
         | 
| 90 | 
            -
                    expect(stdout.readline).to match /#{f.name}\s+#{f.description}/
         | 
| 91 | 
            -
                  end
         | 
| 92 | 
            -
                end
         | 
| 93 | 
            -
              end
         | 
| 94 | 
            -
             | 
| 95 | 
            -
              context 'when given --runtimes' do
         | 
| 96 | 
            -
                let(:runtimes) { true }
         | 
| 97 | 
            -
             | 
| 98 | 
            -
                it 'does not grab /info' do
         | 
| 99 | 
            -
                  dont_allow(client).info
         | 
| 100 | 
            -
                  subject
         | 
| 101 | 
            -
                end
         | 
| 102 | 
            -
             | 
| 103 | 
            -
                it 'lists runtimes on the target' do
         | 
| 104 | 
            -
                  subject
         | 
| 105 | 
            -
             | 
| 106 | 
            -
                  stdout.rewind
         | 
| 107 | 
            -
                  expect(stdout.readline).to match /Getting runtimes.*OK/
         | 
| 108 | 
            -
                  expect(stdout.readline).to eq "\n"
         | 
| 109 | 
            -
                  expect(stdout.readline).to match /runtime\s+description/
         | 
| 110 | 
            -
             | 
| 111 | 
            -
                  client.runtimes.sort_by(&:name).each do |r|
         | 
| 112 | 
            -
                    expect(stdout.readline).to match /#{r.name}\s+#{r.description}/
         | 
| 113 | 
            -
                  end
         | 
| 114 | 
            -
                end
         | 
| 115 | 
            -
              end
         | 
| 116 | 
            -
             | 
| 117 66 | 
             
              context 'when given --services' do
         | 
| 118 67 | 
             
                let(:services) { true }
         | 
| 119 68 |  | 
| @@ -139,14 +88,12 @@ describe CF::Start::Info do | |
| 139 88 | 
             
              context 'when given --all' do
         | 
| 140 89 | 
             
                let(:all) { true }
         | 
| 141 90 |  | 
| 142 | 
            -
                it ' | 
| 91 | 
            +
                it 'runs as --services' do
         | 
| 143 92 | 
             
                  mock(client).info { target_info }
         | 
| 144 93 |  | 
| 145 94 | 
             
                  subject
         | 
| 146 95 |  | 
| 147 96 | 
             
                  stdout.rewind
         | 
| 148 | 
            -
                  expect(stdout.readline).to match /Getting runtimes.*OK/
         | 
| 149 | 
            -
                  expect(stdout.readline).to match /Getting frameworks.*OK/
         | 
| 150 97 | 
             
                  expect(stdout.readline).to match /Getting services.*OK/
         | 
| 151 98 | 
             
                end
         | 
| 152 99 | 
             
              end
         | 
| @@ -49,9 +49,7 @@ command CF::Start::Target do | |
| 49 49 | 
             
                  let(:user) { stub! }
         | 
| 50 50 | 
             
                  let(:organization) { organizations.first }
         | 
| 51 51 | 
             
                  let(:client) do
         | 
| 52 | 
            -
                    fake_client : | 
| 53 | 
            -
                      :organizations => organizations,
         | 
| 54 | 
            -
                      :token => CFoundry::AuthToken.new("bearer some-access-token")
         | 
| 52 | 
            +
                    fake_client :organizations => organizations, :token => CFoundry::AuthToken.new("bearer some-access-token")
         | 
| 55 53 | 
             
                  end
         | 
| 56 54 |  | 
| 57 55 | 
             
                  before do
         | 
    
        data/spec/cf/detect_spec.rb
    CHANGED
    
    | @@ -31,24 +31,4 @@ describe CF::Detector do | |
| 31 31 | 
             
                  end
         | 
| 32 32 | 
             
                end
         | 
| 33 33 | 
             
              end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
              describe '#detect_runtime' do
         | 
| 36 | 
            -
             | 
| 37 | 
            -
              end
         | 
| 38 | 
            -
             | 
| 39 | 
            -
              describe '#runtimes' do
         | 
| 40 | 
            -
             | 
| 41 | 
            -
              end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
              describe '#suggested_memory' do
         | 
| 44 | 
            -
             | 
| 45 | 
            -
              end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
              describe '#all_runtimes' do
         | 
| 48 | 
            -
             | 
| 49 | 
            -
              end
         | 
| 50 | 
            -
             | 
| 51 | 
            -
              describe '#all_frameworks' do
         | 
| 52 | 
            -
             | 
| 53 | 
            -
              end
         | 
| 54 34 | 
             
            end
         | 
| @@ -97,13 +97,13 @@ if ENV['CF_V2_TEST_USER'] && ENV['CF_V2_TEST_PASSWORD'] && ENV['CF_V2_TEST_TARGE | |
| 97 97 | 
             
                        runner.send_keys ""
         | 
| 98 98 | 
             
                      end
         | 
| 99 99 |  | 
| 100 | 
            -
                      expect(runner).to say "Save configuration?> n"
         | 
| 100 | 
            +
                      expect(runner).to say "Save configuration?> n", 10
         | 
| 101 101 | 
             
                      runner.send_keys ""
         | 
| 102 102 |  | 
| 103 | 
            -
                      expect(runner).to say "Uploading #{app}... OK"
         | 
| 104 | 
            -
                      expect(runner).to say "Starting #{app}... OK"
         | 
| 103 | 
            +
                      expect(runner).to say "Uploading #{app}... OK", 10
         | 
| 104 | 
            +
                      expect(runner).to say "Starting #{app}... OK", 10
         | 
| 105 105 |  | 
| 106 | 
            -
                      expect(runner).to say /(Using|Installing) Ruby/i,  | 
| 106 | 
            +
                      expect(runner).to say /(Using|Installing) Ruby/i, 60
         | 
| 107 107 | 
             
                      expect(runner).to say "Your bundle is complete!", 30
         | 
| 108 108 |  | 
| 109 109 | 
             
                      expect(runner).to say "Checking #{app}..."
         | 
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: cf
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash: - | 
| 4 | 
            +
              hash: -4129708240
         | 
| 5 5 | 
             
              prerelease: 6
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 6
         | 
| 9 9 | 
             
              - 0
         | 
| 10 10 | 
             
              - rc
         | 
| 11 | 
            -
              -  | 
| 12 | 
            -
              version: 0.6.0. | 
| 11 | 
            +
              - 4
         | 
| 12 | 
            +
              version: 0.6.0.rc4
         | 
| 13 13 | 
             
            platform: ruby
         | 
| 14 14 | 
             
            authors: 
         | 
| 15 15 | 
             
            - Cloud Foundry Team
         | 
| @@ -18,7 +18,7 @@ autorequire: | |
| 18 18 | 
             
            bindir: bin
         | 
| 19 19 | 
             
            cert_chain: []
         | 
| 20 20 |  | 
| 21 | 
            -
            date: 2013-03- | 
| 21 | 
            +
            date: 2013-03-21 00:00:00 Z
         | 
| 22 22 | 
             
            dependencies: 
         | 
| 23 23 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 24 24 | 
             
              name: json_pure
         | 
| @@ -73,14 +73,14 @@ dependencies: | |
| 73 73 | 
             
                requirements: 
         | 
| 74 74 | 
             
                - - ">="
         | 
| 75 75 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 76 | 
            -
                    hash: - | 
| 76 | 
            +
                    hash: -4129708240
         | 
| 77 77 | 
             
                    segments: 
         | 
| 78 78 | 
             
                    - 0
         | 
| 79 79 | 
             
                    - 6
         | 
| 80 80 | 
             
                    - 0
         | 
| 81 81 | 
             
                    - rc
         | 
| 82 | 
            -
                    -  | 
| 83 | 
            -
                    version: 0.6.0. | 
| 82 | 
            +
                    - 4
         | 
| 83 | 
            +
                    version: 0.6.0.rc4
         | 
| 84 84 | 
             
                - - <
         | 
| 85 85 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 86 86 | 
             
                    hash: 5
         | 
| @@ -136,7 +136,7 @@ dependencies: | |
| 136 136 | 
             
                requirements: 
         | 
| 137 137 | 
             
                - - ">="
         | 
| 138 138 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 139 | 
            -
                    hash: - | 
| 139 | 
            +
                    hash: -4129708244
         | 
| 140 140 | 
             
                    segments: 
         | 
| 141 141 | 
             
                    - 0
         | 
| 142 142 | 
             
                    - 7
         | 
| @@ -161,7 +161,7 @@ dependencies: | |
| 161 161 | 
             
                requirements: 
         | 
| 162 162 | 
             
                - - ">="
         | 
| 163 163 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 164 | 
            -
                    hash: - | 
| 164 | 
            +
                    hash: -4129708180
         | 
| 165 165 | 
             
                    segments: 
         | 
| 166 166 | 
             
                    - 0
         | 
| 167 167 | 
             
                    - 3
         |