image_optim_pack 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +3 -0
  4. data/.travis.yml +12 -9
  5. data/Makefile +39 -12
  6. data/README.markdown +14 -9
  7. data/Vagrantfile +45 -7
  8. data/boxes/.gitignore +3 -0
  9. data/boxes/.rubocop.yml +10 -0
  10. data/boxes/Gemfile +6 -0
  11. data/boxes/Rakefile +143 -0
  12. data/boxes/definitions/centos-amd64/definition.rb +30 -0
  13. data/boxes/definitions/centos-amd64/ks.cfg +37 -0
  14. data/boxes/definitions/centos-i386/definition.rb +30 -0
  15. data/boxes/definitions/centos-i386/ks.cfg +37 -0
  16. data/boxes/definitions/centos-postinstall.sh +33 -0
  17. data/boxes/definitions/freebsd-amd64/definition.rb +38 -0
  18. data/boxes/definitions/freebsd-amd64/install.sh +66 -0
  19. data/boxes/definitions/freebsd-i386/definition.rb +38 -0
  20. data/boxes/definitions/freebsd-i386/install.sh +66 -0
  21. data/boxes/definitions/freebsd-postinstall.sh +38 -0
  22. data/boxes/definitions/openbsd-amd64/definition.rb +71 -0
  23. data/boxes/definitions/openbsd-i386/definition.rb +71 -0
  24. data/boxes/definitions/openbsd-postinstall.sh +29 -0
  25. data/image_optim_pack.gemspec +2 -4
  26. data/lib/image_optim/pack.rb +2 -3
  27. data/script/livecheck +29 -2
  28. data/script/run +32 -6
  29. data/script/update_versions +2 -0
  30. data/spec/image_optim/pack_spec.rb +2 -2
  31. data/vendor/{darwin/i386 → darwin-i386}/advpng +0 -0
  32. data/vendor/{darwin/i386 → darwin-i386}/gifsicle +0 -0
  33. data/vendor/{darwin/i386 → darwin-i386}/jhead +0 -0
  34. data/vendor/{darwin/i386 → darwin-i386}/jpeg-recompress +0 -0
  35. data/vendor/{darwin/i386 → darwin-i386}/jpegoptim +0 -0
  36. data/vendor/{darwin/i386 → darwin-i386}/jpegtran +0 -0
  37. data/vendor/{darwin/i386 → darwin-i386}/libjpeg.dylib +0 -0
  38. data/vendor/{darwin/i386 → darwin-i386}/libpng.dylib +0 -0
  39. data/vendor/{darwin/i386 → darwin-i386}/libz.dylib +0 -0
  40. data/vendor/{darwin/i386 → darwin-i386}/optipng +0 -0
  41. data/vendor/darwin-i386/pngcrush +0 -0
  42. data/vendor/{darwin/i386 → darwin-i386}/pngquant +0 -0
  43. data/vendor/{darwin/x86_64 → darwin-x86_64}/advpng +0 -0
  44. data/vendor/{darwin/x86_64 → darwin-x86_64}/gifsicle +0 -0
  45. data/vendor/{darwin/x86_64 → darwin-x86_64}/jhead +0 -0
  46. data/vendor/{darwin/x86_64 → darwin-x86_64}/jpeg-recompress +0 -0
  47. data/vendor/{darwin/x86_64 → darwin-x86_64}/jpegoptim +0 -0
  48. data/vendor/{darwin/x86_64 → darwin-x86_64}/jpegtran +0 -0
  49. data/vendor/{darwin/x86_64 → darwin-x86_64}/libjpeg.dylib +0 -0
  50. data/vendor/{darwin/x86_64 → darwin-x86_64}/libpng.dylib +0 -0
  51. data/vendor/{darwin/x86_64 → darwin-x86_64}/libz.dylib +0 -0
  52. data/vendor/{darwin/x86_64 → darwin-x86_64}/optipng +0 -0
  53. data/vendor/darwin-x86_64/pngcrush +0 -0
  54. data/vendor/{darwin/x86_64 → darwin-x86_64}/pngquant +0 -0
  55. data/vendor/freebsd-amd64/advpng +0 -0
  56. data/vendor/freebsd-amd64/gifsicle +0 -0
  57. data/vendor/freebsd-amd64/jhead +0 -0
  58. data/vendor/freebsd-amd64/jpeg-recompress +0 -0
  59. data/vendor/freebsd-amd64/jpegoptim +0 -0
  60. data/vendor/freebsd-amd64/jpegtran +0 -0
  61. data/vendor/freebsd-amd64/libjpeg.so +0 -0
  62. data/vendor/freebsd-amd64/libpng.so +0 -0
  63. data/vendor/freebsd-amd64/libz.so +0 -0
  64. data/vendor/freebsd-amd64/optipng +0 -0
  65. data/vendor/freebsd-amd64/pngcrush +0 -0
  66. data/vendor/freebsd-amd64/pngquant +0 -0
  67. data/vendor/freebsd-i386/advpng +0 -0
  68. data/vendor/freebsd-i386/gifsicle +0 -0
  69. data/vendor/freebsd-i386/jhead +0 -0
  70. data/vendor/freebsd-i386/jpeg-recompress +0 -0
  71. data/vendor/freebsd-i386/jpegoptim +0 -0
  72. data/vendor/freebsd-i386/jpegtran +0 -0
  73. data/vendor/freebsd-i386/libjpeg.so +0 -0
  74. data/vendor/freebsd-i386/libpng.so +0 -0
  75. data/vendor/freebsd-i386/libz.so +0 -0
  76. data/vendor/freebsd-i386/optipng +0 -0
  77. data/vendor/freebsd-i386/pngcrush +0 -0
  78. data/vendor/freebsd-i386/pngquant +0 -0
  79. data/vendor/{linux/i686 → linux-i686}/advpng +0 -0
  80. data/vendor/{linux/i686 → linux-i686}/gifsicle +0 -0
  81. data/vendor/{linux/i686 → linux-i686}/jhead +0 -0
  82. data/vendor/{linux/i686 → linux-i686}/jpeg-recompress +0 -0
  83. data/vendor/{linux/i686 → linux-i686}/jpegoptim +0 -0
  84. data/vendor/{linux/i686 → linux-i686}/jpegtran +0 -0
  85. data/vendor/{linux/i686 → linux-i686}/libjpeg.so +0 -0
  86. data/vendor/{linux/i686 → linux-i686}/libpng.so +0 -0
  87. data/vendor/{linux/i686 → linux-i686}/libz.so +0 -0
  88. data/vendor/{linux/i686 → linux-i686}/optipng +0 -0
  89. data/vendor/linux-i686/pngcrush +0 -0
  90. data/vendor/{linux/i686 → linux-i686}/pngquant +0 -0
  91. data/vendor/{linux/x86_64 → linux-x86_64}/advpng +0 -0
  92. data/vendor/{linux/x86_64 → linux-x86_64}/gifsicle +0 -0
  93. data/vendor/{linux/x86_64 → linux-x86_64}/jhead +0 -0
  94. data/vendor/{linux/x86_64 → linux-x86_64}/jpeg-recompress +0 -0
  95. data/vendor/{linux/x86_64 → linux-x86_64}/jpegoptim +0 -0
  96. data/vendor/{linux/x86_64 → linux-x86_64}/jpegtran +0 -0
  97. data/vendor/{linux/x86_64 → linux-x86_64}/libjpeg.so +0 -0
  98. data/vendor/{linux/x86_64 → linux-x86_64}/libpng.so +0 -0
  99. data/vendor/{linux/x86_64 → linux-x86_64}/libz.so +0 -0
  100. data/vendor/{linux/x86_64 → linux-x86_64}/optipng +0 -0
  101. data/vendor/linux-x86_64/pngcrush +0 -0
  102. data/vendor/{linux/x86_64 → linux-x86_64}/pngquant +0 -0
  103. data/vendor/openbsd-amd64/advpng +0 -0
  104. data/vendor/openbsd-amd64/gifsicle +0 -0
  105. data/vendor/openbsd-amd64/jhead +0 -0
  106. data/vendor/openbsd-amd64/jpeg-recompress +0 -0
  107. data/vendor/openbsd-amd64/jpegoptim +0 -0
  108. data/vendor/openbsd-amd64/jpegtran +0 -0
  109. data/vendor/openbsd-amd64/libjpeg.so +0 -0
  110. data/vendor/openbsd-amd64/libpng.so +0 -0
  111. data/vendor/openbsd-amd64/libz.so +0 -0
  112. data/vendor/openbsd-amd64/optipng +0 -0
  113. data/vendor/openbsd-amd64/pngcrush +0 -0
  114. data/vendor/openbsd-amd64/pngquant +0 -0
  115. data/vendor/openbsd-i386/advpng +0 -0
  116. data/vendor/openbsd-i386/gifsicle +0 -0
  117. data/vendor/openbsd-i386/jhead +0 -0
  118. data/vendor/openbsd-i386/jpeg-recompress +0 -0
  119. data/vendor/openbsd-i386/jpegoptim +0 -0
  120. data/vendor/openbsd-i386/jpegtran +0 -0
  121. data/vendor/openbsd-i386/libjpeg.so +0 -0
  122. data/vendor/openbsd-i386/libpng.so +0 -0
  123. data/vendor/openbsd-i386/libz.so +0 -0
  124. data/vendor/openbsd-i386/optipng +0 -0
  125. data/vendor/openbsd-i386/pngcrush +0 -0
  126. data/vendor/openbsd-i386/pngquant +0 -0
  127. metadata +115 -93
  128. data/script/vm_init +0 -30
  129. data/vendor/darwin/i386/pngcrush +0 -0
  130. data/vendor/darwin/x86_64/pngcrush +0 -0
  131. data/vendor/linux/i686/pngcrush +0 -0
  132. data/vendor/linux/x86_64/pngcrush +0 -0
@@ -0,0 +1,71 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1',
3
+ :memory_size => '512',
4
+ :disk_size => '8192',
5
+ :disk_format => 'VDI',
6
+ :hostiocache => 'off',
7
+ :os_type_id => 'OpenBSD',
8
+ :iso_file => 'OpenBSD-5.5-i386.iso',
9
+ :iso_src => 'http://ftp3.usa.openbsd.org/pub/OpenBSD/5.5/i386/install55.iso',
10
+ :iso_sha256 => '43798eb4f459b58062167c24337230e96c78b01887a4be40d89279df379f3565',
11
+ :iso_download_timeout => '1000',
12
+ :boot_wait => '50',
13
+ :boot_cmd_sequence => [
14
+ 'I<Enter>', # I - install
15
+ 'us<Enter>', # set the keyboard
16
+ 'OpenBSD55-x32<Enter>', # set the hostname
17
+ '<Enter>', # Which nic to config ? [em0]
18
+ '<Enter>', # do you want dhcp ? [dhcp]
19
+ '<Wait>' * 5,
20
+ 'none<Enter>', # IPV6 for em0 ? [none]
21
+ 'done<Enter>', # Which other nic do you wish to configure [done]
22
+ 'vagrant<Enter>', # Pw for root account
23
+ 'vagrant<Enter>',
24
+ 'yes<Enter>', # Start sshd by default ? [yes]
25
+ 'no<Enter>', # Start ntpd by default ? [yes]
26
+ 'no<Enter>', # Do you want the X window system [yes]
27
+ 'vagrant<Enter>', # Setup a user ?
28
+ 'vagrant<Enter>', # Full username
29
+ 'vagrant<Enter>', # Pw for this user
30
+ 'vagrant<Enter>',
31
+ 'no<Enter>', # Do you want to disable sshd for root ? [yes]
32
+ 'GB<Enter>', # What timezone are you in ?
33
+ '<Enter>', # Available disks [sd0]
34
+ '<Enter>', # Use DUIDs rather than device names in fstab ? [yes]
35
+ 'W<Enter>', # Use (W)whole disk or (E)edit MBR ? [whole]
36
+ 'A<Enter>', # Use (A)auto layout ... ? [a]
37
+ '<Wait>' * 70,
38
+ 'cd<Enter>', # location of the sets [cd]
39
+ '<Enter>', # Available cd-roms : cd0
40
+ '<Enter>', # Pathname to sets ? [5.5/i386]
41
+ '-game55.tgz<Enter>', # Remove games and X
42
+ '-xbase55.tgz<Enter>',
43
+ '-xetc55.tgz<Enter>',
44
+ '-xshare55.tgz<Enter>',
45
+ '-xfont55.tgz<Enter>',
46
+ '-xserv55.tgz<Enter>',
47
+ 'done<Enter>',
48
+ '<Wait>',
49
+ 'yes<Enter>', # CD does not contain SHA256.sig (5.5) Continue without verification?
50
+ 'done<Enter>', # Done installing ?
51
+ '<Wait>' * 6,
52
+ 'yes<Enter><Wait>', # Time appears wrong. Set to ...? [yes]
53
+ '<Wait>' * 6,
54
+ 'reboot<Enter>',
55
+ '<Wait>' * 6,
56
+ ],
57
+ :kickstart_port => '7122',
58
+ :kickstart_timeout => '300',
59
+ :kickstart_file => '',
60
+ :ssh_login_timeout => '10000',
61
+ :ssh_user => 'root',
62
+ :ssh_password => 'vagrant',
63
+ :ssh_key => '',
64
+ :ssh_host_port => '7222',
65
+ :ssh_guest_port => '22',
66
+ :sudo_cmd => "sh '%f'",
67
+ :shutdown_cmd => '/sbin/halt -p',
68
+ :postinstall_files => %w[../openbsd-postinstall.sh],
69
+ :postinstall_timeout => '10000',
70
+ :skip_iso_transfer => true,
71
+ })
@@ -0,0 +1,29 @@
1
+ set -ex
2
+
3
+ date > /etc/vagrant_box_build_time
4
+
5
+ # set pkg path for users
6
+ export PKG_PATH=http://ftp3.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s`/
7
+ echo "export PKG_PATH=$PKG_PATH" >> /root/.profile
8
+ echo "export PKG_PATH=$PKG_PATH" >> /home/vagrant/.profile
9
+
10
+ # install bash and wget
11
+ pkg_add bash wget
12
+
13
+ # set vagrant shell to bash
14
+ usermod -s /usr/local/bin/bash vagrant
15
+
16
+ # sudo
17
+ echo "# Uncomment to allow people in group wheel to run all commands without a password" >> /etc/sudoers
18
+ echo "%wheel ALL=(ALL) NOPASSWD: SETENV: ALL" >> /etc/sudoers
19
+
20
+ # setup the vagrant key
21
+ mkdir -p /home/vagrant/.ssh
22
+ chmod 700 /home/vagrant/.ssh
23
+ wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
24
+ chmod 600 /home/vagrant/.ssh/authorized_keys
25
+ chown -R vagrant.vagrant /home/vagrant/.ssh
26
+
27
+ perl -pi -e 's/(?<=:maxproc-(?:max|cur)=)\d+(?=:)/1024/' -- /etc/login.conf
28
+
29
+ /sbin/halt -p
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'image_optim_pack'
5
- s.version = '0.2.3'
5
+ s.version = '0.3.0'
6
6
  s.summary = %q{Precompiled binaries for image_optim: advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegtran, optipng, pngcrush, pngquant}
