Sha256: e814f25ebdbd4db191f17fc72f57ef04dbe53628e4bc6bddbb93d8324d06c1db

Contents?: true

Size: 1.11 KB

Versions: 32

Compression:

Stored size: 1.11 KB

Contents

module LearnTest
  module Dependencies
    class PhantomJS < LearnTest::Dependency
      def missing?
        if mac?
          die('You must have Homebrew installed') unless brew_installed?
          return !phantom_installed_on_mac?
        end

        if !phantom_installed_on_linux?
          die("You must have PhantomJS installed: http://phantomjs.org/download.html")
        end

        super
      end

      def install
        install_phantomjs
      end

      private

      def brew_installed?
        !`which brew`.empty?
      end

      def phantom_installed_on_mac?
        phantom_installed_by_brew? || phantom_installed?
      end

      def phantom_installed_on_linux?
        phantom_installed?
      end
      def self.check_installation
        new.check_installation
      end

      def check_installation
      end

      def phantom_installed_by_brew?
        !`brew ls --versions phantomjs`.empty?
      end

      def phantom_installed?
        !`which phantomjs`.empty?
      end

      def install_phantomjs
        print_installing('phantomjs')
        `brew install phantomjs`
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
learn-test-3.1.2 lib/learn_test/dependencies/phantomjs.rb
learn-test-3.1.1 lib/learn_test/dependencies/phantomjs.rb
learn-test-3.1.0 lib/learn_test/dependencies/phantomjs.rb
learn-test-3.0.0 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.7.0 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.6.1 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.6.0 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.5.6 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.5.5 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.5.4 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.5.3 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.5.2 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.5.1 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.5.0 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.5.0.rc2 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.5.0.rc1 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.4.2 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.4.1 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.4.0 lib/learn_test/dependencies/phantomjs.rb
learn-test-2.3.3 lib/learn_test/dependencies/phantomjs.rb