drg 0.14.2 → 0.14.3

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: 8d468fed79634c64ab7a1c56229ddd1df6468e1f
4
- data.tar.gz: c9f6cdd369cd401d801a0746fb296d2bfc950f1d
3
+ metadata.gz: bcfba0400c2db2e1a03310eb1283a46eee235f8c
4
+ data.tar.gz: c5ebe017de7b5ad902e8f572f0d5d271566f34c0
5
5
  SHA512:
6
- metadata.gz: 79a33b930a524ab07ff9f1b8661d7b01619b09b3c27fc0cb4d56e221407da0573d53524847d278458560c0299a20637a1886ad170a173d17ac3a394777ff21b6
7
- data.tar.gz: 12c488067864048c692f293b4da7384928a9a01396e4443c8cffdde013c0d087b3b288ece80c036cd18558e009d6fce7d2c77671f25c8b1f9434ca4e03e0886c
6
+ metadata.gz: 0ebc05ba36eae6d52d2cf9a17ab063ebb639ca324f5890435adedc198d30d10912a61bebe55f399ad7c1282795d091b66a468b06b27575ee821ea341cb2607f5
7
+ data.tar.gz: 3017a31f9100ec3eb7eb69f81c12349b2b220ff413bfc8097935dbad38787d0395af11b5fdbda6e6d071503ed50a4782f8ddc59daaa445829b17154f3fbad025
@@ -29,6 +29,11 @@ class DRG::Ruby::Condition
29
29
  def translate(txt)
30
30
  txt.sub! /^return\s*/, 'returns '
31
31
  txt.sub! /^returns\s*$/, 'returns nil'
32
+ if txt.split(/\s/).length == 1
33
+ txt = "returns #{txt}"
34
+ elsif txt.include?(' = ')
35
+ txt = "assigns #{txt}"
36
+ end
32
37
  txt.strip
33
38
  end
34
39
 
data/lib/drg/spec.rb CHANGED
@@ -80,6 +80,9 @@ class DRG::Spec < DelegateClass(DRG::Ruby::Const)
80
80
  phrase.sub! /^not if /, 'unless '
81
81
  phrase.sub! /^if not /, 'unless '
82
82
  phrase.sub! %r"then$", ''
83
+ if phrase !~ /^(when|unless|not)/
84
+ phrase = "when #{phrase}"
85
+ end
83
86
  phrase
84
87
  end
85
88
  end
@@ -17,7 +17,10 @@ module DRG
17
17
  ruby_files.each do |ruby_file|
18
18
  file_path = Pathname.new(File.expand_path(ruby_file))
19
19
  spec = DRG::Spec.generate(file_path)
20
- next unless spec
20
+ unless spec
21
+ log "Skipping #{file_path}: no methods found"
22
+ next
23
+ end
21
24
  rspec_file = Pathname.new(spec_file(ruby_file))
22
25
  log "Generating #{rspec_file}"
23
26
  FileUtils.mkdir_p(rspec_file.parent)
data/lib/drg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DRG
2
- VERSION = '0.14.2'.freeze
2
+ VERSION = '0.14.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Buckley