7
7
  s.homepage = "http://github.com/toy/#{s.name}"
8
8
  s.authors = ['Ivan Kuchin']
@@ -18,10 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'image_optim', '~> 0.19'
19
19
  s.add_dependency 'fspath', '>= 2.1', '< 4'
20
20
 
21
- s.add_development_dependency 'versionomy', '~> 0.4.4'
22
- s.add_development_dependency 'blockenspiel', '~> 0.4.0'
23
21
  s.add_development_dependency 'rspec', '~> 3.0'
24
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9.3')
22
+ if RUBY_VERSION >= '2.0'
25
23
  s.add_development_dependency 'rubocop', '~> 0.36'
26
24
  end
27
25
  end
@@ -19,8 +19,7 @@ class ImageOptim
19
19
  # Receive path, use last part for arch and last but one part for os
20
20
  def initialize(path)
21
21
  @path = FSPath(path)
22
- @os = @path.dirname.basename.to_s
23
- @arch = @path.basename.to_s
22
+ @os, @arch = @path.basename.to_s.split('-', 2)
24
23
  end
25
24
 
26
25
  # Return path converted to string
@@ -81,7 +80,7 @@ class ImageOptim
81
80
  VENDOR_PATH = FSPath('../../../vendor').expand_path(__FILE__)
