eefgilm 1.1.2 → 1.2.0

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: 0be33a97de8785b7ed0d5b96a0628319ae8c499b
4
- data.tar.gz: e577abb477ded83e8c0728ea61a6e4fdc8482123
3
+ metadata.gz: dea236f60c15b0d31886ee8ed1748ce45ae2c6f6
4
+ data.tar.gz: b3c533a459503b0ea581a3edb91e5bd714c0b1ab
5
5
  SHA512:
6
- metadata.gz: e8c0a19209fe06d5a970931de68e7d8f0af2248d76f498535f3ee8dbef3ebeca93dd5fb8bd2edfc9aedbb795ee6c73e0bac3692e1f5bb1eab09ad4703f0832d9
7
- data.tar.gz: 2ee5a10e3f3d9046857296dd62b36ff3ec18b0fd6c98a7167528d0e969769d54e6544f8be872d722e809e8a94ba5012c8cc498f07f413ea12a511379bdb3eab8
6
+ metadata.gz: af0e0241a7cd8998f97b25df18fb67ab1795319573970373f2efb9e276d9e5129199492892027b1d41dad727e63db335c9aea1344d4f731132b969f4d9431cc1
7
+ data.tar.gz: 882cdd72937a7cd6f9beab52e9972b4d55b2eb75b94fb9bbeed662cdd98e243ac60e66039b3485acfc04da95a98d2c1726b2882bfba6795d0c15060ae98bab13
data/Gemfile CHANGED
@@ -1,6 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
-
4
- gem 'pry'
5
- gem 'pry-nav'
6
3
  gemspec
data/README.md CHANGED
@@ -39,14 +39,6 @@ and then run
39
39
 
40
40
  bundle install
41
41
 
