itamae-plugin-recipe-phantomjs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 911edd87f4382454d4fb42120dc6587ebffd781e
4
+ data.tar.gz: 27fa233ebe9c92c323bc2026986bcbcd97297a37
5
+ SHA512:
6
+ metadata.gz: 2bf846229e7eae26abbd179ac3ff4047ae488a52cee87aebb3dd2540080a1f6eebfac891fda40bc071c0fdafa317aadc6e4bb21443bd5f4a2d0f7e11fefde850
7
+ data.tar.gz: 05aa66f0bb3171becab403fe28b30a323e2ebfacb07e035e1b04bc79af16c25dd89c10080dd80f3ae1957d5e715dbbf30c4cb387d2fee5ea5c79fa63da1c7de8
@@ -0,0 +1,2 @@
1
+ FROM ubuntu:14.04
2
+ MAINTAINER muratayusuke "https://github.com/muratayusuke"
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in itamae-plugin-recipe-rtn_rbenv.gemspec
4
+ gemspec
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ itamae-plugin-recipe-phantomjs (0.0.1)
5
+ itamae
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ansi (1.5.0)
11
+ diff-lcs (1.2.5)
12
+ docker-api (1.22.1)
13
+ excon (>= 0.38.0)
14
+ json
15
+ excon (0.45.4)
16
+ hashie (3.4.2)
17
+ itamae (1.4.3)
18
+ ansi
19
+ hashie
20
+ schash (~> 0.1.0)
21
+ specinfra (>= 2.37.0, < 3.0.0)
22
+ thor
23
+ json (1.8.3)
24
+ multi_json (1.11.2)
25
+ net-scp (1.2.1)
26
+ net-ssh (>= 2.6.5)
27
+ net-ssh (2.9.2)
28
+ net-telnet (0.1.1)
29
+ rake (10.4.2)
30
+ rspec (3.3.0)
31
+ rspec-core (~> 3.3.0)
32
+ rspec-expectations (~> 3.3.0)
33
+ rspec-mocks (~> 3.3.0)
34
+ rspec-core (3.3.2)
35
+ rspec-support (~> 3.3.0)
36
+ rspec-expectations (3.3.1)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.3.0)
39
+ rspec-its (1.2.0)
40
+ rspec-core (>= 3.0.0)
41
+ rspec-expectations (>= 3.0.0)
42
+ rspec-mocks (3.3.2)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.3.0)
45
+ rspec-support (3.3.0)
46
+ schash (0.1.1)
47
+ serverspec (2.20.0)
48
+ multi_json
49
+ rspec (~> 3.0)
50
+ rspec-its
51
+ specinfra (~> 2.38)
52
+ sfl (2.2)
53
+ specinfra (2.39.0)
54
+ net-scp
55
+ net-ssh (~> 2.7)
56
+ net-telnet
57
+ sfl
58
+ thor (0.19.1)
59
+
60
+ PLATFORMS
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ bundler
65
+ docker-api
66
+ itamae-plugin-recipe-phantomjs!
67
+ rake
68
+ serverspec
69
+
70
+ BUNDLED WITH
71
+ 1.10.6
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Yusuke Murata
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Itamae::Plugin::Recipe::Phantomjs
2
+
3
+ Installs [phantomjs](http://phantomjs.org/). It's tested only in ubuntu 14.04. Your contribution is welcome.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'itamae-plugin-recipe-phantomjs'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install itamae-plugin-recipe-phantomjs
18
+
19
+ ## Usage
20
+
21
+ ### install for system
22
+
23
+ ```ruby
24
+ include_recipe 'phantomjs'
25
+ ```
26
+
27
+ ### node.yml
28
+
29
+ `node.yml` is used only by phantomjs::source.
30
+
31
+ ```yml
32
+ phantomjs:
33
+ version: 2.0.0
34
+ jobs: 1 # see http://phantomjs.org/build.html
35
+ ```
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it ( https://github.com/muratayusuke/itamae-plugin-recipe-phantomjs/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "itamae-plugin-recipe-phantomjs"
7
+ spec.version = "0.0.1"
8
+ spec.authors = ["Yusuke Murata"]
9
+ spec.email = ["info@muratayusuke.com"]
10
+ spec.summary = %q{Itamae Recipe 'phantomjs'}
11
+ spec.description = %q{Itamae Recipe 'phantomjs'}
12
+ spec.homepage = "https://github.com/muratayusuke/itamae-plugin-recipe-phantomjs"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "itamae"
21
+
22
+ spec.add_development_dependency "bundler"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "serverspec"
25
+ spec.add_development_dependency "docker-api"
26
+ end
@@ -0,0 +1 @@
1
+ include_recipe './phantomjs/binary.rb'
@@ -0,0 +1,3 @@
1
+ package 'libicu52'
2
+ execute 'curl --output /usr/local/bin/phantomjs https://s3.amazonaws.com/circle-support-bucket/phantomjs/phantomjs-2.0.1-linux-x86_64-dynamic'
3
+ execute 'chmod a+x /usr/local/bin/phantomjs'
@@ -0,0 +1,49 @@
1
+ version = (node[:phantomjs] && node[:phantomjs][:version]) || '2.0.0'
2
+ if `which phantomjs && phantomjs --version`.chomp == version
3
+ puts "phantomjs #{version} is already installed"
4
+ return
5
+ end
6
+
7
+ execute 'apt-get update'
8
+
9
+ %w(build-essential g++ flex bison gperf ruby perl libsqlite3-dev
10
+ libfontconfig1-dev libicu-dev libfreetype6 libssl-dev libjpeg-dev
11
+ python libx11-dev libxext-dev ttf-mscorefonts-installer git).each do |p|
12
+ package p
13
+ end
14
+
15
+ execute 'install libpng' do
16
+ cwd '/tmp'
17
+ command <<-EOC
18
+ wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.18.tar.gz
19
+ tar xvf libpng-1.6.18.tar.gz
20
+ cd libpng-1.6.18
21
+ ./configure
22
+ make
23
+ make install
24
+ EOC
25
+ not_if 'test -e /usr/local/lib/libpng16.so'
26
+ end
27
+
28
+ tmp_dir = '/tmp/phantomjs'
29
+
30
+ execute "git clone git://github.com/ariya/phantomjs.git #{tmp_dir}" do
31
+ not_if "test -d #{tmp_dir}"
32
+ end
33
+
34
+ execute 'git fetch && git clean -xfd' do
35
+ cwd tmp_dir
36
+ end
37
+
38
+ execute "git checkout #{version}" do
39
+ cwd tmp_dir
40
+ end
41
+
42
+ jobs = if node[:phantomjs] && node[:phantomjs][:jobs]
43
+ "--jobs #{node[:phantomjs][:jobs]}"
44
+ else
45
+ ''
46
+ end
47
+ execute "./build.sh --confirm #{jobs}" do
48
+ cwd tmp_dir
49
+ end
@@ -0,0 +1,17 @@
1
+ image = 'muratayusuke/itamae-plugin-recipe-phantomjs'
2
+
3
+ puts 'Build docker image:'
4
+ puts `docker build -t #{image} .`
5
+
6
+ puts 'Provision docker image:'
7
+ output = []
8
+ IO.popen("bundle exec itamae docker spec/recipe.rb --image=#{image} -l debug").each do |line|
9
+ puts line
10
+ output << line.chomp
11
+ end
12
+ last_line = output.last
13
+ ENV['DOCKER_IMAGE_PHANTOMJS'] = last_line.scan(/Image created: (.*)\n/).first.first
14
+ p "provisioned image: #{ENV['DOCKER_IMAGE_PHANTOMJS']}"
15
+
16
+ puts 'Run rspec test:'
17
+ puts `bundle exec rspec`
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe command('phantomjs --version') do
4
+ its(:stdout) { should match /2.0/ }
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'docker'
2
+ Excon.defaults[:write_timeout] = 1000
3
+ Excon.defaults[:read_timeout] = 1000
4
+
5
+ include_recipe '../lib/itamae/plugin/recipe/phantomjs/system.rb'
@@ -0,0 +1,9 @@
1
+ require 'docker'
2
+ require 'serverspec'
3
+
4
+ set :backend, :docker
5
+ set :docker_url, ENV["DOCKER_HOST"]
6
+ set :docker_image, ENV['DOCKER_IMAGE_PHANTOMJS']
7
+
8
+ # TODO https://github.com/swipely/docker-api/issues/202
9
+ Excon.defaults[:ssl_verify_peer] = false
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: itamae-plugin-recipe-phantomjs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yusuke Murata
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: itamae
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: serverspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: docker-api
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Itamae Recipe 'phantomjs'
84
+ email:
85
+ - info@muratayusuke.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - Dockerfile
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - itamae-plugin-recipe-phantomjs.gemspec
97
+ - lib/itamae/plugin/recipe/phantomjs.rb
98
+ - lib/itamae/plugin/recipe/phantomjs/binary.rb
99
+ - lib/itamae/plugin/recipe/phantomjs/source.rb
100
+ - run_test.rb
101
+ - spec/phantomjs_spec.rb
102
+ - spec/recipe.rb
103
+ - spec/spec_helper.rb
104
+ homepage: https://github.com/muratayusuke/itamae-plugin-recipe-phantomjs
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.4.5
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: Itamae Recipe 'phantomjs'
128
+ test_files:
129
+ - spec/phantomjs_spec.rb
130
+ - spec/recipe.rb
131
+ - spec/spec_helper.rb