82
81
 
83
82
  # List of paths
84
- PATHS = VENDOR_PATH.glob('*/*').map{ |path| Path.new(path) }
83
+ PATHS = VENDOR_PATH.glob('*-*').map{ |path| Path.new(path) }
85
84
 
86
85
  class << self
87
86
  # Return path to directory with binaries
data/script/livecheck CHANGED
@@ -1,9 +1,36 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Get latest version of tools
4
+
3
5
  require 'yaml'
4
6
  require 'uri'
5
7
  require 'net/http'
6
- require 'versionomy'
8
+ require 'rubygems/version'
9
+
10
+ # Compare versions including libjpeg ones (9b <=> 9)
11
+ class Version
12
+ include Comparable
13
+
14
+ attr_reader :string, :parsed
15
+ alias_method :to_s, :string
16
+
17
+ def initialize(string)
18
+ @string = string
19
+ @parsed = begin
20
+ Gem::Version.new(string)
21
+ rescue ArgumentError
22
+ nil
23
+ end
24
+ end
25
+
26
+ def <=>(other)
27
+ if parsed && other.parsed
28
+ parsed <=> other.parsed
29
+ else
30
+ string <=> other.string
31
+ end
32
+ end
33
+ end
7
34
 
8
35
  bare = ARGV.delete('--bare')
