clomp 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e47ea6ec093b8ab11e99b615dddf91181d24eed
4
- data.tar.gz: 59167d45beac40e14a6f4f72c5ebb9fa9ef5f1b7
3
+ metadata.gz: 157180a93184acd687b9a7f477c3fa802e25e97d
4
+ data.tar.gz: 4764196bd4c58fa24a080c64acadc4c39551bdce
5
5
  SHA512:
6
- metadata.gz: c2d46715a028669f2854144443b80df6a7a143a5fb5f94c027d3e33e239d8024e090c1aeb8fdf1207293e211dbec4cb401342f5af9a7832691aedbfb8d3f58a6
7
- data.tar.gz: 607fed96028adb84a7c281d245444d579d0a820dfa4a20bb109f469331af3e8e9441fe659e5bd506de9a46aeb9740aecde3bce3fd49bdd6b84e41b143f2752be
6
+ metadata.gz: e36e6fec60c1f24f8875594e42c3c378f8168f5189aedc9ea57a42e0dc09ade21d28ddfd62a31833d48424650047f752848684a68a3bb6269e0c38c20189643d
7
+ data.tar.gz: ca9b011b066f366ed6af520f5581052f5d3873eadbc084d3168e268a64c5127bf33de8bc2d425942a67eb504cd7d08b5b8d6a881fee0a6371a1db8642403fd5d
data/.byebug_history CHANGED
@@ -1,11 +1,12 @@
1
- exit
2
1
  c
3
- _callable_object = Callable[result, track, options, _self]
2
+ Callable[result, track, options, _self]
4
3
  track.name
5
- track
6
- track.track_name
7
- _callable_object
4
+ track.track_from
8
5
  c
9
- n
10
6
  track.track_from
7
+ Callable[result, track, options, _self]
8
+ track
9
+ _self
10
+ track.name
11
+ track_name
11
12
  _callable_object
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clomp (0.0.4)
4
+ clomp (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -40,7 +40,6 @@ class SingingOperation < Clomp::Operation
40
40
  # Configure your operation for common tracks,
41
41
  # configuration can be overridden from individual tracks
42
42
  setup do |config|
43
- config.pass_fast = true
44
43
  config.fail_fast = true
45
44
  config.optional = true
46
45
  end
@@ -62,16 +61,16 @@ class SingingOperation < Clomp::Operation
62
61
 
63
62
  finally :receive_price #final step, wont execute after this step!
64
63
 
65
- def get_instruments_ready(options, mutable_data: , **)
64
+ def get_instruments_ready(options, params: , **)
66
65
  # do anything!
67
66
  end
68
67
 
69
- def get_lyrics(options, mutable_data: , **)
70
- mutable_data[:singer_name] = 'James' #mutate
68
+ def get_lyrics(options, params: , **)
69
+ params[:singer_name] = 'James' #mutate
71
70
  end
72
71
 
73
72
  def start_signing(options)
74
- puts options[:mutable_options]
73
+ puts options[:params]
75
74
  end
76
75
 
77
76
  def receive_price(options)
@@ -86,6 +85,16 @@ end
86
85
  @result.failure? # => false
87
86
  ```
88
87
 
88
+ ## Configuration
89
+ You can set custom step name(s), custom fail, pass flow configuration globally and operation wise!
90
+
91
+ ```ruby
92
+ Clomp::Configuration.setup do |config|
93
+ # You can set as many step name as you want
94
+ config.custom_step_names =+ [:my_own_step_name]
95
+ end
96
+ ```
97
+
89
98
  ## Development
90
99
 
91
100
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,12 +1,26 @@
1
1
  module Clomp
2
2
  class Configuration
3
- attr_accessor :fail_fast, :pass_fast, :optional
3
+ attr_accessor :fail_fast, :pass_fast, :optional, :custom_step_names
4
4
 
5
5
  # Constructor for Configuration file
6
6
  def initialize
7
- @pass_fast = false
8
- @fail_fast = false
9
- @optional = false
7
+ @pass_fast = false
8
+ @fail_fast = false
9
+ @optional = false
10
+ @custom_step_names = [:step, :set]
11
+ end
12
+
13
+ class << self
14
+ # Self configuration
15
+ def config
16
+ @config ||= new
17
+
18
+ yield(@config) if block_given?
19
+
20
+ @config
21
+ end
22
+
23
+ alias_method :setup, :config
10
24
  end
11
25
  end
12
26
  end
@@ -49,7 +49,7 @@ module Clomp
49
49
  #
50
50
  # @return [Configuration] @config
51
51
  def setup
52
- @configs ||= Configuration.new
52
+ @configs ||= Configuration.config
53
53
 
54
54
  yield(@configs) if block_given?
55
55
 
@@ -57,6 +57,7 @@ module Clomp
57
57
  end
58
58
 
59
59
  alias_method :setup_configuration, :setup
60
+ alias_method :configuration, :setup
60
61
 
61
62
  # Share track from other operation
62
63
  def share(track_name, from:, track_options: {}, &block)
@@ -76,6 +77,16 @@ module Clomp
76
77
  @track_builders << build_track(track_name, track_options, :track, track_for: nil, &block)
77
78
  end
78
79
 
80
+ alias_method :set, :track
81
+
82
+ def method_missing(symbol, *args)
83
+ if self.configuration.custom_step_names.include?(symbol)
84
+ track(args)
85
+ else
86
+ super
87
+ end
88
+ end
89
+
79
90
  # get the track name for the failure case!
80
91
  def failure(track_name, track_options: {}, &block)
81
92
  @track_builders ||= []
@@ -90,20 +101,18 @@ module Clomp
90
101
  @track_builders << build_track(track_name, track_options, :finally, track_for: nil, &block)
91
102
  end
92
103
 
93
- def [](mutable_data = {}, immutable_data = {})
94
- self.(mutable_data, immutable_data)
95
- end
96
-
97
104
  def call(mutable_data = {}, immutable_data = {})
98
105
  new(
99
106
  track_builders: @track_builders,
100
107
  options: {
101
- mutable_data: mutable_data,
102
- immutable_data: immutable_data
108
+ params: mutable_data || {},
109
+ immutable_data: immutable_data || {}
103
110
  },
104
111
  ).result
105
112
  end
106
113
 
114
+ alias_method :[], :call
115
+
107
116
  private
108
117
 
109
118
  def build_track(track_name, track_options = {}, track_type, track_for: nil, &block)
data/lib/clomp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Clomp
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clomp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Irfan Ahmed
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-13 00:00:00.000000000 Z
11
+ date: 2018-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler