cf_script 0.0.1.beta.1 → 0.0.1
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 +4 -4
 - data/.travis.yml +18 -0
 - data/README.md +182 -34
 - data/Rakefile +0 -13
 - data/lib/cf_script/command/base.rb +1 -1
 - data/lib/cf_script/command/cf/apps/app.rb +1 -1
 - data/lib/cf_script/command/cf/apps/apps.rb +5 -3
 - data/lib/cf_script/command/cf/apps/delete.rb +25 -0
 - data/lib/cf_script/command/cf/apps/env.rb +4 -2
 - data/lib/cf_script/command/cf/apps/push.rb +7 -2
 - data/lib/cf_script/command/cf/apps/rename.rb +20 -0
 - data/lib/cf_script/command/cf/apps/restage.rb +1 -1
 - data/lib/cf_script/command/cf/apps/restart.rb +1 -1
 - data/lib/cf_script/command/cf/apps/set_env.rb +1 -1
 - data/lib/cf_script/command/cf/apps/start.rb +1 -1
 - data/lib/cf_script/command/cf/apps/stop.rb +3 -2
 - data/lib/cf_script/command/cf/apps/unset_env.rb +1 -1
 - data/lib/cf_script/command/cf/apps.rb +5 -1
 - data/lib/cf_script/command/cf/general/api.rb +1 -1
 - data/lib/cf_script/command/cf/general/auth.rb +1 -1
 - data/lib/cf_script/command/cf/general/login.rb +1 -1
 - data/lib/cf_script/command/cf/general/logout.rb +1 -1
 - data/lib/cf_script/command/cf/general/target.rb +1 -1
 - data/lib/cf_script/command/cf/routes/check_route.rb +1 -1
 - data/lib/cf_script/command/cf/routes/create_route.rb +1 -1
 - data/lib/cf_script/command/cf/routes/delete_route.rb +5 -2
 - data/lib/cf_script/command/cf/routes/map_route.rb +1 -1
 - data/lib/cf_script/command/cf/routes/routes.rb +1 -1
 - data/lib/cf_script/command/cf/routes/unmap_route.rb +1 -1
 - data/lib/cf_script/command/cf/spaces/space.rb +1 -1
 - data/lib/cf_script/command/cf/spaces/spaces.rb +1 -1
 - data/lib/cf_script/command/runner.rb +1 -15
 - data/lib/cf_script/config.rb +3 -1
 - data/lib/cf_script/executor/recorder.rb +3 -1
 - data/lib/cf_script/executor/simple.rb +22 -9
 - data/lib/cf_script/executor.rb +0 -1
 - data/lib/cf_script/object/api_endpoint.rb +1 -1
 - data/lib/cf_script/object/app_info.rb +1 -1
 - data/lib/cf_script/object/app_list.rb +21 -5
 - data/lib/cf_script/object/attribute.rb +1 -1
 - data/lib/cf_script/object/attribute_list.rb +1 -1
 - data/lib/cf_script/object/instance_status.rb +1 -1
 - data/lib/cf_script/object/route_info.rb +1 -1
 - data/lib/cf_script/object/space.rb +1 -1
 - data/lib/cf_script/object/target.rb +1 -1
 - data/lib/cf_script/object.rb +0 -11
 - data/lib/cf_script/output/buffer.rb +1 -1
 - data/lib/cf_script/scope/app/routes.rb +1 -1
 - data/lib/cf_script/scope/app.rb +0 -26
 - data/lib/cf_script/scope/target.rb +7 -1
 - data/lib/cf_script/ui.rb +2 -6
 - data/lib/cf_script/version.rb +1 -1
 - data/lib/cf_script.rb +0 -2
 - data/test/fixtures/commands/apps/delete/good.yml +8 -0
 - data/test/fixtures/commands/apps/delete/not_exist.yml +9 -0
 - data/test/fixtures/commands/apps/env/{empty.yml → empty_vars.yml} +0 -0
 - data/test/fixtures/commands/apps/rename/good.yml +8 -0
 - data/test/fixtures/commands/apps/rename/not_found.yml +8 -0
 - data/test/fixtures/commands/{apps/set_env → common}/empty.yml +0 -0
 - data/test/lib/cf_script/command/cf/apps/app_test.rb +8 -0
 - data/test/lib/cf_script/command/cf/apps/apps_test.rb +12 -3
 - data/test/lib/cf_script/command/cf/apps/delete_test.rb +51 -0
 - data/test/lib/cf_script/command/cf/apps/env_test.rb +12 -2
 - data/test/lib/cf_script/command/cf/apps/push_test.rb +14 -0
 - data/test/lib/cf_script/command/cf/apps/rename_test.rb +35 -0
 - data/test/lib/cf_script/command/cf/apps/restage_test.rb +8 -0
 - data/test/lib/cf_script/command/cf/apps/restart_test.rb +8 -0
 - data/test/lib/cf_script/command/cf/apps/start_test.rb +8 -0
 - data/test/lib/cf_script/command/cf/apps/stop_test.rb +2 -2
 - data/test/lib/cf_script/command/cf/general/login_test.rb +9 -10
 - data/test/lib/cf_script/command/cf/routes/create_route_test.rb +12 -0
 - data/test/lib/cf_script/command/cf/routes/delete_route_test.rb +18 -0
 - data/test/lib/cf_script/command/cf/routes/map_route_test.rb +12 -0
 - data/test/lib/cf_script/command/cf/routes/routes_test.rb +8 -0
 - data/test/lib/cf_script/command/cf/routes/unmap_route_test.rb +12 -0
 - data/test/lib/cf_script/object/app_info_test.rb +4 -4
 - data/test/lib/cf_script/object/app_list_test.rb +68 -2
 - data/test/lib/cf_script/output/buffer_test.rb +9 -9
 - data/test/lib/cf_script/output/parser/section_test.rb +4 -2
 - data/test/lib/cf_script/output/tests_test.rb +24 -24
 - data/test/lib/cf_script/output_test.rb +23 -18
 - data/test/lib/cf_script/scope/app/env_test.rb +58 -0
 - data/test/lib/cf_script/scope/app/routes_test.rb +56 -0
 - data/test/lib/cf_script/scope/app/state_test.rb +30 -0
 - data/test/lib/cf_script/scope/script_test.rb +3 -2
 - data/test/lib/cf_script/scope/target_test.rb +38 -23
 - data/test/lib/cf_script/scope_test.rb +10 -6
 - data/test/lib/cf_script/ui_test.rb +133 -0
 - data/test/lib/cf_script_test.rb +14 -8
 - data/test/support/assertions.rb +25 -0
 - data/test/support/helpers/fixture_executor.rb +1 -1
 - data/test/support/helpers/mock_execution.rb +29 -7
 - metadata +23 -14
 - data/lib/cf_script/callbacks.rb +0 -43
 - data/lib/cf_script/executor/non_blocking.rb +0 -107
 - data/lib/cf_script/object/app_spec.rb +0 -55
 - data/test/fixtures/commands/apps/unset_env/empty.yml +0 -5
 - data/test/fixtures/commands/general/auth/empty.yml +0 -5
 - data/test/fixtures/commands/general/target/empty.yml +0 -5
 - data/test/fixtures/commands/spaces/space/empty.yml +0 -5
 - data/test/fixtures/commands/spaces/spaces/empty.yml +0 -5
 
