imagemaster3000 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/imagemaster3000.gemspec +1 -1
- data/lib/imagemaster3000/actions.rb +1 -0
- data/lib/imagemaster3000/actions/link.rb +35 -0
- data/lib/imagemaster3000/definitions/schemas/imagemaster3000-definition-schema.json +39 -0
- data/lib/imagemaster3000/entities/downloadable.rb +1 -1
- data/lib/imagemaster3000/utils/tmp.rb +3 -2
- data/lib/imagemaster3000/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61e5dc4473085611c7b91bb0308463f307f660ee
|
4
|
+
data.tar.gz: d4f951f7dede795722204617023a45bcf68a6b0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f551c535fdf3b69d30b34bf07557a3812af67126a651ebcc35dab8e46975b1aded752e256d3ae7c981f9715802db9b2e459d79986ed4a56173e4113226bd232b
|
7
|
+
data.tar.gz: bf0a1b4734bb0c8923edbdbd11834530fd8d2b34dddb6cba3f73254622a0a516ac93ef22983bb7001d4f623f939190f60e02d43c266e20d03cf1fc0691fe44db
|
data/imagemaster3000.gemspec
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Imagemaster3000
|
2
|
+
module Actions
|
3
|
+
class Link
|
4
|
+
attr_accessor :target, :link, :symbolic
|
5
|
+
|
6
|
+
def initialize(target: nil, link: nil, symbolic: false)
|
7
|
+
raise Imagemaster3000::Errors::ArgumentError, 'neither target nor link can be nil' if target.empty? || link.empty?
|
8
|
+
|
9
|
+
@target = target
|
10
|
+
@link = link
|
11
|
+
@symbolic = symbolic
|
12
|
+
logger.debug "Created action #{inspect}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def run(image_file)
|
16
|
+
logger.debug "Running 'link' action with target #{target.inspect} and link #{link.inspect} on file #{image_file.inspect}"
|
17
|
+
ln image_file
|
18
|
+
rescue Imagemaster3000::Errors::CommandExecutionError => ex
|
19
|
+
raise Imagemaster3000::Errors::ActionError, ex
|
20
|
+
end
|
21
|
+
|
22
|
+
def ln(image_file)
|
23
|
+
ln_command = symbolic ? 'ln-s' : 'ln'
|
24
|
+
|
25
|
+
Imagemaster3000::Utils::CommandExecutioner.execute Imagemaster3000::Settings[:'binaries-guestfish'],
|
26
|
+
'-a',
|
27
|
+
image_file,
|
28
|
+
'-i',
|
29
|
+
ln_command,
|
30
|
+
target,
|
31
|
+
link
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -20,6 +20,18 @@
|
|
20
20
|
"title":"Name",
|
21
21
|
"type":"string"
|
22
22
|
},
|
23
|
+
"linkname":{
|
24
|
+
"description":"Link file",
|
25
|
+
"id":"#linkname",
|
26
|
+
"title":"Link",
|
27
|
+
"type":"string"
|
28
|
+
},
|
29
|
+
"symbolic":{
|
30
|
+
"description":"Whether created link should be symbolic",
|
31
|
+
"id":"#symbolic",
|
32
|
+
"title":"Symbolic",
|
33
|
+
"type":"boolean"
|
34
|
+
},
|
23
35
|
"copy":{
|
24
36
|
"additionalItems":false,
|
25
37
|
"id":"#copy",
|
@@ -54,6 +66,30 @@
|
|
54
66
|
},
|
55
67
|
"type":"array"
|
56
68
|
},
|
69
|
+
"link":{
|
70
|
+
"additionalItems":false,
|
71
|
+
"id":"#link",
|
72
|
+
"items":{
|
73
|
+
"additionalProperties":false,
|
74
|
+
"properties":{
|
75
|
+
"target":{
|
76
|
+
"$ref":"#/definitions/target"
|
77
|
+
},
|
78
|
+
"link":{
|
79
|
+
"$ref":"#/definitions/linkname"
|
80
|
+
},
|
81
|
+
"symbolic":{
|
82
|
+
"$ref":"#/definitions/symbolic"
|
83
|
+
}
|
84
|
+
},
|
85
|
+
"required":[
|
86
|
+
"target",
|
87
|
+
"link"
|
88
|
+
],
|
89
|
+
"type":"object"
|
90
|
+
},
|
91
|
+
"type":"array"
|
92
|
+
},
|
57
93
|
"actions":{
|
58
94
|
"additionalProperties":false,
|
59
95
|
"id":"#actions",
|
@@ -63,6 +99,9 @@
|
|
63
99
|
},
|
64
100
|
"remove":{
|
65
101
|
"$ref":"#/definitions/remove"
|
102
|
+
},
|
103
|
+
"link":{
|
104
|
+
"$ref":"#/definitions/link"
|
66
105
|
}
|
67
106
|
},
|
68
107
|
"type":"object"
|
@@ -32,7 +32,7 @@ module Imagemaster3000
|
|
32
32
|
end
|
33
33
|
|
34
34
|
response.value
|
35
|
-
open(filename, 'w') { |file| response.read_body { |chunk| file.write(chunk) } }
|
35
|
+
File.open(filename, 'w') { |file| response.read_body { |chunk| file.write(chunk) } }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, Net::HTTPBadResponse,
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'open-uri'
|
2
1
|
require 'tempfile'
|
3
2
|
|
4
3
|
module Imagemaster3000
|
@@ -6,8 +5,8 @@ module Imagemaster3000
|
|
6
5
|
class Tmp
|
7
6
|
def self.download(url)
|
8
7
|
file = Tempfile.new('imagemaster3000')
|
9
|
-
download = open(url)
|
10
8
|
logger.debug "Downloading file from url #{url} to tempfile #{file.path.inspect}"
|
9
|
+
download = URI.parse(url).open
|
11
10
|
IO.copy_stream(download, file)
|
12
11
|
|
13
12
|
file.rewind
|
@@ -15,6 +14,8 @@ module Imagemaster3000
|
|
15
14
|
end
|
16
15
|
|
17
16
|
def self.destroy(file)
|
17
|
+
return unless file
|
18
|
+
|
18
19
|
logger.debug "Closing tempfile #{file.path.inspect}"
|
19
20
|
file.close
|
20
21
|
file.unlink
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imagemaster3000
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Kimle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -293,6 +293,7 @@ files:
|
|
293
293
|
- lib/imagemaster3000.rb
|
294
294
|
- lib/imagemaster3000/actions.rb
|
295
295
|
- lib/imagemaster3000/actions/copy.rb
|
296
|
+
- lib/imagemaster3000/actions/link.rb
|
296
297
|
- lib/imagemaster3000/actions/remove.rb
|
297
298
|
- lib/imagemaster3000/cleaner.rb
|
298
299
|
- lib/imagemaster3000/cli.rb
|