mikado_graph_generator 0.2.0 → 0.4.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
- SHA1:
3
- metadata.gz: 50d127099e97a095948b836a9cd6d547caf4961f
4
- data.tar.gz: 7a9dc695f1e142367483d130b0388d0dd6959337
2
+ SHA256:
3
+ metadata.gz: a254c6a80eab0d8a945761db1885099d097e377e84a45710610e2fbb66f336fb
4
+ data.tar.gz: 2f9164d1e405be0c8cc583c578f8768ec82f9fe4fecf9c0531b224573f1d7a27
5
5
  SHA512:
6
- metadata.gz: fb466184253fd7dd6882c9939e5e18a34553604a1952ddd3195cc1956ee4abfc872258346d154dc511e2c2447e6948bfa3bfc764fc15f34ea5c90c33c0d51495
7
- data.tar.gz: daf8ef624d17918aafaf78aa9aa498da21d0c33992396296f513dcf4360d5e41f6d33e6978f47a1aaf57135ebe1fb5d1a6cbdaa75bafe27d028c3a0b8c8f898e
6
+ metadata.gz: 78de18a57dfd317370ea5b26b4d48337b33d575b7184686b6b8139efac1d72b37fa98f09a08bc01f0d09094e96de8380240ad2475a15502bdb93e9cc0e0d68ea
7
+ data.tar.gz: 1793b88bb2c63668f226beb685631e1b221b19b53fe45a9f6660584704b1e4d571ab42b2e7b3f75a62688d32660735246bbf20ffe458edb90a76ddb49654804c
@@ -1,10 +1,8 @@
1
1
  root = true
2
2
 
3
3
  [*]
4
-
5
4
  indent_style = space
6
5
  indent_size = 2
7
- end_of_line = lf
8
6
  charset = utf-8
9
7
  trim_trailing_whitespace = true
10
8
  insert_final_newline = true
data/.envrc ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ export PATH=`pwd`/bin:$PATH
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ export PATH=`pwd`/bin:$PATH
data/.gitignore CHANGED
@@ -1,15 +1,10 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
13
- .idea/
1
+ # Ignore all logfiles and tempfiles.
2
+ .DS_Store
3
+ .idea/*
4
+ coverage/
5
+ doc/
6
+ log/*.log
7
+ pkg/
8
+ tmp/
14
9
 
15
10
  *.png
data/.rspec CHANGED
@@ -1,2 +1,4 @@
1
1
  --format documentation
2
2
  --color
3
+ --require support/spec_helper
4
+ --order random
@@ -0,0 +1 @@
1
+ --display-cop-names
@@ -0,0 +1,168 @@
1
+ #
2
+ # Do not enforce any of these cops...
3
+ #
4
+ # Note: cops are ordered alphabetically.
5
+ #
6
+
7
+ require: rubocop-rspec
8
+
9
+ #
10
+ # Checks that tests use 'described_class'.
11
+ #
12
+ # Note: I can't figure out which is the correct cop so I've included both.
13
+ #
14
+ RSpec/DescribedClass:
15
+ Enabled: false
16
+
17
+ RSpec/DescribeClass:
18
+ Enabled: false
19
+
20
+ #
21
+ # Checks that the second argument to 'describe' specifies a method.
22
+ #
23
+ RSpec/DescribeMethod:
24
+ Enabled: false
25
+
26
+ #
27
+ # Checks for 'subject' definitions that come after 'let' definitions.
28
+ #
29
+ # # bad
30
+ # RSpec.describe User do
31
+ # let(:params) { blah }
32
+ # subject { described_class.new(params) }
33
+ #
34
+ # it 'is valid' do
35
+ # expect(subject.valid?).to be(true)
36
+ # end
37
+ # end
38
+ #
39
+ # # good
40
+ # RSpec.describe User do
41
+ # subject { described_class.new(params) }
42
+ #
43
+ # let(:params) { blah }
44
+ #
45
+ # it 'is valid' do
46
+ # expect(subject.valid?).to be(true)
47
+ # end
48
+ # end
49
+ #
50
+ RSpec/LeadingSubject:
51
+ Enabled: false
52
+
53
+ #
54
+ # This cop looks for uses of block comments (=begin...=end).
55
+ #
56
+ Style/BlockComments:
57
+ Enabled: false
58
+
59
+ #
60
+ # Check for if and case statements where each branch is used for assignment to the same variable when using
61
+ # the return of the condition can be used instead.
62
+ #
63
+ # # bad
64
+ # if foo
65
+ # bar = 1
66
+ # else
67
+ # bar = 2
68
+ # end
69
+ #
70
+ # # good
71
+ # bar = if foo
72
+ # 1
73
+ # else
74
+ # 2
75
+ # end
76
+ #
77
+ Style/ConditionalAssignment:
78
+ Enabled: false
79
+
80
+ #
81
+ # This cop checks for missing top-level documentation of classes and modules.
82
+ #
83
+ Style/Documentation:
84
+ Enabled: false
85
+
86
+ #
87
+ # This cop checks for uses of double negation (!!) to convert something to a boolean value. As this is both
88
+ # cryptic and usually redundant, it should be avoided.
89
+ #
90
+ Style/DoubleNegation:
91
+ Enabled: false
92
+
93
+ #
94
+ # This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go
95
+ # on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style.)
96
+ #
97
+ # Note: A method definition is not considered empty if it contains comments.
98
+ #
99
+ Style/EmptyMethod:
100
+ Enabled: false
101
+
102
+ #
103
+ # This cop is designed to help upgrade to Ruby 3.0. It will add the comment `# frozen_string_literal: true` to the top
104
+ # of files to enable frozen string literals. Frozen string literals will be default in Ruby 3.0. The comment will be
105
+ # added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.
106
+ #
107
+ Style/FrozenStringLiteralComment:
108
+ Enabled: false
109
+
110
+ #
111
+ # This cops checks for use of extend self or module_function in a module.
112
+ #
113
+ Style/ModuleFunction:
114
+ Enabled: false
115
+
116
+ #
117
+ # This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).
118
+ #
119
+ # # bad
120
+ # CONST = [1, 2, 3]
121
+ #
122
+ # # good
123
+ # CONST = [1, 2, 3].freeze
124
+ #
125
+ Style/MutableConstant:
126
+ Enabled: false
127
+
128
+ #
129
+ # This cop (by default) checks for uses of methods Hash#has_key? and Hash#has_value? where it enforces Hash#key? and
130
+ # Hash#value? It is configurable to enforce the inverse, using verbose method names also.
131
+ #
132
+ # EnforcedStyle: short
133
+ #
134
+ # # bad
135
+ # Hash#has_key?
136
+ # Hash#has_value?
137
+ #
138
+ # # good
139
+ # Hash#key?
140
+ # Hash#value?
141
+ #
142
+ # EnforcedStyle: verbose
143
+ #
144
+ # # bad
145
+ # Hash#key?
146
+ # Hash#value?
147
+ #
148
+ # # good
149
+ # Hash#has_key?
150
+ # Hash#has_value?
151
+ #
152
+ Style/PreferredHashMethods:
153
+ Enabled: false
154
+
155
+ #
156
+ # This cop checks whether the block parameters of a single-line method accepting a block match the names
157
+ # specified via configuration.
158
+ #
159
+ # For instance one can configure reduce(inject) to use |a, e| as parameters.
160
+ #
161
+ Style/SingleLineBlockParams:
162
+ Enabled: false
163
+
164
+ #
165
+ # This cop can check for the %w() syntax.
166
+ #
167
+ Style/WordArray:
168
+ Enabled: false
@@ -0,0 +1,300 @@
1
+ #
2
+ # Enforce all of these cops...
3
+ #
4
+ # Note: cops are ordered alphabetically.
5
+ #
6
+
7
+ require: rubocop-rspec
8
+
9
+ #
10
+ # This cop checks whether the end keywords are aligned properly.
11
+ #
12
+ # # good
13
+ # variable = if true
14
+ # end
15
+ #
16
+ Layout/EndAlignment:
17
+ EnforcedStyleAlignWith: variable
18
+
19
+ #
20
+ # This cop looks for error classes inheriting from Exception and its standard library subclasses,
21
+ # excluding subclasses of StandardError.
22
+ #
23
+ Lint/InheritException:
24
+ EnforcedStyle: runtime_error
25
+
26
+ #
27
+ # This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored.
28
+ # The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
29
+ #
30
+ Metrics/BlockLength:
31
+ ExcludedMethods:
32
+ - describe
33
+
34
+ #
35
+ # This cop checks the length of lines in the source code.
36
+ #
37
+ Layout/LineLength:
38
+ Max: 140
39
+
40
+ #
41
+ # This cop checks if the length of a method exceeds some maximum value.
42
+ #
43
+ Metrics/MethodLength:
44
+ Max: 15
45
+
46
+ #
47
+ # Checks for long examples.
48
+ #
49
+ RSpec/ExampleLength:
50
+ Max: 20
51
+
52
+ #
53
+ # This cop checks for consistent style when specifying RSpec hooks which run for each example.
54
+ #
55
+ # # bad
56
+ # before(:each) do
57
+ # ...
58
+ # end
59
+ #
60
+ # # bad
61
+ # before(:example) do
62
+ # ...
63
+ # end
64
+ #
65
+ # # good
66
+ # before do
67
+ # ...
68
+ # end
69
+ #
70
+ RSpec/HookArgument:
71
+ EnforcedStyle: implicit
72
+
73
+ #
74
+ # Checks if examples contain too many 'expect' calls.
75
+ #
76
+ RSpec/MultipleExpectations:
77
+ Max: 3
78
+
79
+ #
80
+ # Checks for consistent method usage for negating expectations.
81
+ #
82
+ RSpec/NotToNot:
83
+ EnforcedStyle: to_not
84
+
85
+ #
86
+ # Check that the keys, separators, and values of a multi-line hash literal are aligned according
87
+ # to configuration. With 'key' everything is left aligned.
88
+ #
89
+ Layout/HashAlignment:
90
+ EnforcedHashRocketStyle: key
91
+ EnforcedColonStyle: key
92
+ EnforcedLastArgumentHashStyle: always_ignore
93
+
94
+ #
95
+ # Here we check if the parameters on a multi-line method call or definition are aligned.
96
+ #
97
+ Layout/ParameterAlignment:
98
+ EnforcedStyle: with_fixed_indentation
99
+
100
+ #
101
+ # This cop checks how the 'whens' of a case expression are indented in relation to its 'case' or 'end' keyword.
102
+ #
103
+ Layout/CaseIndentation:
104
+ EnforcedStyle: end
105
+ IndentOneStep: true
106
+
107
+ #
108
+ # This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions
109
+ # to go on a single line (compact style).
110
+ #
111
+ Style/EmptyMethod:
112
+ Exclude:
113
+ - 'db/migrate/*'
114
+
115
+ #
116
+ # This cop checks for a line break before the first element in a multi-line hash.
117
+ #
118
+ # # bad
119
+ # { a: 1,
120
+ # b: 2}
121
+ #
122
+ # # good
123
+ # {
124
+ # a: 1,
125
+ # b: 2 }
126
+ #
127
+ Layout/FirstHashElementLineBreak:
128
+ Enabled: true
129
+
130
+ #
131
+ # This cop checks for a line break before the first argument in a multi-line method call.
132
+ #
133
+ # # bad
134
+ # method(foo, bar,
135
+ # baz)
136
+ #
137
+ # # good
138
+ # method(
139
+ # foo, bar,
140
+ # baz)
141
+ #
142
+ # # ignored
143
+ # method foo, bar,
144
+ # baz
145
+ #
146
+ Layout/FirstMethodArgumentLineBreak:
147
+ Enabled: true
148
+
149
+ #
150
+ # This cop checks for uses of the lambda literal syntax.
151
+ #
152
+ # # literal
153
+ # f = ->(x) { x }
154
+ # f = ->(x) do
155
+ # x
156
+ # end
157
+ #
158
+ Style/Lambda:
159
+ EnforcedStyle: literal
160
+
161
+ #
162
+ # This cop checks presence of parentheses in method calls containing parameters. As in popular Ruby's frameworks a lot
163
+ # of methods should always be called without parentheses, users can ignore them by passing their names to IgnoredMethods
164
+ # option.
165
+ #
166
+ # # bad
167
+ # array.delete e
168
+ #
169
+ # # good
170
+ # array.delete(e)
171
+ #
172
+ # # good if `puts` is listed in IgnoredMethods
173
+ # puts 'test'
174
+ #
175
+ Style/MethodCallWithArgsParentheses:
176
+ Enabled: true
177
+ IgnoredMethods:
178
+ - add_development_dependency
179
+ - after_initialize
180
+ - assert
181
+ - assert_contents
182
+ - assert_empty
183
+ - assert_equal
184
+ - assert_held
185
+ - assert_nil
186
+ - assert_presence_of
187
+ - assert_raises
188
+ - assert_should_strip_whitespace
189
+ - assert_time_within
190
+ - attr_accessor
191
+ - attr_reader
192
+ - attr_writer
193
+ - attribute
194
+ - autocomplete_for
195
+ - before_action
196
+ - belongs_to
197
+ - column
198
+ - delegate
199
+ - describe
200
+ - extend
201
+ - field
202
+ - guard
203
+ - gem
204
+ - goto
205
+ - has_many
206
+ - in_line_ajax_action
207
+ - include
208
+ - it
209
+ - it_behaves_like
210
+ - link
211
+ - puts
212
+ - raise
213
+ - redefine_const
214
+ - redirect_to
215
+ - render
216
+ - require
217
+ - require_relative
218
+ - ruby
219
+ - scope
220
+ - should
221
+ - source
222
+ - task
223
+ - to
224
+ - to_not
225
+ - validate
226
+ - validates
227
+ - validates_numericality_of
228
+ - validates_presence_of
229
+ - within
230
+
231
+ #
232
+ # This cop checks that closing brace of a multi-line method call must be on the line after the last
233
+ # argument of the call.
234
+ #
235
+ # # symmetrical: bad
236
+ # # new_line: good
237
+ # # same_line: bad
238
+ # foo(a,
239
+ # b
240
+ # )
241
+ #
242
+ # # symmetrical: bad
243
+ # # new_line: bad
244
+ # # same_line: good
245
+ # foo(
246
+ # a,
247
+ # b)
248
+ #
249
+ # # symmetrical: good
250
+ # # new_line: bad
251
+ # # same_line: good
252
+ # foo(a,
253
+ # b)
254
+ #
255
+ # # symmetrical: good
256
+ # # new_line: good
257
+ # # same_line: bad
258
+ # foo(
259
+ # a,
260
+ # b
261
+ # )
262
+ #
263
+ Layout/MultilineMethodCallBraceLayout:
264
+ EnforcedStyle: new_line
265
+
266
+ #
267
+ # This cop checks the indentation of the method name part in method calls that span more than one line.
268
+ #
269
+ # # good
270
+ # while a
271
+ # .b
272
+ # something
273
+ # end
274
+ #
275
+ Layout/MultilineMethodCallIndentation:
276
+ EnforcedStyle: indented
277
+
278
+ #
279
+ # This cop looks for uses of Perl-style global variables.
280
+ #
281
+ Style/SpecialGlobalVars:
282
+ EnforcedStyle: use_english_names
283
+
284
+ #
285
+ # Checks if uses of quotes match the configured preference.
286
+ #
287
+ Style/StringLiterals:
288
+ EnforcedStyle: double_quotes
289
+
290
+ #
291
+ # This cop makes sure that all numbered variables use snake_case for their numbering.
292
+ #
293
+ # # bad
294
+ # variable1 = 1
295
+ #
296
+ # # good
297
+ # variable_1 = 1
298
+ #
299
+ Naming/VariableNumber:
300
+ EnforcedStyle: snake_case
@@ -0,0 +1,10 @@
1
+ #
2
+ # The Rubocop configuration for mikado_graph_generator
3
+ #
4
+
5
+ AllCops:
6
+ NewCops: enable
7
+
8
+ inherit_from:
9
+ - .rubocop.disabled.yml
10
+ - .rubocop.enabled.yml
@@ -0,0 +1 @@
1
+ 2.6.6
@@ -1,7 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.1
3
+ - 2.6.6
4
4
  before_install:
5
- - gem install bundler -v 1.14.3
5
+ - gem update --system
6
6
  - sudo apt-get -qq update
7
7
  - sudo apt-get install -y graphviz
8
+ script:
9
+ - bundle exec rubocop
10
+ - bundle exec rspec
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
@@ -1,37 +1,106 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mikado_graph_generator (0.2.0)
4
+ mikado_graph_generator (0.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ ast (2.4.1)
10
+ coderay (1.1.3)
9
11
  diff-lcs (1.3)
10
- rake (10.5.0)
11
- rspec (3.5.0)
12
- rspec-core (~> 3.5.0)
13
- rspec-expectations (~> 3.5.0)
14
- rspec-mocks (~> 3.5.0)
15
- rspec-core (3.5.4)
16
- rspec-support (~> 3.5.0)
17
- rspec-expectations (3.5.0)
12
+ ffi (1.13.1)
13
+ formatador (0.2.5)
14
+ guard (2.16.2)
15
+ formatador (>= 0.2.4)
16
+ listen (>= 2.7, < 4.0)
17
+ lumberjack (>= 1.0.12, < 2.0)
18
+ nenv (~> 0.1)
19
+ notiffany (~> 0.0)
20
+ pry (>= 0.9.12)
21
+ shellany (~> 0.0)
22
+ thor (>= 0.18.1)
23
+ guard-bundler (3.0.0)
24
+ bundler (>= 2.1, < 3)
25
+ guard (~> 2.2)
26
+ guard-compat (~> 1.1)
27
+ guard-compat (1.2.1)
28
+ guard-rspec (4.7.3)
29
+ guard (~> 2.1)
30
+ guard-compat (~> 1.1)
31
+ rspec (>= 2.99.0, < 4.0)
32
+ guard-rubocop (1.3.0)
33
+ guard (~> 2.0)
34
+ rubocop (~> 0.20)
35
+ listen (3.2.1)
36
+ rb-fsevent (~> 0.10, >= 0.10.3)
37
+ rb-inotify (~> 0.9, >= 0.9.10)
38
+ lumberjack (1.2.5)
39
+ method_source (1.0.0)
40
+ nenv (0.3.0)
41
+ notiffany (0.1.3)
42
+ nenv (~> 0.1)
43
+ shellany (~> 0.0)
44
+ parallel (1.19.1)
45
+ parser (2.7.1.3)
46
+ ast (~> 2.4.0)
47
+ pry (0.13.1)
48
+ coderay (~> 1.1)
49
+ method_source (~> 1.0)
50
+ rainbow (3.0.0)
51
+ rake (13.0.1)
52
+ rb-fsevent (0.10.4)
53
+ rb-inotify (0.10.1)
54
+ ffi (~> 1.0)
55
+ regexp_parser (1.7.1)
56
+ rexml (3.2.4)
57
+ rspec (3.9.0)
58
+ rspec-core (~> 3.9.0)
59
+ rspec-expectations (~> 3.9.0)
60
+ rspec-mocks (~> 3.9.0)
61
+ rspec-core (3.9.2)
62
+ rspec-support (~> 3.9.3)
63
+ rspec-expectations (3.9.2)
18
64
  diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.5.0)
20
- rspec-mocks (3.5.0)
65
+ rspec-support (~> 3.9.0)
66
+ rspec-mocks (3.9.1)
21
67
  diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.5.0)
23
- rspec-support (3.5.0)
24
- ruby-graphviz (1.2.2)
68
+ rspec-support (~> 3.9.0)
69
+ rspec-support (3.9.3)
70
+ rubocop (0.85.1)
71
+ parallel (~> 1.10)
72
+ parser (>= 2.7.0.1)
73
+ rainbow (>= 2.2.2, < 4.0)
74
+ regexp_parser (>= 1.7)
75
+ rexml
76
+ rubocop-ast (>= 0.0.3)
77
+ ruby-progressbar (~> 1.7)
78
+ unicode-display_width (>= 1.4.0, < 2.0)
79
+ rubocop-ast (0.0.3)
80
+ parser (>= 2.7.0.1)
81
+ rubocop-rspec (1.40.0)
82
+ rubocop (>= 0.68.1)
83
+ ruby-graphviz (1.2.5)
84
+ rexml
85
+ ruby-progressbar (1.10.1)
86
+ shellany (0.0.1)
87
+ thor (1.0.1)
88
+ unicode-display_width (1.7.0)
25
89
 
26
90
  PLATFORMS
27
91
  ruby
28
92
 
29
93
  DEPENDENCIES
30
- bundler (~> 1.14)
94
+ bundler (~> 2.1.4)
95
+ guard-bundler
96
+ guard-rspec
97
+ guard-rubocop
31
98
  mikado_graph_generator!
32
- rake (~> 10.0)
99
+ rake (~> 13.0)
33
100
  rspec (~> 3.0)
34
- ruby-graphviz
101
+ rubocop (~> 0.52)
102
+ rubocop-rspec (~> 1.21)
103
+ ruby-graphviz (~> 1.2)
35
104
 
36
105
  BUNDLED WITH
37
- 1.14.3
106
+ 2.1.4
@@ -0,0 +1,56 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app processing config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ guard :bundler do
19
+ require "guard/bundler"
20
+ require "guard/bundler/verify"
21
+ helper = Guard::Bundler::Verify.new
22
+
23
+ files = ["Gemfile"]
24
+ files += Dir["*.gemspec"] if files.any? { |f| helper.uses_gemspec?(f) }
25
+
26
+ # Assume files are symlinked from somewhere
27
+ files.each { |file| watch(helper.real_path(file)) }
28
+ end
29
+
30
+ # Note: The cmd option is now required due to the increasing number of ways
31
+ # rspec may be run, below are examples of the most common uses.
32
+ # * bundler: 'bundle exec rspec'
33
+ # * bundler binstubs: 'bin/rspec'
34
+ # * spring: 'bin/rspec' (This will use spring if running and you have
35
+ # installed the spring binstubs per the docs)
36
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
37
+ # * 'just' rspec: 'rspec'
38
+
39
+ guard :rspec, cmd: "bundle exec rspec" do
40
+ require "guard/rspec/dsl"
41
+ dsl = Guard::RSpec::Dsl.new(self)
42
+
43
+ # Feel free to open issues for suggestions and improvements
44
+
45
+ # RSpec files
46
+ rspec = dsl.rspec
47
+ watch(rspec.spec_helper) { rspec.spec_dir }
48
+ watch(rspec.spec_support) { rspec.spec_dir }
49
+ watch(rspec.spec_files)
50
+
51
+ watch(/.+\.rb$/)
52
+ end
53
+
54
+ guard :rubocop, cli: ["-S", "-D"] do
55
+ watch(/.+\.rb$/)
56
+ end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Mikado Graph Generator [![Build Status](https://travis-ci.org/snasirca/mikado_graph_generator.svg?branch=master)](https://travis-ci.org/snasirca/mikado_graph_generator) [![Code Climate](https://codeclimate.com/github/snasirca/mikado_graph_generator/badges/gpa.svg)](https://codeclimate.com/github/snasirca/mikado_graph_generator)
1
+ # Mikado Graph Generator [![Gem Version](https://badge.fury.io/rb/mikado_graph_generator.svg)](https://badge.fury.io/rb/mikado_graph_generator) [![Build Status](https://travis-ci.org/snasirca/mikado-graph-generator.svg?branch=master)](https://travis-ci.org/snasirca/mikado-graph-generator) [![Maintainability](https://api.codeclimate.com/v1/badges/d748f762abb3995c15eb/maintainability)](https://codeclimate.com/github/snasirca/mikado-graph-generator/maintainability)
2
2
 
3
3
  Welcome to a DSL for creating Mikado Graphs using *GraphViz*.
4
4
 
@@ -34,40 +34,72 @@ You can use this gem's DSL in the following way to create a Mikado Graph generat
34
34
  require "mikado_graph"
35
35
 
36
36
  MikadoGraph::Generator.define do
37
- state("State A").depends_on {
38
- state("State B").depends_on {
37
+ state("State A").with_prerequisites do
38
+ state("State B").with_prerequisites do
39
39
  state("State D")
40
40
  state("State E")
41
- }
42
- state("State C").depends_on {
41
+ end
42
+ state("State C").with_prerequisites do
43
43
  state("State F")
44
44
  state("State G")
45
- }
46
- }
47
- end.generate("png", "img/example_usage.png") # generate takes GraphViz format and output path
45
+ end
46
+ end
47
+ end.generate("png", "img/example_usage_vertical.png") # generate takes GraphViz format and output path
48
48
  ```
49
49
 
50
- Save this file to `example_usage.rb` and then you can then execute this file in the terminal using:
50
+ > You can also use the shorthand `with_prereqs` instead of `with_prerequisites` for defining prerequisite
51
+ dependencies between states.
52
+
53
+ Save this file to `example_usage_vertical.rb` and then you can then execute this file in the terminal using:
51
54
 
52
55
  ```bash
53
- ruby example_usage.rb
56
+ ruby example_usage_vertical.rb
54
57
  ```
55
58
 
56
- This will utilize the *GraphViz* `dot` command to create this PNG output of the above Mikado Graph generator definition:
59
+ This will utilize *GraphViz* to create this PNG output of the above Mikado Graph generator definition:
57
60
 
58
- ![Multi-Level Mikado Graph](https://github.com/snasirca/mikado_graph_generator/blob/master/img/multi_level_mikado_graph.png)
61
+ ![Example Usage Vertical](img/example_usage_vertical.png)
59
62
 
60
63
  NOTE: If you don't provide any parameters to `generate`, it'll default to a `dot` output in the STDOUT.
61
64
 
65
+ If you want to instead do a horizontal orientation of your graph, simply provide the direction flag to `#generate` like so:
66
+
67
+ ```ruby
68
+ generate(direction: :horizontal)
69
+ ```
70
+
71
+ Here is an example usage:
72
+
73
+ ```ruby
74
+ require "mikado_graph"
75
+
76
+ MikadoGraph::Generator.define do
77
+ state("State A").with_prerequisites do
78
+ state("State B").with_prerequisites do
79
+ state("State D")
80
+ state("State E")
81
+ end
82
+ state("State C").with_prerequisites do
83
+ state("State F")
84
+ state("State G")
85
+ end
86
+ end
87
+ end.generate(format: "png", path: "img/example_usage_horizontal.png", direction: :horizontal)
88
+ ```
89
+
90
+ This will generate this graph:
91
+
92
+ ![Example Usage Horizontal](img/example_usage_horizontal.png)
93
+
62
94
  ## Development
63
95
 
64
96
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
65
97
 
66
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
98
+ Use `direnv` to speed development.
67
99
 
68
100
  ## Contributing
69
101
 
70
- Bug reports and pull requests are welcome on GitHub at https://github.com/snasirca/mikado_graph_generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
102
+ Bug reports and pull requests are welcome on GitHub at https://github.com/snasirca/mikado-graph-generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
71
103
 
72
104
  ## License
73
105
 
data/Rakefile CHANGED
@@ -3,4 +3,5 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
7
+ # task sync_rubocop
@@ -0,0 +1,14 @@
1
+ require "mikado_graph"
2
+
3
+ MikadoGraph::Generator.define do
4
+ state("State A").with_prerequisites do
5
+ state("State B").with_prerequisites do
6
+ state("State D")
7
+ state("State E")
8
+ end
9
+ state("State C").with_prerequisites do
10
+ state("State F")
11
+ state("State G")
12
+ end
13
+ end
14
+ end.generate(format: "png", path: "img/example_usage_horizontal.png", direction: :horizontal)
@@ -0,0 +1,14 @@
1
+ require "mikado_graph"
2
+
3
+ MikadoGraph::Generator.define do
4
+ state("State A").with_prerequisites do
5
+ state("State B").with_prerequisites do
6
+ state("State D")
7
+ state("State E")
8
+ end
9
+ state("State C").with_prerequisites do
10
+ state("State F")
11
+ state("State G")
12
+ end
13
+ end
14
+ end.generate(format: "png", path: "img/example_usage_vertical.png")
@@ -1,7 +1,7 @@
1
1
  require "mikado_graph/version"
2
2
 
3
3
  require "mikado_graph/state"
4
- require "mikado_graph/dependencies"
4
+ require "mikado_graph/prerequisites"
5
5
  require "mikado_graph/generator"
6
6
 
7
7
  module MikadoGraph
@@ -2,49 +2,59 @@ require "graphviz"
2
2
 
3
3
  module MikadoGraph
4
4
  class Generator
5
- attr_reader :dependencies, :graph
5
+ attr_reader :prerequisites, :graph
6
6
 
7
7
  def self.define(&block)
8
8
  generator_instance = new
9
- generator_instance.dependencies.instance_eval(&block)
9
+ generator_instance.prerequisites.instance_eval(&block)
10
10
  generator_instance
11
11
  end
12
12
 
13
- def generate(format = "dot", path = nil)
14
- add_states_to_graph(dependencies.dependent_states)
15
- output_options = {}
16
- output_options[format] = path
13
+ def generate(options = {})
14
+ add_states_to_graph(prerequisites.states)
15
+ arrange_graph_direction(options)
16
+ output_options = build_output_options(options)
17
17
  graph.output(output_options)
18
18
  end
19
19
 
20
20
  private
21
21
 
22
22
  def initialize
23
- @dependencies = Dependencies.new
23
+ @prerequisites = Prerequisites.new
24
24
  initialize_graph
25
25
  end
26
26
 
27
27
  def initialize_graph
28
28
  @graph = GraphViz.new(nil)
29
- @graph[:rankdir] = "LR"
30
29
  @graph.node[:shape] = "box"
31
30
  end
32
31
 
33
32
  def add_states_to_graph(states)
34
- states.each { |state| add_state_dependencies(state) }
33
+ states.each { |state| add_state_prerequisites(state) }
35
34
  end
36
35
 
37
- def add_state_dependencies(state)
38
- state.dependent_states.each do |dependent_state|
39
- add_dependency(state, dependent_state)
40
- add_state_dependencies(dependent_state)
36
+ def add_state_prerequisites(state)
37
+ state.prerequisite_states.each do |prerequisite_state|
38
+ add_prerequisite_dependency(state, prerequisite_state)
39
+ add_state_prerequisites(prerequisite_state)
41
40
  end
42
41
  end
43
42
 
44
- def add_dependency(state, dependent_state)
43
+ def add_prerequisite_dependency(state, dependent_state)
45
44
  state_node = graph.add_nodes(state.name)
46
45
  dependent_state_node = graph.add_nodes(dependent_state.name)
47
- graph.add_edges(dependent_state_node, state_node)
46
+ graph.add_edges(state_node, dependent_state_node)
47
+ end
48
+
49
+ def arrange_graph_direction(options)
50
+ direction = options.fetch(:direction, :vertical)
51
+ graph[:rankdir] = "LR" if direction == :horizontal
52
+ end
53
+
54
+ def build_output_options(options)
55
+ output_options = {}
56
+ output_options[options.fetch(:format, "dot")] = options.fetch(:path, nil)
57
+ output_options
48
58
  end
49
59
  end
50
60
  end
@@ -1,14 +1,14 @@
1
1
  module MikadoGraph
2
- class Dependencies
3
- attr_reader :dependent_states
2
+ class Prerequisites
3
+ attr_reader :states
4
4
 
5
5
  def initialize
6
- @dependent_states = []
6
+ @states = []
7
7
  end
8
8
 
9
9
  def state(state_name)
10
10
  new_state = State.new(state_name)
11
- dependent_states << new_state
11
+ states << new_state
12
12
  new_state
13
13
  end
14
14
  end
@@ -1,20 +1,18 @@
1
1
  module MikadoGraph
2
2
  class State
3
- attr_reader :name
3
+ attr_reader :name, :prerequisite_states
4
4
 
5
5
  def initialize(name)
6
6
  @name = name
7
+ @prerequisite_states = []
7
8
  end
8
9
 
9
- def depends_on(&block)
10
- dependencies = Dependencies.new
11
- dependencies.instance_eval(&block)
12
- @dependent_states = dependencies.dependent_states
13
- end
14
-
15
- def dependent_states
16
- @dependent_states || []
10
+ def with_prerequisites(&block)
11
+ prerequisites = Prerequisites.new
12
+ prerequisites.instance_eval(&block)
13
+ @prerequisite_states = prerequisites.states
17
14
  end
15
+ alias with_prereqs with_prerequisites
18
16
 
19
17
  def to_s
20
18
  name
@@ -1,3 +1,3 @@
1
1
  module MikadoGraph
2
- VERSION = "0.2.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -1,26 +1,31 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
2
+
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "mikado_graph/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "mikado_graph_generator"
8
- spec.version = MikadoGraph::VERSION
9
- spec.authors = ["Shahriyar Nasir"]
10
- spec.email = ["contact@snasir.ca"]
7
+ spec.name = "mikado_graph_generator"
8
+ spec.version = MikadoGraph::VERSION
9
+ spec.authors = ["Shahriyar Nasir"]
10
+ spec.email = ["contact@snasir.ca"]
11
11
 
12
- spec.summary = "Mikado Graph generator"
13
- spec.description = "Provides a simple DSL for generating Mikado Graphs using GraphViz."
14
- spec.homepage = "https://github.com/snasirca/mikado_graph_generator"
15
- spec.license = "MIT"
12
+ spec.summary = "Mikado Graph generator"
13
+ spec.description = "Provides a simple DSL for generating Mikado Graphs using GraphViz."
14
+ spec.homepage = "https://github.com/snasirca/mikado_graph_generator"
15
+ spec.license = "MIT"
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
18
  f.match(%r{^(test|spec|features)/})
19
19
  end
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.14"
23
- spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "bundler", "~> 2.1.4"
23
+ spec.add_development_dependency "guard-bundler"
24
+ spec.add_development_dependency "guard-rspec"
25
+ spec.add_development_dependency "guard-rubocop"
26
+ spec.add_development_dependency "rake", "~> 13.0"
24
27
  spec.add_development_dependency "rspec", "~> 3.0"
25
- spec.add_development_dependency "ruby-graphviz"
28
+ spec.add_development_dependency "rubocop", "~> 0.52"
29
+ spec.add_development_dependency "rubocop-rspec", "~> 1.21"
30
+ spec.add_development_dependency "ruby-graphviz", "~> 1.2"
26
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mikado_graph_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shahriyar Nasir
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-02 00:00:00.000000000 Z
11
+ date: 2020-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: 2.1.4
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: 2.1.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard-bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard-rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: rake
29
71
  requirement: !ruby/object:Gem::Requirement
30
72
  requirements:
31
73
  - - "~>"
32
74
  - !ruby/object:Gem::Version
33
- version: '10.0'
75
+ version: '13.0'
34
76
  type: :development
35
77
  prerelease: false
36
78
  version_requirements: !ruby/object:Gem::Requirement
37
79
  requirements:
38
80
  - - "~>"
39
81
  - !ruby/object:Gem::Version
40
- version: '10.0'
82
+ version: '13.0'
41
83
  - !ruby/object:Gem::Dependency
42
84
  name: rspec
43
85
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +94,48 @@ dependencies:
52
94
  - - "~>"
53
95
  - !ruby/object:Gem::Version
54
96
  version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.52'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.52'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.21'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.21'
55
125
  - !ruby/object:Gem::Dependency
56
126
  name: ruby-graphviz
57
127
  requirement: !ruby/object:Gem::Requirement
58
128
  requirements:
59
- - - ">="
129
+ - - "~>"
60
130
  - !ruby/object:Gem::Version
61
- version: '0'
131
+ version: '1.2'
62
132
  type: :development
63
133
  prerelease: false
64
134
  version_requirements: !ruby/object:Gem::Requirement
65
135
  requirements:
66
- - - ">="
136
+ - - "~>"
67
137
  - !ruby/object:Gem::Version
68
- version: '0'
138
+ version: '1.2'
69
139
  description: Provides a simple DSL for generating Mikado Graphs using GraphViz.
70
140
  email:
71
141
  - contact@snasir.ca
@@ -74,20 +144,31 @@ extensions: []
74
144
  extra_rdoc_files: []
75
145
  files:
76
146
  - ".editorconfig"
147
+ - ".envrc"
148
+ - ".envrc.sample"
77
149
  - ".gitignore"
78
150
  - ".rspec"
151
+ - ".rubocop"
152
+ - ".rubocop.disabled.yml"
153
+ - ".rubocop.enabled.yml"
154
+ - ".rubocop.yml"
155
+ - ".ruby-version"
79
156
  - ".travis.yml"
80
157
  - Gemfile
81
158
  - Gemfile.lock
159
+ - Guardfile
82
160
  - LICENSE.txt
83
161
  - README.md
84
162
  - Rakefile
85
163
  - bin/console
86
164
  - bin/setup
87
- - example_usage.rb
165
+ - example_usage_horizontal.rb
166
+ - example_usage_vertical.rb
167
+ - img/example_usage_horizontal.png
168
+ - img/example_usage_vertical.png
88
169
  - lib/mikado_graph.rb
89
- - lib/mikado_graph/dependencies.rb
90
170
  - lib/mikado_graph/generator.rb
171
+ - lib/mikado_graph/prerequisites.rb
91
172
  - lib/mikado_graph/state.rb
92
173
  - lib/mikado_graph/version.rb
93
174
  - mikado_graph.gemspec
@@ -95,7 +176,7 @@ homepage: https://github.com/snasirca/mikado_graph_generator
95
176
  licenses:
96
177
  - MIT
97
178
  metadata: {}
98
- post_install_message:
179
+ post_install_message:
99
180
  rdoc_options: []
100
181
  require_paths:
101
182
  - lib
@@ -110,9 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
191
  - !ruby/object:Gem::Version
111
192
  version: '0'
112
193
  requirements: []
113
- rubyforge_project:
114
- rubygems_version: 2.6.10
115
- signing_key:
194
+ rubygems_version: 3.1.2
195
+ signing_key:
116
196
  specification_version: 4
117
197
  summary: Mikado Graph generator
118
198
  test_files: []
@@ -1,14 +0,0 @@
1
- require "mikado_graph"
2
-
3
- MikadoGraph::Generator.define do
4
- state("State A").depends_on {
5
- state("State B").depends_on {
6
- state("State D")
7
- state("State E")
8
- }
9
- state("State C").depends_on {
10
- state("State F")
11
- state("State G")
12
- }
13
- }
14
- end.generate("png", "img/example_usage.png")