9
36
 
@@ -12,7 +39,7 @@ unless [1, 2].include?(ARGV.length)
12
39
  end
13
40
 
14
41
  def version(string)
15
- Versionomy.parse(string)
42
+ Version.new(string)
16
43
  end
17
44
 
18
45
  def get(url)
data/script/run CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- set -xe
3
+ # Build tools on Mac OS X host and in all vms
4
4
 
5
- MAKE_COMMAND='make all -j'
5
+ set -ex
6
+
7
+ MAKE_TASK='all -j'
6
8
 
7
9
  for arg in "$@"; do
8
10
  if [[ "$arg" =~ ^([A-Z_]+)=(.*)$ ]]; then
@@ -10,17 +12,41 @@ for arg in "$@"; do
10
12
  fi
11
13
  done
12
14
 
13
- if [ "$(uname -s | tr A-Z a-z)" != 'darwin' ]; then
15
+ if [ `uname -s` != 'Darwin' ]; then
14
16
  echo 'expected to run on Mac OS X'
15
17
  exit 1
16
18
  fi
17
19
 
18
20
  for arch in i386 x86_64; do
19
- $MAKE_COMMAND ARCH=$arch
21
+ make $MAKE_TASK ARCH=$arch
20
22
  done
21
23
 
22
- for vm in linux_{i686,x86_64}; do
24
+ for vm in $(vagrant status --machine-readable | cut -d, -f2 | sort -u); do
23
25
  vagrant up $vm
24
- vagrant ssh $vm -c "cd /vagrant; $MAKE_COMMAND"
26
+
27
+ # create ssh config
28
+ ssh_config=.vagrant/ssh_config.$vm
29
+ vagrant ssh-config $vm > $ssh_config
30
+
31
+ # rsync needed files to the box
32
+ mkdir -p vendor/$vm
33
+ rsync -e "ssh -F $ssh_config" -aR --del Makefile download vendor/$vm $vm:/vagrant
34
+
35
+ # sync time and run make
36
+ vagrant ssh $vm -c "
37
+ set -ex
38
+ sudo ntpdate pool.ntp.org
39
+
40
+ cd /vagrant
41
+ if make -v 2>&1 | grep -q GNU\ Make; then
42
+ make $MAKE_TASK
43
+ else
44
+ gmake $MAKE_TASK
45
+ fi
46
+ "
47
+
48
+ # rsync files in vendor from the box
49
+ rsync -e "ssh -F $ssh_config" -aR --del $vm:/vagrant/./vendor/$vm .
50
+
25
51
  [ -n "$NO_HALT" ] || vagrant halt $vm
26
52
  done
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Feed Makefile to this script to set all variables XXX_VER to latest versions
4
+
3
5
  require 'English'
4
6
 
5
7
  tty = $stdout.tty?
@@ -37,13 +37,13 @@ describe ImageOptim::Pack do
37
37
 
38
38
  describe :os do
39
39
  it 'returns last but one part of path' do
40
- expect(Path.new('path/futureos/Kqbit').os).to eq('futureos')
40
+ expect(Path.new('path/futureos-K-qbit').os).to eq('futureos')
41
41
  end
42
42
  end
43
43
 
44
44
  describe :arch do
45
45
  it 'returns last but one part of path' do
46
- expect(Path.new('path/futureos/Kqbit').arch).to eq('Kqbit')
46
+ expect(Path.new('path/futureos-K-qbit').arch).to eq('K-qbit')
47
47
  end
48
48
  end
49
49
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
Binary file
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
Binary file
File without changes
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
Binary file
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes