Remove last vestiges of Ruby 1.8.7 support · githubFeature/overcommit@a50653b · GitHub
Skip to content

Commit a50653b

Browse files
committed
Remove last vestiges of Ruby 1.8.7 support
We dropped support for Ruby 1.8.7 in Overcommit 0.14.0, but didn't get around to updating the codebase to use Ruby 1.9 hashes and other such style changes. Change-Id: I9e86d4b2094a8bcb9a26b8e0863836bdda34be62 Reviewed-on: http://gerrit.causes.com/45275 Tested-by: jenkins <jenkins@brigade.com> Reviewed-by: Shane da Silva <shane.dasilva@brigade.com>
1 parent 99154c8 commit a50653b

13 files changed

Lines changed: 25 additions & 42 deletions

File tree

.rubocop.yml

Lines changed: 2 additions & 13 deletions

lib/overcommit/configuration_validator.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ def ensure_hook_type_sections_exist(hash)
2626
# together, since it's easier to merge two hashes than to have to check if
2727
# one of the values is nil.
2828
def convert_nils_to_empty_hashes(hash)
29-
hash.inject({}) do |h, (key, value)|
29+
hash.each_with_object({}) do |(key, value), h|
3030
h[key] =
3131
case value
3232
when nil then {}
3333
when Hash then convert_nils_to_empty_hashes(value)
3434
else
3535
value
3636
end
37-
h
3837
end
3938
end
4039
end

lib/overcommit/hook/pre_commit/image_optim.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def run
2828
private
2929

3030
def optimize_images(image_paths)
31-
image_optim = ::ImageOptim.new(:skip_missing_workers => true)
31+
image_optim = ::ImageOptim.new(skip_missing_workers: true)
3232

3333
optimized_images =
3434
image_optim.optimize_images(image_paths) do |path, optimized|

lib/overcommit/hook_context/pre_commit.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def cleanup_environment
6464
# Get a list of added, copied, or modified files that have been staged.
6565
# Renames and deletions are ignored, since there should be nothing to check.
6666
def modified_files
67-
@modified_files ||= Overcommit::GitRepo.modified_files(:staged => true)
67+
@modified_files ||= Overcommit::GitRepo.modified_files(staged: true)
6868
end
6969

7070
# @deprecated
@@ -79,7 +79,7 @@ def modified_lines(file)
7979
def modified_lines_in_file(file)
8080
@modified_lines ||= {}
8181
@modified_lines[file] ||=
82-
Overcommit::GitRepo.extract_modified_lines(file, :staged => true)
82+
Overcommit::GitRepo.extract_modified_lines(file, staged: true)
8383
end
8484

8585
private

spec/integration/committing_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
repo do
1919
File.open('.overcommit.yml', 'w') { |f| f.write(config) }
2020
Overcommit::Installer.new(Overcommit::Logger.silent).
21-
run('.', :action => :install)
21+
run('.', action: :install)
2222
example.run
2323
end
2424
end
@@ -61,7 +61,7 @@
6161
around do |example|
6262
repo do
6363
Overcommit::Installer.new(Overcommit::Logger.silent).
64-
run('.', :action => :install)
64+
run('.', action: :install)
6565
File.open('.overcommit.yml', 'w') { |f| f.write(config) }
6666
File.open('test.txt', 'w') { |f| f.write(file_contents) }
6767
`git add test.txt`

spec/integration/disable_overcommit_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
around do |example|
77
repo do
88
Overcommit::Installer.new(Overcommit::Logger.silent).
9-
run('.', :action => :install)
9+
run('.', action: :install)
1010
Overcommit::Utils.with_environment('OVERCOMMIT_DISABLE' => overcommit_disable) do
1111
`touch blah`
1212
`git add blah`

spec/integration/installing_overcommit_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe 'installing Overcommit' do
44
context 'when template directory points to the Overcommit template directory' do
55
around do |example|
6-
repo(:template_dir => Overcommit::Installer::TEMPLATE_DIRECTORY) do
6+
repo(template_dir: Overcommit::Installer::TEMPLATE_DIRECTORY) do
77
example.run
88
end
99
end

spec/integration/resolving_merge_conflict_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
`git merge branch1`
3131
`git merge branch2` # Results in merge conflict
3232
Overcommit::Installer.new(Overcommit::Logger.silent).
33-
run('.', :action => :install)
33+
run('.', action: :install)
3434
`echo "Conflicts Resolved" > some-file`
3535
`git add some-file`
3636
example.run

spec/overcommit/cli_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Overcommit::Installer.any_instance.
2020
should_receive(:run).
2121
with('current-dir',
22-
hash_including(:action => :install))
22+
hash_including(action: :install))
2323
subject
2424
end
2525
end
@@ -45,7 +45,7 @@
4545
Overcommit::Installer.any_instance.
4646
should_receive(:run).
4747
with('current-dir',
48-
hash_including(:action => :uninstall))
48+
hash_including(action: :uninstall))
4949
subject
5050
end
5151

@@ -56,7 +56,7 @@
5656
Overcommit::Installer.any_instance.
5757
should_receive(:run).
5858
with('target-dir',
59-
hash_including(:action => :uninstall))
59+
hash_including(action: :uninstall))
6060
subject
6161
end
6262
end
@@ -69,7 +69,7 @@
6969
Overcommit::Installer.any_instance.
7070
should_receive(:run).
7171
with('current-dir',
72-
hash_including(:action => :install))
72+
hash_including(action: :install))
7373
subject
7474
end
7575

@@ -80,7 +80,7 @@
8080
Overcommit::Installer.any_instance.
8181
should_receive(:run).
8282
with('target-dir',
83-
hash_including(:action => :install))
83+
hash_including(action: :install))
8484
subject
8585
end
8686
end

spec/overcommit/configuration_spec.rb

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)