kiji 0.2.0 → 0.2.1
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/lib/kiji/signer.rb +1 -1
- data/lib/kiji/version.rb +1 -1
- data/lib/kiji/zipper.rb +49 -2
- 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: 53acbe509300d81e26198846c2c64636597dc9b9
|
4
|
+
data.tar.gz: 31621fe354fb6d5ea277d4dcf08b3acb8d89a45c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56a2059ccb7ab9f9a54f0f7f5c1e36e193ead2e0fe8249b2f728c701228a842144d4be4bbfd3482de48b3c3cae7c7fc8bf4b128a1b383014fa7f7b52daf2ba6d
|
7
|
+
data.tar.gz: 1d77bfe6773411c269c4799e7f098b21f5f10812986064cf266eacdff77286775912d5641f663e1a5c8298c0ce9139ec6fb262190631ef3cecb7818607e98dc2
|
data/lib/kiji/signer.rb
CHANGED
data/lib/kiji/version.rb
CHANGED
data/lib/kiji/zipper.rb
CHANGED
@@ -7,10 +7,16 @@ module Kiji
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# 構成管理ファイル(kouse.xml)に署名を施す
|
10
|
-
def sign(
|
10
|
+
def sign(kousei_base_file_path_or_content, app_file_paths)
|
11
11
|
fail 'Please specify cert & private_key' if @cert.nil? || @private_key.nil?
|
12
12
|
|
13
|
-
|
13
|
+
content = begin
|
14
|
+
File.read(kousei_base_file_path_or_content)
|
15
|
+
rescue Errno::ENOENT, Errno::ENAMETOOLONG
|
16
|
+
kousei_base_file_path_or_content
|
17
|
+
end
|
18
|
+
|
19
|
+
kousei_data = Nokogiri::XML(content)
|
14
20
|
kousei_doc = kousei_data.to_xml(save_with: 0)
|
15
21
|
|
16
22
|
signer = Signer.new(kousei_doc) do |s|
|
@@ -43,5 +49,46 @@ module Kiji
|
|
43
49
|
|
44
50
|
signer
|
45
51
|
end
|
52
|
+
|
53
|
+
def write_zip(input_dir, output_file)
|
54
|
+
@input_dir = input_dir
|
55
|
+
@output_file = output_file
|
56
|
+
|
57
|
+
entries = Dir.entries(@input_dir)
|
58
|
+
entries.delete('.DS_Store')
|
59
|
+
entries.delete('.')
|
60
|
+
entries.delete('..')
|
61
|
+
Zip.sort_entries = true
|
62
|
+
Zip::File.open(output_file, Zip::File::CREATE) do |io|
|
63
|
+
write_entries(entries, '', io)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def write_entries(entries, path, io)
|
70
|
+
entries.each do |e|
|
71
|
+
zip_file_path = path == '' ? e : File.join(path, e)
|
72
|
+
disk_file_path = File.join(@input_dir, zip_file_path)
|
73
|
+
# puts 'Deflating ' + disk_file_path
|
74
|
+
if File.directory? disk_file_path
|
75
|
+
recursively_deflate_directory(disk_file_path, io, zip_file_path)
|
76
|
+
else
|
77
|
+
put_into_archive(disk_file_path, io, zip_file_path)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def recursively_deflate_directory(disk_file_path, io, zip_file_path)
|
83
|
+
# io.mkdir(zip_file_path)
|
84
|
+
subdir = Dir.entries(disk_file_path) - %w(. .. .DS_Store)
|
85
|
+
write_entries(subdir, zip_file_path, io)
|
86
|
+
end
|
87
|
+
|
88
|
+
def put_into_archive(disk_file_path, io, zip_file_path)
|
89
|
+
io.get_output_stream(zip_file_path) do |f|
|
90
|
+
f.puts(File.open(disk_file_path, 'rb').read)
|
91
|
+
end
|
92
|
+
end
|
46
93
|
end
|
47
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kiji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kakipo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|