| 
         @@ -17,8 +17,8 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       17 
17 
     | 
    
         
             
                initial_target = subject.instance_variable_get('@initial_target')
         
     | 
| 
       18 
18 
     | 
    
         
             
                current_target = subject.instance_variable_get('@current_target')
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                assert initial_target
         
     | 
| 
       21 
     | 
    
         
            -
                assert current_target
         
     | 
| 
      
 20 
     | 
    
         
            +
                assert initial_target, "Expected @initial_target to be set"
         
     | 
| 
      
 21 
     | 
    
         
            +
                assert current_target, "Expected @current_target to be set"
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                assert_instance_of CfScript::Target, initial_target
         
     | 
| 
       24 
24 
     | 
    
         
             
                assert_instance_of CfScript::Target, current_target
         
     | 
| 
         @@ -36,6 +36,7 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       36 
36 
     | 
    
         
             
                  assert_equal 'ACME',    subject.current_org
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                  subject.target(:production)
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
       39 
40 
     | 
    
         
             
                  assert_equal 'production', subject.current_space
         
     | 
| 
       40 
41 
     | 
    
         
             
                  assert_equal 'ACME',       subject.current_org
         
     | 
| 
       41 
42 
     | 
    
         
             
                end
         
     | 
| 
         @@ -44,10 +45,12 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       44 
45 
     | 
    
         
             
              it "resets target to initial_target if the space has changed" do
         
     | 
| 
       45 
46 
     | 
    
         
             
                fake_cf target: :production do
         
     | 
| 
       46 
47 
     | 
    
         
             
                  subject.target(:production)
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
       47 
49 
     | 
    
         
             
                  assert_equal 'production', subject.current_space
         
     | 
| 
       48 
50 
     | 
    
         
             
                  assert_equal 'ACME',       subject.current_org
         
     | 
| 
       49 
51 
     | 
    
         | 
| 
       50 
52 
     | 
    
         
             
                  subject.finalize
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
       51 
54 
     | 
    
         
             
                  assert_equal 'staging', subject.current_space
         
     | 
| 
       52 
55 
     | 
    
         
             
                  assert_equal 'ACME',    subject.current_org
         
     | 
| 
       53 
56 
     | 
    
         
             
                end
         
     | 
| 
         @@ -56,17 +59,20 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       56 
59 
     | 
    
         
             
              it "resets target to initial_target if the org has changed" do
         
     | 
| 
       57 
60 
     | 
    
         
             
                fake_cf do
         
     | 
| 
       58 
61 
     | 
    
         
             
                  subject.target(:staging_org)
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
       59 
63 
     | 
    
         
             
                  assert_equal 'staging', subject.current_space
         
     | 
| 
       60 
64 
     | 
    
         
             
                  assert_equal 'ORG',     subject.current_org
         
     | 
| 
       61 
65 
     | 
    
         | 
| 
       62 
66 
     | 
    
         
             
                  subject.finalize
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
       63 
68 
     | 
    
         
             
                  assert_equal 'staging', subject.current_space
         
     | 
| 
       64 
69 
     | 
    
         
             
                  assert_equal 'ACME',    subject.current_org
         
     | 
| 
       65 
70 
     | 
    
         
             
                end
         
     | 
| 
       66 
71 
     | 
    
         
             
              end
         
     | 
| 
       67 
72 
     | 
    
         | 
| 
       68 
73 
     | 
    
         
             
              it "responds to target without args and calls Command.run" do
         
     | 
| 
       69 
     | 
    
         
            -
                assert subject.respond_to?(:target)
         
     | 
| 
      
 74 
     | 
    
         
            +
                assert subject.respond_to?(:target),
         
     | 
| 
      
 75 
     | 
    
         
            +
                  "Expected Scope::Target to respond to target"
         
     | 
| 
       70 
76 
     | 
    
         | 
| 
       71 
77 
     | 
    
         
             
                CfScript::Command.stub :run, :called do
         
     | 
| 
       72 
78 
     | 
    
         
             
                  assert_equal :called, subject.target
         
     | 
| 
         @@ -74,8 +80,6 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       74 
80 
     | 
    
         
             
              end
         
     | 
| 
       75 
81 
     | 
    
         | 
| 
       76 
82 
     | 
    
         
             
              it "responds to target with a space name and calls Command.run if not == current" do
         
     | 
| 
       77 
     | 
    
         
            -
                assert subject.respond_to?(:target)
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
83 
     | 
    
         
             
                assert_equal 'staging', subject.current_space
         
     | 
| 
       80 
84 
     | 
    
         | 
| 
       81 
85 
     | 
    
         
             
                CfScript::Command.stub :run, :called do
         
     | 
| 
         @@ -92,7 +96,8 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       92 
96 
     | 
    
         
             
              end
         
     | 
| 
       93 
97 
     | 
    
         | 
| 
       94 
98 
     | 
    
         
             
              it "responds to space and calls Command.run" do
         
     | 
| 
       95 
     | 
    
         
            -
                assert subject.respond_to?(:space)
         
     | 
| 
      
 99 
     | 
    
         
            +
                assert subject.respond_to?(:space),
         
     | 
| 
      
 100 
     | 
    
         
            +
                  "Expected Scope::Target to respond to space"
         
     | 
| 
       96 
101 
     | 
    
         | 
| 
       97 
102 
     | 
    
         
             
                CfScript::Command.stub :run, :called do
         
     | 
| 
       98 
103 
     | 
    
         
             
                  assert_equal :called, subject.space(:foo)
         
     | 
| 
         @@ -100,8 +105,6 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       100 
105 
     | 
    
         
             
              end
         
     | 
| 
       101 
106 
     | 
    
         | 
| 
       102 
107 
     | 
    
         
             
              it "responds to space with a block and calls exec_in with a Space scope" do
         
     | 
| 
       103 
     | 
    
         
            -
                assert subject.respond_to?(:space)
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
108 
     | 
    
         
             
                arg_catcher = lambda do |scope, args, &block|
         
     | 
| 
       106 
109 
     | 
    
         
             
                  assert_instance_of CfScript::Scope::Space, scope
         
     | 
| 
       107 
110 
     | 
    
         
             
                end
         
     | 
| 
         @@ -114,7 +117,8 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       114 
117 
     | 
    
         
             
              end
         
     | 
| 
       115 
118 
     | 
    
         | 
| 
       116 
119 
     | 
    
         
             
              it "responds to app and calls Command.run" do
         
     | 
| 
       117 
     | 
    
         
            -
                assert subject.respond_to?(:app)
         
     | 
| 
      
 120 
     | 
    
         
            +
                assert subject.respond_to?(:app),
         
     | 
| 
      
 121 
     | 
    
         
            +
                  "Expected Scope::Target to respond to app"
         
     | 
| 
       118 
