fpm-dockery 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c935a1fef8fa2087d31346840b6485bc572ec539
4
- data.tar.gz: 9d200efd489fd6d69d29ecdf16d15eed9ed9e929
3
+ metadata.gz: 7f32f78d6ae454c52ef25fe144f36976b98d342f
4
+ data.tar.gz: 5eb288fd9f7db6d2c05ccf025e46f7f47d33b403
5
5
  SHA512:
6
- metadata.gz: 9ba023b1e3175338547cb678b8b7601d6d2fccb59c50fa942d7d01de325ca78a7d07b8d53aee03ac445edf3ee3cc1b427870a8300152d8c9a556eecab5518081
7
- data.tar.gz: f6084650e84dc08246ada4911a3b1f22c2ac86e2ab869ae74474a75137212f5e5d244ddd3b3c400b302209548ce18e2b83f819a590bbfa5b9404e8940862944b
6
+ metadata.gz: 9f730d49772a2e937dd6d2603da20706684e54ae7f3b36f749f057408f0ec9e34f2be2d8b50cb7519c2e9fec00ed78108affe4741ddd26ffdd79f37769959320
7
+ data.tar.gz: 7beceb3533101cf991e1a7e57d236d2edcdb3f3f95465423d1722cb9a232dec59fe7bbb62bae0b6c3eec21aaca15a758b9e0cc7c836727f27a404f52cdd73747
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1
4
+
5
+ * Add support for fpm-cook's --skip-package option.
6
+
7
+ ## 0.1.0
8
+
9
+ * Initial version.
@@ -8,10 +8,13 @@ module FPM
8
8
  include Logging
9
9
  include Utils
10
10
 
11
+ # List all valid builders by listing the Dockerfile.* files in
12
+ # the docker directory.
11
13
  def valid_builders
12
14
  Dir.glob("#{FPM::Dockery.root}/docker/Dockerfile.*").map {|f| File.basename(f.gsub('Dockerfile.', ''))}
13
15
  end
14
16
 
17
+ # Check the builder is one we have a Dockerfile for.
15
18
  def validate_builder!
16
19
  unless valid_builders.include?(builder)
17
20
  fatal "Image type must be one of: #{valid_builders.join(', ')}"
@@ -19,6 +22,7 @@ module FPM
19
22
  end
20
23
  end
21
24
 
25
+ # Create a builder image if it doesn't exist.
22
26
  def create_builder_if_required
23
27
  image_check = Subprocess.run("docker images | awk '{print $1}' | grep fpm-dockery/#{builder}")
24
28
  unless image_check.exitstatus == 0
@@ -27,6 +31,7 @@ module FPM
27
31
  end
28
32
  end
29
33
 
34
+ # Create a builder image.
30
35
  def create_builder(no_cache)
31
36
  validate_builder!
32
37
  cache_option = no_cache ? '--no-cache=true' : ''
@@ -55,11 +60,13 @@ module FPM
55
60
  create_builder(no_cache?)
56
61
  end
57
62
  end
58
-
63
+
64
+ # The package command implementation.
59
65
  class PackageCommand < BaseCommand
60
66
  parameter "RECIPE", "fpm-cookery recipe to build"
61
67
  parameter "BUILDER", "Builder to use"
62
68
  parameter "[PACKAGE_DIR]", "Where to place the packages created by the build (defaults to /pkg in same dir as recipe)"
69
+ option "--skip-package", :flag, "Skip package building (identical to fpm-cook --skip-package)"
63
70
 
64
71
  def execute
65
72
  recipe_path = File.expand_path(recipe)
@@ -69,23 +76,30 @@ module FPM
69
76
  validate_builder!
70
77
  create_builder_if_required
71
78
 
72
- extra_command = ''
79
+ extra_docker_commands = []
80
+ extra_fpm_cook_commands = []
81
+
73
82
  pkg_dir = "/recipe/pkg"
74
83
 
75
84
  if package_dir
76
- extra_command = "-v #{File.expand_path(package_dir)}:/output"
85
+ extra_docker_commands << "-v #{File.expand_path(package_dir)}:/output"
77
86
  pkg_dir = "/output"
78
87
  end
88
+
89
+ if skip_package?
90
+ extra_fpm_cook_commands << "--skip-package"
91
+ end
79
92
 
80
93
  command = <<eos
81
94
  docker run \
82
95
  -v #{dir_to_mount}:/recipe \
83
- #{extra_command} \
96
+ #{extra_docker_commands.join(' ')} \
84
97
  fpm-dockery/ubuntu \
85
98
  --tmp-root /tmp/tmproot \
86
99
  --pkg-dir #{pkg_dir} \
87
100
  --cache-dir /tmp/cache \
88
101
  package \
102
+ #{extra_fpm_cook_commands.join(' ')} \
89
103
  /recipe/#{name_of_recipe}
90
104
  eos
91
105
  exit_status = Subprocess.run(command)
@@ -1,5 +1,5 @@
1
1
  module Fpm
2
2
  module Dockery
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm-dockery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Sykes
@@ -63,6 +63,7 @@ files:
63
63
  - ".gitignore"
64
64
  - ".ruby-gemset"
65
65
  - ".ruby-version"
66
+ - CHANGELOG.md
66
67
  - Gemfile
67
68
  - LICENSE
68
69
  - README.md