Coding standards fixes based off of Rubocop and minor edits to make

logic flow easier to understand.
This commit is contained in:
Jeremy Cook
2015-10-12 14:20:47 -04:00
parent a9a5b81dc5
commit 7632591681
6 changed files with 70 additions and 126 deletions

View File

@@ -14,7 +14,7 @@ module Homesick
def git_version_correct?
info = `git --version`.scan(/(\d+)\.(\d+)\.(\d+)/).flatten.map(&:to_i)
return false unless info.count == 3
current_version = Hash[ [:major, :minor, :patch].zip(info) ]
current_version = Hash[[:major, :minor, :patch].zip(info)]
return true if current_version.eql?(MIN_VERSION)
return true if current_version[:major] > MIN_VERSION[:major]
return true if current_version[:major] == MIN_VERSION[:major] && current_version[:minor] > MIN_VERSION[:minor]
@@ -27,7 +27,7 @@ module Homesick
config ||= {}
destination = config[:destination] || File.basename(repo, '.git')
destination = Pathname.new(destination) unless destination.kind_of?(Pathname)
destination = Pathname.new(destination) unless destination.is_a?(Pathname)
FileUtils.mkdir_p destination.dirname
if destination.directory?
@@ -65,22 +65,22 @@ module Homesick
end
end
def git_submodule_init(config = {})
def git_submodule_init
say_status 'git submodule', 'init', :green
system 'git submodule --quiet init'
end
def git_submodule_update(config = {})
def git_submodule_update
say_status 'git submodule', 'update', :green
system 'git submodule --quiet update --init --recursive >/dev/null 2>&1'
end
def git_pull(config = {})
def git_pull
say_status 'git pull', '', :green
system 'git pull --quiet'
end
def git_push(config = {})
def git_push
say_status 'git push', '', :green
system 'git push'
end
@@ -88,23 +88,23 @@ module Homesick
def git_commit_all(config = {})
say_status 'git commit all', '', :green
if config[:message]
system %Q(git commit -a -m "#{config[:message]}")
system %(git commit -a -m "#{config[:message]}")
else
system 'git commit -v -a'
end
end
def git_add(file, config = {})
def git_add(file)
say_status 'git add file', '', :green
system "git add '#{file}'"
end
def git_status(config = {})
def git_status
say_status 'git status', '', :green
system 'git status'
end
def git_diff(config = {})
def git_diff
say_status 'git diff', '', :green
system 'git diff'
end