speedflow 0.1.0 → 0.1.1

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: 5dbf2b0268766ac602d031b032f4a050893a0c70
4
- data.tar.gz: b80f540563d169c40148ec7ec5345566e8c230fc
3
+ metadata.gz: 1fa0904a1217e443c1c991f6a65247eedb1b74bf
4
+ data.tar.gz: 230efa0af2539563d2b8f23465b4d1cd2723ba2e
5
5
  SHA512:
6
- metadata.gz: de2a65663c9b74ed32dd28e5f5273aa472fd3137fbb25a799cb8ebd97525b99c17e72b0db16669a73d774bdfa93c84857bd63233fc54d16ae0b6e816c14615fa
7
- data.tar.gz: 221cd775cb9bbfc581a39a0b6a0b3717f12c8cd769c8698fa103b91080fdf5e5e4db4007fbe869cbd196d705fab3de7ba21ea2891d82567ed573448295f753af
6
+ metadata.gz: 3a72c8b294fbc30f78ce1f72249ab43be9b3f04408c8f6bba93798035e7a6225a23a590d2be597415cf2bd5456af973f10e63832fae8011e72598d6ff1dc04c2
7
+ data.tar.gz: 9cf30224680531bca375aa8ba1616ef118e6bdb9823abbb96325470339ca79fcb37eb0ee01e7209e1683e17eaf018b231b10f98b583ccd9f1374fe30b6aa1fa8
data/bin/speedflow CHANGED
@@ -7,7 +7,7 @@ require 'speedflow'
7
7
  # Speedflow program
8
8
  Mercenary.program(:speedflow) do |program|
9
9
  program.version Speedflow::VERSION
10
- program.description 'Speedflow is a CLI tool to help you to keep your time.'
10
+ program.description 'Speedflow is a CLI to help you to keep your time.'
11
11
  program.syntax "speedflow [OPTIONS] COMMAND [arg...]\n" \
12
12
  ' speedflow [ --help | -v | --version | --trace ]'
13
13
  program.option(
@@ -29,12 +29,28 @@ module Speedflow
29
29
  output = {}
30
30
  @config['flow'][trigger.to_s].each do |step|
31
31
  arguments = step['arguments'] || {}
32
+
32
33
  step['arguments'] = transform_arguments(arguments, output, inputs)
33
- step['arguments']['_config'] = @config
34
+ step['arguments'] = add_config_argument(arguments)
35
+
34
36
  output = plugin_manager.call_action_from_step(step)
35
37
  end
36
38
  end
37
39
 
40
+ # Public: Add config arguement
41
+ #
42
+ # arguments - Hash of arguments.
43
+ #
44
+ # Returns Hash of arguments.
45
+ def add_config_argument(arguments)
46
+ arguments['_config'] = @config.clone
47
+ arguments['_config'].delete_if { |k, _| arguments.key?(k) }
48
+ arguments['_config'].delete_if do |k, _|
49
+ @config.class.const_get('DEFAULTS').stringify_keys.key?(k)
50
+ end
51
+ arguments
52
+ end
53
+
38
54
  # Public: Transform arguments (to add value)
39
55
  #
40
56
  # arguments - Hash of arguments.
@@ -45,14 +61,14 @@ module Speedflow
45
61
  def transform_arguments(arguments, prev_values, inputs)
46
62
  arguments = arguments.replace_values_from_previous(prev_values)
47
63
  arguments.each do |arg_name, arg_values|
48
- arguments[arg_name][:value] = ''
64
+ arguments[arg_name] = {} unless arguments[arg_name].is_a?(Hash)
65
+ arguments[arg_name]['value'] = ''
49
66
  if inputs.key?(arg_name)
50
- arguments[arg_name][:value] = inputs[arg_name]
51
- elsif arg_values.key?('default')
52
- arguments[arg_name][:value] = arg_values[:default]
67
+ arguments[arg_name]['value'] = inputs[arg_name]
68
+ elsif !arg_values.nil? && arg_values.key?('default')
69
+ arguments[arg_name]['value'] = arg_values['default']
53
70
  end
54
71
  end
55
- arguments
56
72
  end
57
73
 
58
74
  # Public: Get flat arguments from flow.
@@ -1,3 +1,3 @@
1
1
  module Speedflow
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speedflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Breux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-21 00:00:00.000000000 Z
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: require_all