appbundle-updater 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/appbundle-updater +57 -14
- data/lib/appbundle_updater/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 331e2d44703abdf38c526bc815036066fcbc08e9
|
4
|
+
data.tar.gz: 8a9bfc9bb4feaa65e098dc8bb1caab03ebf935f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49bb29d6a177ee723851a78fb0c0c0b67d9dc29901a576dc7a07f4210d5f1289d32122ba1f55b1e5b1b1ab390145a5b0651b672d71d9176d8b9d0b18f8be74eb
|
7
|
+
data.tar.gz: 5c6c74485430d83b331e83d2df0b02b82fd5e6a69ee8667bc621b75a0a85bee6971d0fdad1591844c65eaf02d950b7425a53efcd201731c8541c6c1dcd94728d
|
data/bin/appbundle-updater
CHANGED
@@ -19,6 +19,11 @@
|
|
19
19
|
|
20
20
|
require "pathname"
|
21
21
|
require "optparse"
|
22
|
+
require "open-uri"
|
23
|
+
require "fileutils"
|
24
|
+
require "rubygems/package"
|
25
|
+
require "zlib"
|
26
|
+
require "tempfile"
|
22
27
|
|
23
28
|
# FIXME: move to helpers mixin
|
24
29
|
|
@@ -38,7 +43,39 @@ def bin_dir
|
|
38
43
|
chefdk.join("embedded/bin")
|
39
44
|
end
|
40
45
|
|
41
|
-
|
46
|
+
TAR_LONGLINK = '././@LongLink'
|
47
|
+
|
48
|
+
# pure ruby `tar xzf`, handles longlinks and directories ending in '/'
|
49
|
+
# (http://stackoverflow.com/a/31310593/506908)
|
50
|
+
def extract_tgz(file, destination = '.')
|
51
|
+
Gem::Package::TarReader.new( Zlib::GzipReader.open file ) do |tar|
|
52
|
+
dest = nil
|
53
|
+
tar.each do |entry|
|
54
|
+
if entry.full_name == TAR_LONGLINK
|
55
|
+
dest = File.join destination, entry.read.strip
|
56
|
+
next
|
57
|
+
end
|
58
|
+
dest ||= File.join destination, entry.full_name
|
59
|
+
if entry.directory? || (entry.header.typeflag == '' && entry.full_name.end_with?('/'))
|
60
|
+
File.delete dest if File.file? dest
|
61
|
+
FileUtils.mkdir_p dest, :mode => entry.header.mode, :verbose => false
|
62
|
+
elsif entry.file? || (entry.header.typeflag == '' && !entry.full_name.end_with?('/'))
|
63
|
+
FileUtils.rm_rf dest if File.directory? dest
|
64
|
+
File.open dest, "wb" do |f|
|
65
|
+
f.print entry.read
|
66
|
+
end
|
67
|
+
FileUtils.chmod entry.header.mode, dest, :verbose => false
|
68
|
+
elsif entry.header.typeflag == '2' #Symlink!
|
69
|
+
File.symlink entry.header.linkname, dest
|
70
|
+
else
|
71
|
+
puts "Unkown tar entry: #{entry.full_name} type: #{entry.header.typeflag}."
|
72
|
+
end
|
73
|
+
dest = nil
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
App = Struct.new(:name, :repo, :bundle_without, :install_command) do
|
42
79
|
def to_s
|
43
80
|
name
|
44
81
|
end
|
@@ -47,43 +84,43 @@ end
|
|
47
84
|
CHEFDK_APPS = [
|
48
85
|
App.new(
|
49
86
|
"berkshelf",
|
50
|
-
"
|
87
|
+
"berkshelf/berkshelf",
|
51
88
|
"guard test",
|
52
89
|
"#{bin_dir.join("rake")} install",
|
53
90
|
),
|
54
91
|
App.new(
|
55
92
|
"chef",
|
56
|
-
"
|
93
|
+
"chef/chef",
|
57
94
|
"server docgen test development",
|
58
95
|
"#{bin_dir.join("rake")} install",
|
59
96
|
),
|
60
97
|
App.new(
|
61
98
|
"chef-dk",
|
62
|
-
"
|
99
|
+
"chef/chef-dk",
|
63
100
|
"dev test development",
|
64
101
|
"#{bin_dir.join("rake")} install",
|
65
102
|
),
|
66
103
|
App.new(
|
67
104
|
"chef-vault",
|
68
|
-
"
|
105
|
+
"Nordstrom/chef-vault",
|
69
106
|
"test",
|
70
107
|
"#{bin_dir.join("rake")} install",
|
71
108
|
),
|
72
109
|
App.new(
|
73
110
|
"foodcritic",
|
74
|
-
"
|
111
|
+
"acrmp/foodcritic",
|
75
112
|
nil,
|
76
113
|
"#{bin_dir.join("rake")} install",
|
77
114
|
),
|
78
115
|
App.new(
|
79
116
|
"ohai",
|
80
|
-
"
|
117
|
+
"chef/ohai",
|
81
118
|
"test development",
|
82
119
|
"#{bin_dir.join("rake")} install",
|
83
120
|
),
|
84
121
|
App.new(
|
85
122
|
"test-kitchen",
|
86
|
-
"
|
123
|
+
"test-kitchen/test-kitchen",
|
87
124
|
"guard test",
|
88
125
|
"#{bin_dir.join("rake")} install",
|
89
126
|
)
|
@@ -106,12 +143,18 @@ class Updater
|
|
106
143
|
banner("Cleaning #{app} checkout")
|
107
144
|
app_dir.rmtree if app_dir.directory?
|
108
145
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
146
|
+
git_url = "https://github.com/#{app.repo}/archive/#{ref}.tar.gz"
|
147
|
+
banner("Extracting #{app} from #{git_url}")
|
148
|
+
Dir.chdir(chefdk.join("embedded/apps")) do
|
149
|
+
Tempfile.open('appbundle-updater') do |tempfile|
|
150
|
+
open(git_url) do |uri|
|
151
|
+
tempfile.write(uri.read)
|
152
|
+
end
|
153
|
+
tempfile.close
|
154
|
+
extract_tgz(tempfile.path)
|
155
|
+
end
|
156
|
+
base = File.basename app.repo
|
157
|
+
FileUtils.mv "#{base}-#{ref}", "#{app.name}"
|
115
158
|
end
|
116
159
|
|
117
160
|
banner("Installing dependencies")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appbundle-updater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lamont-granquist
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|