producer-core 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8faaa83c5e385860c285a917432f88805b1445d
4
- data.tar.gz: b52d94053b00d17230c749c322951a9bb827cf62
3
+ metadata.gz: 993830c5ed30225fe7333275a8eb33f39b000448
4
+ data.tar.gz: 74554e80ba1c4bfd0d1b7f23421e8fec68197693
5
5
  SHA512:
6
- metadata.gz: f6b3876fbe282f363d89b8fde05c0c39d9631e13cb64fa42b7bc5fae4773b76ceba55895906afa1a51b34429de16b5ca24cb75ba3f68d78222cd9148fe0e26ad
7
- data.tar.gz: 4ad7ba7ef20948f5ad4ddc795fb7a6a075f5de6fd06591e86edd8b8114e20e5aa22c405652c074b5624915f44223de00dd250071997146d4baaa7b942173adb2
6
+ metadata.gz: 133378dc481c5f5bbdd899d37aa4519a2e5f4dfcb3b771b44254bed19bbb8275940d192bef19705e2187b30d9dfe9a5ee9fabd1d0ce91c516c3fd27dd1346c1d
7
+ data.tar.gz: 41ee1449668ed09cad36e08274ee81ddd318f29d2b3e0dfc884ce5b7f7cf54c955525200afdc09a4945fcf812ba1fc3ed5c62c3dc108bec09f8f8f34c4715111
@@ -16,8 +16,8 @@ Feature: CLI verbose option
16
16
 
17
17
  Scenario: prints tasks name
18
18
  When I successfully execute the recipe with option -v
19
- Then the output must match /^Task:.+`task_ok'/
20
- And the output must match /^Task:.+`task_ko'/
19
+ Then the output must match /Task:.+`task_ok'/
20
+ And the output must match /Task:.+`task_ko'/
21
21
 
22
22
  Scenario: appends `applying' or `skipped' after tasks name
23
23
  When I successfully execute the recipe with option -v
@@ -28,6 +28,16 @@ Feature: CLI verbose option
28
28
  When I successfully execute the recipe with option -v
29
29
  Then the output must match /^ action: echo/
30
30
 
31
- Scenario: formats message with our simple logger
31
+ Scenario: prints actions arguments
32
32
  When I successfully execute the recipe with option -v
33
- Then the output must match /\ATask:/
33
+ Then the output must match /echo \["some message"\]/
34
+
35
+ Scenario: summarizes printed actions arguments
36
+ Given a recipe with:
37
+ """
38
+ task :some_task do
39
+ echo 'long message ' * 32
40
+ end
41
+ """
42
+ When I successfully execute the recipe with option -v
43
+ Then the output must match /action: .{,70}$/
@@ -1,6 +1,8 @@
1
1
  module Producer
2
2
  module Core
3
3
  class Action
4
+ INSPECT_ARGUMENTS_SUM_LEN = 68.freeze
5
+
4
6
  extend Forwardable
5
7
  def_delegators :@env, :input, :output, :error_output, :remote
6
8
  def_delegators :remote, :fs
@@ -17,7 +19,14 @@ module Producer
17
19
  end
18
20
 
19
21
  def to_s
20
- name
22
+ [name, inspect_arguments].join ' '
23
+ end
24
+
25
+
26
+ private
27
+
28
+ def inspect_arguments
29
+ @arguments.inspect[0, INSPECT_ARGUMENTS_SUM_LEN - name.length]
21
30
  end
22
31
  end
23
32
  end
@@ -1,5 +1,5 @@
1
1
  module Producer
2
2
  module Core
3
- VERSION = '0.2.11'.freeze
3
+ VERSION = '0.2.12'.freeze
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ module Producer
20
20
  if task.condition_met?
21
21
  env.log "Task: `#{task}' applying..."
22
22
  task.actions.each do |e|
23
- env.log " action: #{e} applying"
23
+ env.log " action: #{e}"
24
24
  e.apply unless env.dry_run?
25
25
  end
26
26
  else
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency 'net-ssh', '~> 2.7'
21
21
  s.add_dependency 'net-sftp', '~> 2.1'
22
22
 
23
- s.add_development_dependency 'rspec', '~> 2.14'
23
+ s.add_development_dependency 'rspec', '~> 3.1'
24
24
  s.add_development_dependency 'cucumber', '~> 1.3'
25
25
  s.add_development_dependency 'aruba', '~> 0.5'
26
26
  s.add_development_dependency 'cucumber-sshd', '~> 0.1'
@@ -71,7 +71,8 @@ module Producer::Core
71
71
  let(:sftp_session) { double 'sftp session' }
72
72
 
73
73
  it 'returns an FS instance built with a new sftp session' do
74
- remote.stub_chain(:session, :sftp, :connect) { sftp_session }
74
+ allow(remote)
75
+ .to receive_message_chain(:session, :sftp, :connect) { sftp_session }
75
76
  expect(remote.fs.sftp).to be sftp_session
76
77
  end
77
78
  end
data/spec/spec_helper.rb CHANGED
@@ -4,8 +4,6 @@ Dir['spec/support/**/*.rb'].map { |e| require e.gsub 'spec/', '' }
4
4
 
5
5
 
6
6
  RSpec.configure do |c|
7
- c.treat_symbols_as_metadata_keys_with_true_values = true
8
-
9
7
  c.include TestEnvHelpers, :env
10
8
 
11
9
  c.include NetSSHStoryHelpers, :ssh
@@ -54,8 +54,20 @@ module Producer::Core
54
54
  end
55
55
 
56
56
  describe '#to_s' do
57
- it 'returns a word' do
58
- expect(action.to_s).to eq action.name
57
+ it 'includes action name' do
58
+ expect(action.to_s).to match /\A#{action.name}/
59
+ end
60
+
61
+ it 'includes arguments inspection' do
62
+ expect(action.to_s).to match /#{Regexp.quote(arguments.inspect)}\z/
63
+ end
64
+
65
+ context 'when arguments inspection is very long' do
66
+ let(:arguments) { [:some, :arguments] * 32 }
67
+
68
+ it 'summarizes arguments inspection' do
69
+ expect(action.to_s.length).to be < 70
70
+ end
59
71
  end
60
72
  end
61
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: producer-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-24 00:00:00.000000000 Z
11
+ date: 2014-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.14'
47
+ version: '3.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.14'
54
+ version: '3.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: cucumber
57
57
  requirement: !ruby/object:Gem::Requirement