drg 1.5.1 → 1.5.2

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: 9c57160d7560cae2722f61cdb40bb0805eb929c7
4
- data.tar.gz: 519e48995c57bbfd268d9d8012995738b8b6b329
3
+ metadata.gz: fe5612bbc6b87eaeaf65277c348340bd231deaff
4
+ data.tar.gz: 4f0d9cf837920d0744514599b193722457ef190c
5
5
  SHA512:
6
- metadata.gz: 85bf6b7c9189c415ec71a291dc4a915334c1919f3931aba8dd3c09760f0ad83347095dd9a740aff3dafc112c275e7a39dc093dfc960287f94e1c4030cbb19c05
7
- data.tar.gz: 0f6ab838160fade27659c7ec91fc1c1083cf6be47e3bafcfd387eba77591f03aa6d652bf8b5ed03b550a55fbb6ee600e944d3c87817c392063d979b42fffcea8
6
+ metadata.gz: 0f8b66f4f06e010c7c509d6c96e0d2fdfc15e46d00ff12bc81d2a81a59962fde398cf460dae28e57f620734ec16115e843f51e6420a74afb441e01a2643c52ff
7
+ data.tar.gz: 1001cf194ff92cd3469314d96b1abd3e1d043a788dd97a129f2f1a9a99bcfb1dcd7bda05562a1c41ae08c5c39eeba5185b78a6b69255085679a414b969742f42
@@ -26,7 +26,7 @@ module DRG
26
26
  lines.each_with_index.each do |line, index|
27
27
  next if line =~ /^\s*#/
28
28
  next if line =~ /:?path:?\s*(=>)?\s*/
29
- next if line =~ /:?git(hub)?:?\s*(=>)?\s*/
29
+ next if line =~ /(:git(hub)?)|(git(hub)?:)\s*(=>)?\s*/
30
30
  next if line =~ /@drg\s+(frozen|ignore|skip)/
31
31
  return GemfileLine.new line, index, name if line =~ /gem\s*['"]#{name}["']/
32
32
  end
@@ -18,7 +18,7 @@ module DRG
18
18
  def remove_version
19
19
  swap_version('')
20
20
  end
21
-
21
+ require 'byebug'
22
22
  # @description Replaces the gem version with the given one
23
23
  # @example
24
24
  #
@@ -32,6 +32,7 @@ module DRG
32
32
  def swap_version(full_version)
33
33
  code, *comments = line.split(/#/)
34
34
  parts = code.split(',')
35
+ end_of_line = code.rstrip.end_with?(',') ? ",#{parts.last}" : ''
35
36
  if parts.size == 1
36
37
  parts[0].chomp!
37
38
  parts << " #{full_version}" unless full_version.empty?
@@ -46,15 +47,17 @@ module DRG
46
47
  if index = parts.index(version_parts.first)
47
48
  # replace the current gem version (inside quotes)
48
49
  parts[index].sub! /['"].+['"]/, full_version
49
- # remove white spaces from this item if we're removing the version
50
- parts[index].strip! if full_version.empty?
51
50
  else
52
51
  parts.insert 1, " #{full_version}"
53
52
  end
54
- parts.reject!(&:empty?)
53
+ parts.reject! { |x| x.strip.empty? }
55
54
  end
55
+ space_after_gem = parts.first[/\s+$/].to_s
56
+ space_after_gem = space_after_gem[0, (space_after_gem.size - full_version.size) - 2] if space_after_gem.size > full_version.size
57
+ parts.first.rstrip!
56
58
  line.replace parts.join(',')
57
- line << "#" << comments.join if comments.any?
59
+ line << end_of_line
60
+ line << space_after_gem << "#" << comments.join if comments.any?
58
61
  line << "\n" unless line.end_with?("\n")
59
62
  line
60
63
  end
@@ -1,3 +1,3 @@
1
1
  module DRG
2
- VERSION = '1.5.1'.freeze
2
+ VERSION = '1.5.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Buckley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-29 00:00:00.000000000 Z
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler