Sha256: 869c09782923cc2fd4dde3e88eb43bd2aea0baff68ef30605948e4b95ab093bc

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

version = (node[:phantomjs] && node[:phantomjs][:version]) || '2.0.0'
if `which phantomjs && phantomjs --version`.chomp == version
  puts "phantomjs #{version} is already installed"
  return
end

execute 'apt-get update'

%w(build-essential g++ flex bison gperf ruby perl libsqlite3-dev
  libfontconfig1-dev libicu-dev libfreetype6 libssl-dev libjpeg-dev
  python libx11-dev libxext-dev ttf-mscorefonts-installer git).each do |p|
  package p
end

execute 'install libpng' do
  cwd '/tmp'
  command <<-EOC
    wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.18.tar.gz
    tar xvf libpng-1.6.18.tar.gz
    cd libpng-1.6.18
    ./configure
    make
    make install
  EOC
  not_if 'test -e /usr/local/lib/libpng16.so'
end

tmp_dir = '/tmp/phantomjs'

execute "git clone git://github.com/ariya/phantomjs.git #{tmp_dir}" do
  not_if "test -d #{tmp_dir}"
end

execute 'git fetch && git clean -xfd' do
  cwd tmp_dir
end

execute "git checkout #{version}" do
  cwd tmp_dir
end

jobs = if node[:phantomjs] && node[:phantomjs][:jobs]
         "--jobs #{node[:phantomjs][:jobs]}"
       else
         ''
       end
execute "./build.sh --confirm #{jobs}" do
  cwd tmp_dir
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
itamae-plugin-recipe-phantomjs-0.0.1 lib/itamae/plugin/recipe/phantomjs/source.rb