Sha256: 89f648d09f5be5e66479e8ab51b3bcab8d6557a98b825c4046324f3402a002b1

Contents?: true

Size: 1.36 KB

Versions: 10

Compression:

Stored size: 1.36 KB

Contents

require 'pathname'

module Guard
  class Bundler < Plugin
    class Verify
      if Gem.win_platform?
        SYMLINK_NEEDED = <<-EOS
  Error: Guard will not detect changes to your Gemfile!

  Solution: move the Gemfile to a watched directory and symlink it, so that
  'Gemfile' is symlinked e.g. to config/Gemfile.

  (See: https://github.com/guard/guard/wiki/Optimizing-for-large-projects)

        EOS
      else
        SYMLINK_NEEDED = <<-EOS
  Error: Guard will not detect changes to your Gemfile!

  Solution: move the Gemfile to a watched directory and symlink it back.

  Example:

    $ mkdir config
    $ git mv Gemfile config # use just 'mv' if this doesn't work
    $ ln -s config/Gemfile .

  and add config to the `directories` statement in your Guardfile.

  (See: https://github.com/guard/guard/wiki/Optimizing-for-large-projects)
        EOS
      end

      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

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

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

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
guard-bundler-3.0.1 lib/guard/bundler/verify.rb
guard-bundler-3.0.0 lib/guard/bundler/verify.rb
guard-bundler-2.2.1 lib/guard/bundler/verify.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-bundler-2.1.0/lib/guard/bundler/verify.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/guard-bundler-2.1.0/lib/guard/bundler/verify.rb
guard-bundler-2.2.0 lib/guard/bundler/verify.rb
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-bundler-2.1.0/lib/guard/bundler/verify.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-bundler-2.1.0/lib/guard/bundler/verify.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-bundler-2.1.0/lib/guard/bundler/verify.rb
guard-bundler-2.1.0 lib/guard/bundler/verify.rb