Class: Guard::Bundler::Verify

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/bundler/verify.rb

Constant Summary collapse

"  Error: Guard will not detect changes to your Gemfile!\n\n  Solution: move the Gemfile to a watched directory and symlink it back.\n\n  Example:\n\n    $ mkdir config\n    $ git mv Gemfile config # use just 'mv' if this doesn't work\n    $ ln -s config/Gemfile .\n\n  and add config to the `directories` statement in your Guardfile.\n\n  (See: https://github.com/guard/guard/wiki/Optimizing-for-large-projects)\n"

Instance Method Summary collapse

Instance Method Details

#real_path(file) ⇒ Object



44
45
46
47
# File 'lib/guard/bundler/verify.rb', line 44

def real_path(file)
  verify!(file)
  Pathname.new(file).realpath.relative_path_from(Pathname.pwd).to_s
end

#uses_gemspec?(file) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/guard/bundler/verify.rb', line 49

def uses_gemspec?(file)
  IO.read(file).lines.map(&:strip).grep(/^gemspec$/).any?
end

#verify!(file) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/guard/bundler/verify.rb', line 34

def verify!(file)
  watchdirs = Guard::Compat.watched_directories

  gemfile = Pathname.new(file)
  config_dir = gemfile.realpath.dirname
  return if watchdirs.include?(config_dir)

  Compat::UI.error SYMLINK_NEEDED
end