Skip to content

Commit

Permalink
bump guard-compat dep to 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
e2 committed Dec 7, 2014
1 parent d7ecbcb commit da95c5e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion guard-bundler.gemspec
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 1.9.2'

s.add_dependency 'guard', '~> 2.2'
s.add_dependency 'guard-compat', '~> 0.2'
s.add_dependency 'guard-compat', '~> 1.0'
s.add_dependency 'bundler', '~> 1.0'

s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.md]
Expand Down
10 changes: 5 additions & 5 deletions lib/guard/bundler.rb
Expand Up @@ -39,15 +39,15 @@ def refresh_bundle
duration = Time.now - start_at
case result
when :bundle_already_up_to_date
::Guard::UI.info 'Bundle already up-to-date', reset: true
Guard::Compat::UI.info 'Bundle already up-to-date', reset: true
when :bundle_installed_using_local_gems
::Guard::UI.info 'Bundle installed using local gems', reset: true
Guard::Compat::UI.info 'Bundle installed using local gems', reset: true
Notifier.notify 'bundle_check_install', nil
when :bundle_installed
::Guard::UI.info 'Bundle installed', reset: true
Guard::Compat::UI.info 'Bundle installed', reset: true
Notifier.notify true, duration
else
::Guard::UI.info "Bundle can't be installed -- Please check manually", reset: true
Guard::Compat::UI.info "Bundle can't be installed -- Please check manually", reset: true
Notifier.notify false, nil
end
result
Expand All @@ -67,7 +67,7 @@ def bundle_check
end

def bundle_install
::Guard::UI.info 'Bundling...', reset: true
Guard::Compat::UI.info 'Bundling...', reset: true
::Bundler.with_clean_env do
system("bundle install#{" #{options[:cli]}" if options[:cli]}")
end
Expand Down
8 changes: 2 additions & 6 deletions lib/guard/bundler/notifier.rb
Expand Up @@ -18,18 +18,14 @@ def self.guard_message(result, duration)

# failed | success
def self.guard_image(result)
icon = if result
:success
else
:failed
end
result ? :success : :failed
end

def self.notify(result, duration)
message = guard_message(result, duration)
image = guard_image(result)

::Guard::Notifier.notify(message, title: 'bundle install', image: image)
Guard::Compat::UI.notify(message, title: 'bundle install', image: image)
end

end
Expand Down
2 changes: 1 addition & 1 deletion spec/guard/bundler/notifier_spec.rb
Expand Up @@ -22,7 +22,7 @@
end

it 'should call Guard::Notifier' do
expect(::Guard::Notifier).to receive(:notify).with(
expect(Guard::Compat::UI).to receive(:notify).with(
"Bundle has been installed\nin 10.1 seconds.",
title: 'bundle install',
image: :success
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Expand Up @@ -35,8 +35,8 @@
Kernel.srand config.seed

config.before(:each) do
allow(Guard::Notifier).to receive(:notify)
allow(Guard::UI).to receive(:info)
allow(Guard::Compat::UI).to receive(:notify)
allow(Guard::Compat::UI).to receive(:info)
@fixture_path = Pathname.new(File.expand_path('../fixtures/', __FILE__))
end
end

0 comments on commit da95c5e

Please sign in to comment.