42
- ---
43
-
44
- ## Demo
45
-
46
- A gif of 2 versions of Gemfile i.e before using the gem and after using the gem.
47
-
48
- ![Banner](http://i1248.photobucket.com/albums/hh483/jainrishi15/before-after-1_zps1b477ded.gif)
49
-
50
42
  ---
51
43
  ## Usage
52
44
 
@@ -59,6 +51,15 @@ Currently it will not ask you for any confirmation before making modifications,
59
51
  cp Gemfile Gemfilebackup
60
52
 
61
53
  ---
54
+
55
+ ## Demo
56
+
57
+ A gif showing a gemfile before and after running Eefgilm.
58
+
59
+ ![Banner](http://zippy.gfycat.com/DeliriousInsidiousHumpbackwhale.gif)
60
+
61
+ ---
62
+
62
63
  ## Contributing
63
64
  We welcome contributions! If you want to help out you have many options:
64
65
 
data/Rakefile CHANGED
@@ -1,10 +1,9 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
 
4
4
  task default: 'test'
5
5
 
6
6
  Rake::TestTask.new do |t|
7
- t.libs << "test"
8
- t.pattern = "test/**/*_test.rb"
7
+ t.libs << 'test'
8
+ t.pattern = 'test/**/*_test.rb'
9
9
  end
10
-
data/eefgilm.gemspec CHANGED
@@ -4,21 +4,21 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'eefgilm/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "eefgilm"
7
+ spec.name = 'eefgilm'
8
8
  spec.version = Eefgilm::VERSION
9
- spec.authors = ["Erik Nilsen", "Marco Lindsay"]
10
- spec.email = ["enilsen16@live.com", "lindsay_marco@hotmail.com"]
11
- spec.summary = %q{A gem to keep your Gemfile in best practice .}
12
- spec.description = %q{Eefgilm is a gem that is written to help keep your gemfile in order. It will alphabetize your gems, remove comments, and remove unnecessary whitespace. }
13
- spec.homepage = "http://enilsen16.github.io/Eefgilm/"
14
- spec.license = "MIT"
9
+ spec.authors = ['Erik Nilsen', 'Marco Lindsay']
10
+ spec.email = ['enilsen16@live.com', 'lindsay_marco@hotmail.com']
11
+ spec.summary = 'A gem to keep your Gemfile in best practice .'
12
+ spec.description = 'Eefgilm is a gem that is written to help keep your gemfile in order. It will alphabetize your gems, remove comments, and remove unnecessary whitespace.'
13
+ spec.homepage = 'http://enilsen16.github.io/Eefgilm/'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency "minitest"
22
- spec.add_development_dependency "bundler", "~> 1.6"
23
- spec.add_development_dependency "rake"
21
+ spec.add_development_dependency 'minitest'
22
+ spec.add_development_dependency 'bundler', '~> 1.6'
23
+ spec.add_development_dependency 'rake'
24
24
  end
data/lib/eefgilm.rb CHANGED
@@ -1,7 +1,5 @@
1
- require "eefgilm/version"
2
- require "eefgilm/gemfile"
1
+ require 'eefgilm/version'
2
+ require 'eefgilm/gemfile'
3
3
 
4
4
  module Eefgilm
5
-
6
5
  end
7
-
@@ -2,13 +2,13 @@ module Eefgilm
2
2
  class Gemfile
3
3
  attr_accessor :path, :source, :groups, :rubyversion
4
4
 
5
- def initialize(path = ".", options = {})
6
- @path = path
7
- @groups ={}
5
+ def initialize(path = '.', options = {})
6
+ @path = path
7
+ @groups = {}
8
8
  @options = {
9
- :alphabetize => true,
10
- :delete_whitespace => true,
11
- :delete_comments => true
9
+ alphabetize: true,
10
+ delete_whitespace: true,
11
+ delete_comments: true
12
12
  }.merge(options)
13
13
  end
14
14
 
@@ -29,14 +29,14 @@ module Eefgilm
29
29
  private
30
30
 
31
31
  def extract_to_array_of_lines
32
- gemfile = File.open("#{@path}/Gemfile", "r+")
32
+ gemfile = File.open("#{@path}/Gemfile", 'r+')
33
33
  group_block = :all
34
34
  file_lines = gemfile.readlines
35
35
 
36
36
  file_lines.each do |line|
37
37
  self.source = line if line.match(/^source/)
38
38
 
39
- if self.source == "source 'http://rubygems.org'\n"
39
+ if source == "source 'http://rubygems.org'\n"
40
40
  self.source = "source 'https://rubygems.org'\n"
41
41
  end
42
42
 
@@ -49,10 +49,10 @@ module Eefgilm
49
49
  end
50
50
 
51
51
  if line.match(/^\s*gem/)
52
- if self.groups[group_block].nil?
53
- self.groups[group_block] = [line]
52
+ if groups[group_block].nil?
53
+ groups[group_block] = [line]
54
54
  else
55
- self.groups[group_block] << line
55
+ groups[group_block] << line
56
56
  end
57
57
  end
58
58
  end
@@ -61,7 +61,7 @@ module Eefgilm
61
61
  def change_double_qoutes_to_single
62
62
  @groups.each do |group, gems|
63
63
  @groups[group] = gems.map do |g|
64
- g.gsub('"',"'")
64
+ g.tr("\"", "'")
65
65
  end
66
66
  end
67
67
  end
@@ -69,13 +69,13 @@ module Eefgilm
69
69
  def delete_comments!
70
70
  @groups.each do |group, gems|
71
71
  @groups[group] = gems.map do |g|
72
- g.gsub(/#(.*)$/, "")
72
+ g.gsub(/#(.*)$/, '')
73
73
  end
74
74
  end
75
75
  end
76
76
 
77
77
  def recreate_file
78
- output = File.open( "#{@path}/Gemfile", "w+" )
78
+ output = File.open("#{@path}/Gemfile", 'w+')
79
79
  output.puts [@source, @rubyversion].compact
80
80
  output.puts
81
81
 
@@ -91,7 +91,7 @@ module Eefgilm
91
91
  gems.each do |g|
92
92
  output.puts " #{g}"
93
93
  end
94
- output.puts "end"
94
+ output.puts 'end'
95
95
  end
96
96
  end
97
97
 
@@ -107,7 +107,7 @@ module Eefgilm
107
107
  def delete_whitespace!
108
108
  @groups.each do |group, gems|
109
109
  @groups[group] = gems.map do |g|
110
- g.gsub(/(?<=^|\[)\s+|\s+(?=$|\])|(?<=\s)\s+/, "")
110
+ g.gsub(/(?<=^|\[)\s+|\s+(?=$|\])|(?<=\s)\s+/, '')
111
111
  end
112
112
  end
113
113
  end
@@ -1,3 +1,3 @@
1
1
  module Eefgilm
2
- VERSION = "1.1.2"
2
+ VERSION = '1.2.0'
3
3
  end
@@ -1,26 +1,26 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
- describe "Gemfile" do
4
- it "will raise an exception if methods are called without a specified Gemfile" do
5
- gemfile = Eefgilm::Gemfile.new("../data/sources/")
3
+ describe 'Gemfile' do
4
+ it 'will raise an exception if methods are called without a specified Gemfile' do
5
+ gemfile = Eefgilm::Gemfile.new('../data/sources/')
6
6
  proc { gemfile.clean! }.must_raise(Errno::ENOENT)
7
7
  end
8
8
 
9
- describe "Comment Proccessing" do
9
+ describe 'Comment Proccessing' do
10
10
  before do
11
- @file = "test/data/sources/dummy/Gemfile"
12
- @file2 = "test/data/sources/expected/Gemfile"
13
- FileUtils.copy "test/data/sources/original/groupgems", @file2
14
- FileUtils.copy "test/data/sources/original/railsgem", @file
15
- @worker = Eefgilm::Gemfile.new("test/data/sources/dummy")
16
- @worker2 = Eefgilm::Gemfile.new("test/data/sources/expected")
11
+ @file = 'test/data/sources/dummy/Gemfile'
12
+ @file2 = 'test/data/sources/expected/Gemfile'
13
+ FileUtils.copy 'test/data/sources/original/groupgems', @file2
14
+ FileUtils.copy 'test/data/sources/original/railsgem', @file
15
+ @worker = Eefgilm::Gemfile.new('test/data/sources/dummy')
16
+ @worker2 = Eefgilm::Gemfile.new('test/data/sources/expected')
17
17
  end
18
18
 
19
- it "must remove a files comments" do
20
- @worker.clean!.wont_match /.../
19
+ it 'must remove a files comments' do
20
+ @worker.clean!.wont_match(/.../)
21
21
  end
22
22
 
23
- it "should remove unnecessary whitespace" do
23
+ it 'should remove unnecessary whitespace' do
24
24
  regex = /(?<=^|\[)\s+|(?<=\s)\s+/
25
25
  count = 0
26
26
  @worker.clean!
@@ -30,12 +30,12 @@ describe "Gemfile" do
30
30
  count.must_equal 9
31
31
  end
32
32
 
33
- it "should alphabetize groups" do
33
+ it 'should alphabetize groups' do
34
34
  @worker.clean!
35
35
  @worker.groups[:all].must_equal @worker.groups[:all].sort
36
36
  end
37
37
 
38
- it "should keep the ruby version" do
38
+ it 'should keep the ruby version' do
39
39
  @worker.clean!
40
40
  @worker.rubyversion.must_include 'ruby "2.0.0"'
41
41
  end
@@ -45,7 +45,7 @@ describe "Gemfile" do
45
45
  @worker.source.must_include 'https://rubygems.org'
46
46
  end
47
47
 
48
- it "without a specified ruby version, it should not have an extra line" do
48
+ it 'without a specified ruby version, it should not have an extra line' do
49
49
  regex = /^[\s]*$\n/
50
50
  count = 0
51
51
  @worker2.clean!
data/test/test_helper.rb CHANGED
@@ -1,2 +1,2 @@
1
- require "minitest/autorun"
2
- require "eefgilm"
1
+ require 'minitest/autorun'
2
+ require 'eefgilm'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eefgilm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Nilsen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-29 00:00:00.000000000 Z
12
+ date: 2015-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -53,8 +53,8 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
- description: 'Eefgilm is a gem that is written to help keep your gemfile in order.
57
- It will alphabetize your gems, remove comments, and remove unnecessary whitespace. '
56
+ description: Eefgilm is a gem that is written to help keep your gemfile in order.
57
+ It will alphabetize your gems, remove comments, and remove unnecessary whitespace.
58
58
  email:
59
59
  - enilsen16@live.com
60
60
  - lindsay_marco@hotmail.com
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.2.2
102
+ rubygems_version: 2.4.5.1
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: A gem to keep your Gemfile in best practice .