122 
     | 
    
         | 
| 
       119 
123 
     | 
    
         
             
                CfScript::Command.stub :run, :called do
         
     | 
| 
       120 
124 
     | 
    
         
             
                  assert_equal :called, subject.app(:foo)
         
     | 
| 
         @@ -122,8 +126,6 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       122 
126 
     | 
    
         
             
              end
         
     | 
| 
       123 
127 
     | 
    
         | 
| 
       124 
128 
     | 
    
         
             
              it "responds to app with a block and calls exec_in with an App scope" do
         
     | 
| 
       125 
     | 
    
         
            -
                assert subject.respond_to?(:app)
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
129 
     | 
    
         
             
                arg_catcher = lambda do |scope, args, &block|
         
     | 
| 
       128 
130 
     | 
    
         
             
                  assert_instance_of CfScript::Scope::App, scope
         
     | 
| 
       129 
131 
     | 
    
         
             
                end
         
     | 
| 
         @@ -135,24 +137,37 @@ describe CfScript::Scope::Target do 
     | 
|
| 
       135 
137 
     | 
    
         
             
                end
         
     | 
| 
       136 
138 
     | 
    
         
             
              end
         
     | 
| 
       137 
139 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
               
     | 
| 
       139 
     | 
    
         
            -
                 
     | 
| 
      
 140 
     | 
    
         
            +
              describe 'apps' do
         
     | 
| 
      
 141 
     | 
    
         
            +
                it "calls Command.run" do
         
     | 
| 
      
 142 
     | 
    
         
            +
                  assert subject.respond_to?(:apps),
         
     | 
| 
      
 143 
     | 
    
         
            +
                    "Expected Scope::Target to respond to apps"
         
     | 
| 
       140 
144 
     | 
    
         | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
      
 145 
     | 
    
         
            +
                  CfScript::Command.stub :run, :called do
         
     | 
| 
      
 146 
     | 
    
         
            +
                    assert_equal :called, subject.apps
         
     | 
| 
      
 147 
     | 
    
         
            +
                  end
         
     | 
| 
       143 
148 
     | 
    
         
             
                end
         
     | 
| 
       144 
     | 
    
         
            -
              end
         
     | 
| 
       145 
149 
     | 
    
         | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
      
 150 
     | 
    
         
            +
                it "calls apps.select! when options are given" do
         
     | 
| 
      
 151 
     | 
    
         
            +
                  apps = MiniTest::Mock.new
         
     | 
| 
      
 152 
     | 
    
         
            +
                  apps.expect(:org, nil, [])
         
     | 
| 
      
 153 
     | 
    
         
            +
                  apps.expect(:org, nil, [])
         
     | 
| 
      
 154 
     | 
    
         
            +
                  apps.expect(:space, nil, [])
         
     | 
| 
      
 155 
     | 
    
         
            +
                  apps.expect(:space, nil, [])
         
     | 
| 
      
 156 
     | 
    
         
            +
                  apps.expect(:select!, nil, [{ ending_with: :foo }])
         
     | 
| 
       148 
157 
     | 
    
         | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
      
 158 
     | 
    
         
            +
                  CfScript::Command.stub :run, apps do
         
     | 
| 
      
 159 
     | 
    
         
            +
                    subject.apps(ending_with: :foo)
         
     | 
| 
      
 160 
     | 
    
         
            +
                  end
         
     | 
| 
       151 
161 
     | 
    
         | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
                  subject.apps(ending_with: :foo)
         
     | 
| 
      
 162 
     | 
    
         
            +
                  apps.verify
         
     | 
| 
       154 
163 
     | 
    
         
             
                end
         
     | 
| 
       155 
164 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
                 
     | 
| 
      
 165 
     | 
    
         
            +
                it "executes given block within each app's scope" do
         
     | 
| 
      
 166 
     | 
    
         
            +
                  fake_cf do
         
     | 
| 
      
 167 
     | 
    
         
            +
                    subject.apps do
         
     | 
| 
      
 168 
     | 
    
         
            +
                      assert_instance_of CfScript::Scope::App, self
         
     | 
| 
      
 169 
     | 
    
         
            +
                    end
         
     | 
| 
      
 170 
     | 
    
         
            +
                  end
         
     | 
| 
      
 171 
     | 
    
         
            +
                end
         
     | 
| 
       157 
172 
     | 
    
         
             
              end
         
     | 
| 
       158 
173 
     | 
    
         
             
            end
         
     | 
| 
         @@ -12,11 +12,13 @@ describe CfScript::Scope do 
     | 
|
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              it "calls enter_scope on initialize" do
         
     | 
| 
       15 
     | 
    
         
            -
                assert ScopeTest.new.called_enter_scope
         
     | 
| 
      
 15 
     | 
    
         
            +
                assert ScopeTest.new.called_enter_scope,
         
     | 
| 
      
 16 
     | 
    
         
            +
                  "Expected enter_scope to have been called"
         
     | 
| 
       16 
17 
     | 
    
         
             
              end
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
              it "responds to finalize which calls exit_scope" do
         
     | 
| 
       19 
     | 
    
         
            -
                assert subject.respond_to?(:finalize)
         
     | 
| 
      
 20 
     | 
    
         
            +
                assert subject.respond_to?(:finalize),
         
     | 
| 
      
 21 
     | 
    
         
            +
                  "Expected Scope::Base to respond to finalize"
         
     | 
| 
       20 
22 
     | 
    
         | 
| 
       21 
23 
     | 
    
         
             
                subject.stub :exit_scope, 'foo' do
         
     | 
| 
       22 
24 
     | 
    
         
             
                  assert_equal 'foo', subject.finalize
         
     | 
| 
         @@ -24,15 +26,17 @@ describe CfScript::Scope do 
     | 
|
| 
       24 
26 
     | 
    
         
             
              end
         
     | 
| 
       25 
27 
     | 
    
         | 
| 
       26 
28 
     | 
    
         
             
              it "responds to spec_for and calls CfScript.spec_for" do
         
     | 
| 
       27 
     | 
    
         
            -
                assert subject.respond_to?(:spec_for)
         
     | 
| 
      
 29 
     | 
    
         
            +
                assert subject.respond_to?(:spec_for),
         
     | 
| 
      
 30 
     | 
    
         
            +
                  "Expected Scope::Base to respond to spec_for"
         
     | 
| 
       28 
31 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                CfScript.stub :spec_for,  
     | 
| 
       30 
     | 
    
         
            -
                  assert_equal  
     | 
| 
      
 32 
     | 
    
         
            +
                CfScript.stub :spec_for, :called do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  assert_equal :called, subject.spec_for(:app)
         
     | 
| 
       31 
34 
     | 
    
         
             
                end
         
     | 
| 
       32 
35 
     | 
    
         
             
              end
         
     | 
| 
       33 
36 
     | 
    
         | 
| 
       34 
37 
     | 
    
         
             
              it "responds to method_missing and calls Command.run" do
         
     | 
| 
       35 
     | 
    
         
            -
                assert subject.respond_to?(:method_missing)
         
     | 
| 
      
 38 
     | 
    
         
            +
                assert subject.respond_to?(:method_missing),
         
     | 
| 
      
 39 
     | 
    
         
            +
                  "Expected Scope::Base to respond to method_missing"
         
     | 
| 
       36 
40 
     | 
    
         | 
| 
       37 
41 
     | 
    
         
             
                CfScript::Command.stub :run, 'pong' do
         
     | 
| 
       38 
42 
     | 
    
         
             
                  assert_equal 'pong', subject.ping
         
     | 
| 
         @@ -0,0 +1,133 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'test_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe CfScript::UI do
         
     | 
| 
      
 4 
     | 
    
         
            +
              include MockExecution
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              subject { CfScript::UI }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              it "defines a puts_out method that outputs to the configured stdout" do
         
     | 
| 
      
 9 
     | 
    
         
            +
                fake_io do |out, err|
         
     | 
| 
      
 10 
     | 
    
         
            +
                  subject.puts_out 'foo bar'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  assert_equal "foo bar\n", out.lines.first
         
     | 
| 
      
 13 
     | 
    
         
            +
                  assert_equal true, err.lines.empty?
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              it "defines a print_out method that outputs to the configured stdout" do
         
     | 
| 
      
 18 
     | 
    
         
            +
                fake_io do |out, err|
         
     | 
| 
      
 19 
     | 
    
         
            +
                  subject.print_out 'foo bar'
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  assert_equal "foo bar", out.lines.first
         
     | 
| 
      
 22 
     | 
    
         
            +
                  assert_equal true, err.lines.empty?
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              it "defines a puts_err method that outputs to the configured stderr" do
         
     | 
| 
      
 27 
     | 
    
         
            +
                fake_io do |out, err|
         
     | 
| 
      
 28 
     | 
    
         
            +
                  subject.puts_err 'foo bar'
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  assert_equal true, out.lines.empty?
         
     | 
| 
      
 31 
     | 
    
         
            +
                  assert_equal "foo bar\n", err.lines.first
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              it "defines a print_err method that outputs to the configured stderr" do
         
     | 
| 
      
 36 
     | 
    
         
            +
                fake_io do |out, err|
         
     | 
| 
      
 37 
     | 
    
         
            +
                  subject.print_err 'foo bar'
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  assert_equal true, out.lines.empty?
         
     | 
| 
      
 40 
     | 
    
         
            +
                  assert_equal "foo bar", err.lines.first
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              describe "with_color_of" do
         
     | 
| 
      
 45 
     | 
    
         
            +
                it "returns default color by default" do
         
     | 
| 
      
 46 
     | 
    
         
            +
                  color = subject.with_color_of
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                  assert_equal({ color: :default }, color)
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                it "returns color for given type" do
         
     | 
| 
      
 52 
     | 
    
         
            +
                  color = subject.with_color_of(:error)
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                  assert_equal({ color: :red }, color)
         
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              describe "tag_char" do
         
     | 
| 
      
 59 
     | 
    
         
            +
                it "returns default character for unknown type" do
         
     | 
| 
      
 60 
     | 
    
         
            +
                  char = subject.tag_char(:bogus, :first)
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                  assert_equal '[', char
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                it "returns character for given type" do
         
     | 
| 
      
 66 
     | 
    
         
            +
                  char = subject.tag_char(:error, :last)
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  assert_equal '}', char
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
              end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
              describe "tag_open/tag_close" do
         
     | 
| 
      
 73 
     | 
    
         
            +
                it "return first and last characters for type" do
         
     | 
| 
      
 74 
     | 
    
         
            +
                  open_char  = subject.tag_open(:other)
         
     | 
| 
      
 75 
     | 
    
         
            +
                  close_char = subject.tag_close(:other)
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                  assert_equal '[', open_char
         
     | 
| 
      
 78 
     | 
    
         
            +
                  assert_equal ']', close_char
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
              end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
              describe "emoji_for" do
         
     | 
| 
      
 83 
     | 
    
         
            +
                it "returns nil if config.ui.emoji is false" do
         
     | 
| 
      
 84 
     | 
    
         
            +
                  with_config do
         
     | 
| 
      
 85 
     | 
    
         
            +
                    emoji = subject.emoji_for(:success)
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                    assert_equal nil, emoji
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                it "returns emoji character if config.ui.emoji is true" do
         
     | 
| 
      
 92 
     | 
    
         
            +
                  with_config emoji: true do
         
     | 
| 
      
 93 
     | 
    
         
            +
                    emoji = subject.emoji_for(:success)
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                    assert_equal [9989, 32], emoji.codepoints
         
     | 
| 
      
 96 
     | 
    
         
            +
                  end
         
     | 
| 
      
 97 
     | 
    
         
            +
                end
         
     | 
| 
      
 98 
     | 
    
         
            +
              end
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
              describe "tag_format" do
         
     | 
| 
      
 101 
     | 
    
         
            +
                it "returns nil if config.ui.tags is false" do
         
     | 
| 
      
 102 
     | 
    
         
            +
                  with_config tags: false do
         
     | 
| 
      
 103 
     | 
    
         
            +
                    tag = subject.tag_format('foo', :trace)
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                    assert_equal nil, tag
         
     | 
| 
      
 106 
     | 
    
         
            +
                  end
         
     | 
| 
      
 107 
     | 
    
         
            +
                end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                it "returns nil if the tag is nil" do
         
     | 
| 
      
 110 
     | 
    
         
            +
                  with_config tags: true do
         
     | 
| 
      
 111 
     | 
    
         
            +
                    tag = subject.tag_format(nil, :trace)
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                    assert_equal nil, tag
         
     | 
| 
      
 114 
     | 
    
         
            +
                  end
         
     | 
| 
      
 115 
     | 
    
         
            +
                end
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                it "returns formatted tag if tag is given and config.ui.tags is true" do
         
     | 
| 
      
 118 
     | 
    
         
            +
                  with_config tags: true, color: true do
         
     | 
| 
      
 119 
     | 
    
         
            +
                    tag = subject.tag_format('foo', :trace)
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
                    assert_equal "\e[0;90;49m<foo>\e[0m", tag
         
     | 
| 
      
 122 
     | 
    
         
            +
                  end
         
     | 
| 
      
 123 
     | 
    
         
            +
                end
         
     | 
| 
      
 124 
     | 
    
         
            +
              end
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
              describe "ui_format" do
         
     | 
| 
      
 127 
     | 
    
         
            +
                it "returns a formatted message" do
         
     | 
| 
      
 128 
     | 
    
         
            +
                  text = subject.ui_format(:success, 'foo', 'bar')
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
                  assert_equal "\e[0;32;49m[foo]\e[0m \e[0;32;49mbar\e[0m", text
         
     | 
| 
      
 131 
     | 
    
         
            +
                end
         
     | 
| 
      
 132 
     | 
    
         
            +
              end
         
     | 
| 
      
 133 
     | 
    
         
            +
            end
         
     | 
    
        data/test/lib/cf_script_test.rb
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ describe CfScript do 
     | 
|
| 
       4 
4 
     | 
    
         
             
              include MockExecution
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              it "defines a config method that returns the Config object" do
         
     | 
| 
       7 
     | 
    
         
            -
                assert CfScript.respond_to? :config
         
     | 
| 
      
 7 
     | 
    
         
            +
                assert CfScript.respond_to? :config, "Expected CfScript to respond to config"
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                config = CfScript.config
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
         @@ -13,7 +13,7 @@ describe CfScript do 
     | 
|
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              it "defines a configure method that yields the Config object" do
         
     | 
| 
       16 
     | 
    
         
            -
                assert CfScript.respond_to? :configure
         
     | 
| 
      
 16 
     | 
    
         
            +
                assert CfScript.respond_to? :configure, "Expected CfScript to respond to configure"
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                called = false
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
         @@ -28,10 +28,10 @@ describe CfScript do 
     | 
|
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              it "defines stdout/stderr methods that return the configured IO objects" do
         
     | 
| 
       31 
     | 
    
         
            -
                assert CfScript.respond_to? :stdout
         
     | 
| 
      
 31 
     | 
    
         
            +
                assert CfScript.respond_to? :stdout, "Expected CfScript to respond to stdout"
         
     | 
| 
       32 
32 
     | 
    
         
             
                assert_same CfScript.config.io.stdout, CfScript.stdout
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
                assert CfScript.respond_to? :stderr
         
     | 
| 
      
 34 
     | 
    
         
            +
                assert CfScript.respond_to? :stderr, "Expected CfScript to respond to stderr"
         
     | 
| 
       35 
35 
     | 
    
         
             
                assert_same CfScript.config.io.stderr, CfScript.stderr
         
     | 
| 
       36 
36 
     | 
    
         
             
              end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
         @@ -64,10 +64,16 @@ describe CfScript do 
     | 
|
| 
       64 
64 
     | 
    
         
             
              end
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
              it "doesn't expose private methods" do
         
     | 
| 
       67 
     | 
    
         
            -
                refute CfScript.respond_to?(:stack_level)
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
      
 67 
     | 
    
         
            +
                refute CfScript.respond_to?(:stack_level),
         
     | 
| 
      
 68 
     | 
    
         
            +
                  "Expected CfScript not to respond to stack_level"
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
                 
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 70 
     | 
    
         
            +
                assert CfScript.singleton_class.private_method_defined?(:stack_level),
         
     | 
| 
      
 71 
     | 
    
         
            +
                  "Expected CfScript singleton to respond to stack_level"
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                refute CfScript.respond_to?(:print_error),
         
     | 
| 
      
 74 
     | 
    
         
            +
                  "Expected CfScript not to respond to print_error"
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                assert CfScript.singleton_class.private_method_defined?(:print_error),
         
     | 
| 
      
 77 
     | 
    
         
            +
                  "Expected CfScript singleton to respond to print_error"
         
     | 
| 
       72 
78 
     | 
    
         
             
              end
         
     | 
| 
       73 
79 
     | 
    
         
             
            end
         
     | 
    
        data/test/support/assertions.rb
    CHANGED
    
    | 
         @@ -12,3 +12,28 @@ def assert_app_info(app_info, expected_instances) 
     | 
|
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         
             
            end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            # Asserts that a command correctly prepares its arguments for passing to
         
     | 
| 
      
 17 
     | 
    
         
            +
            # run_cf and in turn to the cf binary. call_args is an array of the args
         
     | 
| 
      
 18 
     | 
    
         
            +
            # to be passed to the command's run method, and run_args is an array of
         
     | 
| 
      
 19 
     | 
    
         
            +
            # the args expected to be passed to run_cf.
         
     | 
| 
      
 20 
     | 
    
         
            +
            def assert_command_args(command, call_args, run_args)
         
     | 
| 
      
 21 
     | 
    
         
            +
              output = CfScript::Output.new(command, '', '',
         
     | 
| 
      
 22 
     | 
    
         
            +
                OpenStruct.new(
         
     | 
| 
      
 23 
     | 
    
         
            +
                  exitstatus: 0,
         
     | 
| 
      
 24 
     | 
    
         
            +
                  success?:   true,
         
     | 
| 
      
 25 
     | 
    
         
            +
                )
         
     | 
| 
      
 26 
     | 
    
         
            +
              )
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              arg_catcher = lambda do |cmd, *args, &block|
         
     | 
| 
      
 29 
     | 
    
         
            +
                assert_equal run_args, args
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              fake_cf do
         
     | 
| 
      
 33 
     | 
    
         
            +
                command.stub :run_cf, arg_catcher, output do
         
     | 
| 
      
 34 
     | 
    
         
            +
                  command.stub :good_run?, true do
         
     | 
| 
      
 35 
     | 
    
         
            +
                    command.run(*call_args)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -27,7 +27,7 @@ class FixtureExecutor 
     | 
|
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
              def fixture_for(command_line)
         
     | 
| 
       29 
29 
     | 
    
         
             
                case @command_fixtures[command_line.name]
         
     | 
| 
       30 
     | 
    
         
            -
                when :fail, :no_endpoint, :no_login
         
     | 
| 
      
 30 
     | 
    
         
            +
                when :fail, :no_endpoint, :no_login, :empty
         
     | 
| 
       31 
31 
     | 
    
         
             
                  dir = File.join('commands', 'common')
         
     | 
| 
       32 
32 
     | 
    
         
             
                  key = @command_fixtures[command_line.name]
         
     | 
| 
       33 
33 
     | 
    
         
             
                else
         
     | 
| 
         @@ -5,13 +5,25 @@ module MockExecution 
     | 
|
| 
       5 
5 
     | 
    
         
             
                ENV['CF_BINARY'] = 'cf'
         
     | 
| 
       6 
6 
     | 
    
         
             
              end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              def test_config( 
     | 
| 
       9 
     | 
    
         
            -
                CfScript.config.io.stdout 
     | 
| 
       10 
     | 
    
         
            -
                CfScript.config.io.stderr 
     | 
| 
      
 8 
     | 
    
         
            +
              def test_config(options = {})
         
     | 
| 
      
 9 
     | 
    
         
            +
                CfScript.config.io.stdout = options[:stderr] || StringIO.new
         
     | 
| 
      
 10 
     | 
    
         
            +
                CfScript.config.io.stderr = options[:stderr] || StringIO.new
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                CfScript.config.ui. 
     | 
| 
      
 12 
     | 
    
         
            +
                CfScript.config.ui.tags  = options.key?(:tags)  ? options[:tags]  : true
         
     | 
| 
      
 13 
     | 
    
         
            +
                CfScript.config.ui.color = options.key?(:color) ? options[:color] : false
         
     | 
| 
      
 14 
     | 
    
         
            +
                CfScript.config.ui.emoji = options.key?(:emoji) ? options[:emoji] : false
         
     | 
| 
       13 
15 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                CfScript.config.runtime.trace =  
     | 
| 
      
 16 
     | 
    
         
            +
                CfScript.config.runtime.trace = options.key?(:trace) ? options[:trace] : true
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              def with_config(config_options = {}, &block)
         
     | 
| 
      
 20 
     | 
    
         
            +
                config_context = ConfigContext.new
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                test_config(config_options)
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                yield
         
     | 
| 
      
 25 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 26 
     | 
    
         
            +
                config_context.reset
         
     | 
| 
       15 
27 
     | 
    
         
             
              end
         
     | 
| 
       16 
28 
     | 
    
         | 
| 
       17 
29 
     | 
    
         
             
              def test_executor(executor)
         
     | 
| 
         @@ -44,8 +56,18 @@ module MockExecution 
     | 
|
| 
       44 
56 
     | 
    
         
             
                end
         
     | 
| 
       45 
57 
     | 
    
         
             
              end
         
     | 
| 
       46 
58 
     | 
    
         | 
| 
      
 59 
     | 
    
         
            +
              def fake_io(config_options = {}, &block)
         
     | 
| 
      
 60 
     | 
    
         
            +
                config_context = ConfigContext.new
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                test_config(config_options)
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                yield(CfScript.stdout.string, CfScript.stderr.string)
         
     | 
| 
      
 65 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 66 
     | 
    
         
            +
                config_context.reset
         
     | 
| 
      
 67 
     | 
    
         
            +
              end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
       47 
69 
     | 
    
         
             
              def fake_cf(command_fixtures = {}, &block)
         
     | 
| 
       48 
     | 
    
         
            -
                 
     | 
| 
      
 70 
     | 
    
         
            +
                config_context = ConfigContext.new
         
     | 
| 
       49 
71 
     | 
    
         | 
| 
       50 
72 
     | 
    
         
             
                test_env
         
     | 
| 
       51 
73 
     | 
    
         
             
                test_config
         
     | 
| 
         @@ -53,6 +75,6 @@ module MockExecution 
     | 
|
| 
       53 
75 
     | 
    
         | 
| 
       54 
76 
     | 
    
         
             
                yield(CfScript.stdout.string, CfScript.stderr.string)
         
     | 
| 
       55 
77 
     | 
    
         
             
              ensure
         
     | 
| 
       56 
     | 
    
         
            -
                 
     | 
| 
      
 78 
     | 
    
         
            +
                config_context.reset
         
     | 
| 
       57 
79 
     | 
    
         
             
              end
         
     | 
| 
       58 
80 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: cf_script
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0.1 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ammar Ali
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-01- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-01-17 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: colorize
         
     | 
| 
         @@ -32,6 +32,7 @@ extensions: [] 
     | 
|
| 
       32 
32 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       33 
33 
     | 
    
         
             
            files:
         
     | 
| 
       34 
34 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
      
 35 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
       35 
36 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
       36 
37 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       37 
38 
     | 
    
         
             
            - LICENSE
         
     | 
| 
         @@ -39,14 +40,15 @@ files: 
     | 
|
| 
       39 
40 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       40 
41 
     | 
    
         
             
            - cf_script.gemspec
         
     | 
| 
       41 
42 
     | 
    
         
             
            - lib/cf_script.rb
         
     | 
| 
       42 
     | 
    
         
            -
            - lib/cf_script/callbacks.rb
         
     | 
| 
       43 
43 
     | 
    
         
             
            - lib/cf_script/command.rb
         
     | 
| 
       44 
44 
     | 
    
         
             
            - lib/cf_script/command/base.rb
         
     | 
| 
       45 
45 
     | 
    
         
             
            - lib/cf_script/command/cf/apps.rb
         
     | 
| 
       46 
46 
     | 
    
         
             
            - lib/cf_script/command/cf/apps/app.rb
         
     | 
| 
       47 
47 
     | 
    
         
             
            - lib/cf_script/command/cf/apps/apps.rb
         
     | 
| 
      
 48 
     | 
    
         
            +
            - lib/cf_script/command/cf/apps/delete.rb
         
     | 
| 
       48 
49 
     | 
    
         
             
            - lib/cf_script/command/cf/apps/env.rb
         
     | 
| 
       49 
50 
     | 
    
         
             
            - lib/cf_script/command/cf/apps/push.rb
         
     | 
| 
      
 51 
     | 
    
         
            +
            - lib/cf_script/command/cf/apps/rename.rb
         
     | 
| 
       50 
52 
     | 
    
         
             
            - lib/cf_script/command/cf/apps/restage.rb
         
     | 
| 
       51 
53 
     | 
    
         
             
            - lib/cf_script/command/cf/apps/restart.rb
         
     | 
| 
       52 
54 
     | 
    
         
             
            - lib/cf_script/command/cf/apps/set_env.rb
         
     | 
| 
         @@ -75,7 +77,6 @@ files: 
     | 
|
| 
       75 
77 
     | 
    
         
             
            - lib/cf_script/command/runner.rb
         
     | 
| 
       76 
78 
     | 
    
         
             
            - lib/cf_script/config.rb
         
     | 
| 
       77 
79 
     | 
    
         
             
            - lib/cf_script/executor.rb
         
     | 
| 
       78 
     | 
    
         
            -
            - lib/cf_script/executor/non_blocking.rb
         
     | 
| 
       79 
80 
     | 
    
         
             
            - lib/cf_script/executor/recorder.rb
         
     | 
| 
       80 
81 
     | 
    
         
             
            - lib/cf_script/executor/simple.rb
         
     | 
| 
       81 
82 
     | 
    
         
             
            - lib/cf_script/manifest.rb
         
     | 
| 
         @@ -83,7 +84,6 @@ files: 
     | 
|
| 
       83 
84 
     | 
    
         
             
            - lib/cf_script/object/api_endpoint.rb
         
     | 
| 
       84 
85 
     | 
    
         
             
            - lib/cf_script/object/app_info.rb
         
     | 
| 
       85 
86 
     | 
    
         
             
            - lib/cf_script/object/app_list.rb
         
     | 
| 
       86 
     | 
    
         
            -
            - lib/cf_script/object/app_spec.rb
         
     | 
| 
       87 
87 
     | 
    
         
             
            - lib/cf_script/object/attribute.rb
         
     | 
| 
       88 
88 
     | 
    
         
             
            - lib/cf_script/object/attribute_list.rb
         
     | 
| 
       89 
89 
     | 
    
         
             
            - lib/cf_script/object/instance_status.rb
         
     | 
| 
         @@ -116,14 +116,17 @@ files: 
     | 
|
| 
       116 
116 
     | 
    
         
             
            - test/fixtures/commands/apps/app/running.yml
         
     | 
| 
       117 
117 
     | 
    
         
             
            - test/fixtures/commands/apps/apps/good.yml
         
     | 
| 
       118 
118 
     | 
    
         
             
            - test/fixtures/commands/apps/apps/no_apps.yml
         
     | 
| 
       119 
     | 
    
         
            -
            - test/fixtures/commands/apps/ 
     | 
| 
      
 119 
     | 
    
         
            +
            - test/fixtures/commands/apps/delete/good.yml
         
     | 
| 
      
 120 
     | 
    
         
            +
            - test/fixtures/commands/apps/delete/not_exist.yml
         
     | 
| 
      
 121 
     | 
    
         
            +
            - test/fixtures/commands/apps/env/empty_vars.yml
         
     | 
| 
       120 
122 
     | 
    
         
             
            - test/fixtures/commands/apps/env/good.yml
         
     | 
| 
       121 
123 
     | 
    
         
             
            - test/fixtures/commands/apps/push/good.yml
         
     | 
| 
      
 124 
     | 
    
         
            +
            - test/fixtures/commands/apps/rename/good.yml
         
     | 
| 
      
 125 
     | 
    
         
            +
            - test/fixtures/commands/apps/rename/not_found.yml
         
     | 
| 
       122 
126 
     | 
    
         
             
            - test/fixtures/commands/apps/restage/good.yml
         
     | 
| 
       123 
127 
     | 
    
         
             
            - test/fixtures/commands/apps/restage/not_found.yml
         
     | 
| 
       124 
128 
     | 
    
         
             
            - test/fixtures/commands/apps/restart/good.yml
         
     | 
| 
       125 
129 
     | 
    
         
             
            - test/fixtures/commands/apps/restart/not_found.yml
         
     | 
| 
       126 
     | 
    
         
            -
            - test/fixtures/commands/apps/set_env/empty.yml
         
     | 
| 
       127 
130 
     | 
    
         
             
            - test/fixtures/commands/apps/set_env/good.yml
         
     | 
| 
       128 
131 
     | 
    
         
             
            - test/fixtures/commands/apps/set_env/not_found.yml
         
     | 
| 
       129 
132 
     | 
    
         
             
            - test/fixtures/commands/apps/start/good.yml
         
     | 
| 
         @@ -131,9 +134,9 @@ files: 
     | 
|
| 
       131 
134 
     | 
    
         
             
            - test/fixtures/commands/apps/start/with_container.yml
         
     | 
| 
       132 
135 
     | 
    
         
             
            - test/fixtures/commands/apps/stop/good.yml
         
     | 
| 
       133 
136 
     | 
    
         
             
            - test/fixtures/commands/apps/stop/not_found.yml
         
     | 
| 
       134 
     | 
    
         
            -
            - test/fixtures/commands/apps/unset_env/empty.yml
         
     | 
| 
       135 
137 
     | 
    
         
             
            - test/fixtures/commands/apps/unset_env/good.yml
         
     | 
| 
       136 
138 
     | 
    
         
             
            - test/fixtures/commands/apps/unset_env/not_found.yml
         
     | 
| 
      
 139 
     | 
    
         
            +
            - test/fixtures/commands/common/empty.yml
         
     | 
| 
       137 
140 
     | 
    
         
             
            - test/fixtures/commands/common/fail.yml
         
     | 
| 
       138 
141 
     | 
    
         
             
            - test/fixtures/commands/common/no_endpoint.yml
         
     | 
| 
       139 
142 
     | 
    
         
             
            - test/fixtures/commands/common/no_login.yml
         
     | 
| 
         @@ -142,13 +145,11 @@ files: 
     | 
|
| 
       142 
145 
     | 
    
         
             
            - test/fixtures/commands/general/api/good.yml
         
     | 
| 
       143 
146 
     | 
    
         
             
            - test/fixtures/commands/general/api/not_set.yml
         
     | 
| 
       144 
147 
     | 
    
         
             
            - test/fixtures/commands/general/api/set.yml
         
     | 
| 
       145 
     | 
    
         
            -
            - test/fixtures/commands/general/auth/empty.yml
         
     | 
| 
       146 
148 
     | 
    
         
             
            - test/fixtures/commands/general/auth/good.yml
         
     | 
| 
       147 
149 
     | 
    
         
             
            - test/fixtures/commands/general/auth/rejected.yml
         
     | 
| 
       148 
150 
     | 
    
         
             
            - test/fixtures/commands/general/login/good.yml
         
     | 
| 
       149 
151 
     | 
    
         
             
            - test/fixtures/commands/general/login/rejected.yml
         
     | 
| 
       150 
152 
     | 
    
         
             
            - test/fixtures/commands/general/logout/good.yml
         
     | 
| 
       151 
     | 
    
         
            -
            - test/fixtures/commands/general/target/empty.yml
         
     | 
| 
       152 
153 
     | 
    
         
             
            - test/fixtures/commands/general/target/good.yml
         
     | 
| 
       153 
154 
     | 
    
         
             
            - test/fixtures/commands/general/target/no_space.yml
         
     | 
| 
       154 
155 
     | 
    
         
             
            - test/fixtures/commands/general/target/not_found.yml
         
     | 
| 
         @@ -172,16 +173,16 @@ files: 
     | 
|
| 
       172 
173 
     | 
    
         
             
            - test/fixtures/commands/routes/unmap_route/good.yml
         
     | 
| 
       173 
174 
     | 
    
         
             
            - test/fixtures/commands/routes/unmap_route/no_app.yml
         
     | 
| 
       174 
175 
     | 
    
         
             
            - test/fixtures/commands/routes/unmap_route/no_domain.yml
         
     | 
| 
       175 
     | 
    
         
            -
            - test/fixtures/commands/spaces/space/empty.yml
         
     | 
| 
       176 
176 
     | 
    
         
             
            - test/fixtures/commands/spaces/space/good.yml
         
     | 
| 
       177 
177 
     | 
    
         
             
            - test/fixtures/commands/spaces/space/staging.yml
         
     | 
| 
       178 
     | 
    
         
            -
            - test/fixtures/commands/spaces/spaces/empty.yml
         
     | 
| 
       179 
178 
     | 
    
         
             
            - test/fixtures/commands/spaces/spaces/good.yml
         
     | 
| 
       180 
179 
     | 
    
         
             
            - test/lib/cf_script/command/base_test.rb
         
     | 
| 
       181 
180 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/app_test.rb
         
     | 
| 
       182 
181 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/apps_test.rb
         
     | 
| 
      
 182 
     | 
    
         
            +
            - test/lib/cf_script/command/cf/apps/delete_test.rb
         
     | 
| 
       183 
183 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/env_test.rb
         
     | 
| 
       184 
184 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/push_test.rb
         
     | 
| 
      
 185 
     | 
    
         
            +
            - test/lib/cf_script/command/cf/apps/rename_test.rb
         
     | 
| 
       185 
186 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/restage_test.rb
         
     | 
| 
       186 
187 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/restart_test.rb
         
     | 
| 
       187 
188 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/set_env_test.rb
         
     | 
| 
         @@ -216,12 +217,15 @@ files: 
     | 
|
| 
       216 
217 
     | 
    
         
             
            - test/lib/cf_script/output/parser/table_test.rb
         
     | 
| 
       217 
218 
     | 
    
         
             
            - test/lib/cf_script/output/tests_test.rb
         
     | 
| 
       218 
219 
     | 
    
         
             
            - test/lib/cf_script/output_test.rb
         
     | 
| 
      
 220 
     | 
    
         
            +
            - test/lib/cf_script/scope/app/env_test.rb
         
     | 
| 
      
 221 
     | 
    
         
            +
            - test/lib/cf_script/scope/app/routes_test.rb
         
     | 
| 
       219 
222 
     | 
    
         
             
            - test/lib/cf_script/scope/app/state_test.rb
         
     | 
| 
       220 
223 
     | 
    
         
             
            - test/lib/cf_script/scope/app_test.rb
         
     | 
| 
       221 
224 
     | 
    
         
             
            - test/lib/cf_script/scope/script_test.rb
         
     | 
| 
       222 
225 
     | 
    
         
             
            - test/lib/cf_script/scope/space_test.rb
         
     | 
| 
       223 
226 
     | 
    
         
             
            - test/lib/cf_script/scope/target_test.rb
         
     | 
| 
       224 
227 
     | 
    
         
             
            - test/lib/cf_script/scope_test.rb
         
     | 
| 
      
 228 
     | 
    
         
            +
            - test/lib/cf_script/ui_test.rb
         
     | 
| 
       225 
229 
     | 
    
         
             
            - test/lib/cf_script/utils_test.rb
         
     | 
| 
       226 
230 
     | 
    
         
             
            - test/lib/cf_script_test.rb
         
     | 
| 
       227 
231 
     | 
    
         
             
            - test/support/assertions.rb
         
     | 
| 
         @@ -252,9 +256,9 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       252 
256 
     | 
    
         
             
                  version: 2.0.0
         
     | 
| 
       253 
257 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       254 
258 
     | 
    
         
             
              requirements:
         
     | 
| 
       255 
     | 
    
         
            -
              - - " 
     | 
| 
      
 259 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       256 
260 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       257 
     | 
    
         
            -
                  version:  
     | 
| 
      
 261 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       258 
262 
     | 
    
         
             
            requirements: []
         
     | 
| 
       259 
263 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       260 
264 
     | 
    
         
             
            rubygems_version: 2.5.1
         
     | 
| 
         @@ -265,8 +269,10 @@ test_files: 
     | 
|
| 
       265 
269 
     | 
    
         
             
            - test/lib/cf_script/command/base_test.rb
         
     | 
| 
       266 
270 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/app_test.rb
         
     | 
| 
       267 
271 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/apps_test.rb
         
     | 
| 
      
 272 
     | 
    
         
            +
            - test/lib/cf_script/command/cf/apps/delete_test.rb
         
     | 
| 
       268 
273 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/env_test.rb
         
     | 
| 
       269 
274 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/push_test.rb
         
     | 
| 
      
 275 
     | 
    
         
            +
            - test/lib/cf_script/command/cf/apps/rename_test.rb
         
     | 
| 
       270 
276 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/restage_test.rb
         
     | 
| 
       271 
277 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/restart_test.rb
         
     | 
| 
       272 
278 
     | 
    
         
             
            - test/lib/cf_script/command/cf/apps/set_env_test.rb
         
     | 
| 
         @@ -301,12 +307,15 @@ test_files: 
     | 
|
| 
       301 
307 
     | 
    
         
             
            - test/lib/cf_script/output/parser/table_test.rb
         
     | 
| 
       302 
308 
     | 
    
         
             
            - test/lib/cf_script/output/tests_test.rb
         
     | 
| 
       303 
309 
     | 
    
         
             
            - test/lib/cf_script/output_test.rb
         
     | 
| 
      
 310 
     | 
    
         
            +
            - test/lib/cf_script/scope/app/env_test.rb
         
     | 
| 
      
 311 
     | 
    
         
            +
            - test/lib/cf_script/scope/app/routes_test.rb
         
     | 
| 
       304 
312 
     | 
    
         
             
            - test/lib/cf_script/scope/app/state_test.rb
         
     | 
| 
       305 
313 
     | 
    
         
             
            - test/lib/cf_script/scope/app_test.rb
         
     | 
| 
       306 
314 
     | 
    
         
             
            - test/lib/cf_script/scope/script_test.rb
         
     | 
| 
       307 
315 
     | 
    
         
             
            - test/lib/cf_script/scope/space_test.rb
         
     | 
| 
       308 
316 
     | 
    
         
             
            - test/lib/cf_script/scope/target_test.rb
         
     | 
| 
       309 
317 
     | 
    
         
             
            - test/lib/cf_script/scope_test.rb
         
     | 
| 
      
 318 
     | 
    
         
            +
            - test/lib/cf_script/ui_test.rb
         
     | 
| 
       310 
319 
     | 
    
         
             
            - test/lib/cf_script/utils_test.rb
         
     | 
| 
       311 
320 
     | 
    
         
             
            - test/lib/cf_script_test.rb
         
     | 
| 
       312 
321 
     | 
    
         
             
            - test/support/assertions.rb
         
     | 
    
        data/lib/cf_script/callbacks.rb
    DELETED
    
    | 
         @@ -1,43 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module CfScript::Callbacks
         
     | 
| 
       2 
     | 
    
         
            -
              def callbacks
         
     | 
| 
       3 
     | 
    
         
            -
                @callbacks ||= { before: {}, after: {} }
         
     | 
| 
       4 
     | 
    
         
            -
              end
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
              def before(step, &block)
         
     | 
| 
       7 
     | 
    
         
            -
                callbacks[:before][step] ||= []
         
     | 
| 
       8 
     | 
    
         
            -
                callbacks[:before][step] << block
         
     | 
| 
       9 
     | 
    
         
            -
              end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
              def after(step, &block)
         
     | 
| 
       12 
     | 
    
         
            -
                callbacks[:after][step] ||= []
         
     | 
| 
       13 
     | 
    
         
            -
                callbacks[:after][step] << block
         
     | 
| 
       14 
     | 
    
         
            -
              end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              def callbacks_for(type, step)
         
     | 
| 
       17 
     | 
    
         
            -
                return [] unless callbacks.key?(type) && callbacks[type].key?(step)
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                callbacks[type][step]
         
     | 
| 
       20 
     | 
    
         
            -
              end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              def run_callbacks(type, step)
         
     | 
| 
       23 
     | 
    
         
            -
                return unless callbacks[type].key?(step)
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                callbacks[type][step].each do |callback|
         
     | 
| 
       26 
     | 
    
         
            -
                  instance_eval(&callback)
         
     | 
| 
       27 
     | 
    
         
            -
                end
         
     | 
| 
       28 
     | 
    
         
            -
              end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              def run_before(step)
         
     | 
| 
       31 
     | 
    
         
            -
                run_callbacks(:before, step)
         
     | 
| 
       32 
     | 
    
         
            -
              end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
              def run_after(step)
         
     | 
| 
       35 
     | 
    
         
            -
                run_callbacks(:after, step)
         
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
              def run_around(step, &block)
         
     | 
| 
       39 
     | 
    
         
            -
                run_before(step)
         
     | 
| 
       40 
     | 
    
         
            -
                yield
         
     | 
| 
       41 
     | 
    
         
            -
                run_after(step)
         
     | 
| 
       42 
     | 
    
         
            -
              end
         
     | 
| 
       43 
     | 
    
         
            -
            end
         
     |