episopass 0.2.2 → 0.2.7

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
  SHA256:
3
- metadata.gz: 84f4a312a4e679bd3ec6de04ed968dadc344799083943370d670c230d97cc7ff
4
- data.tar.gz: 820c09522dba34702b012332afb010573b21510f03652fb3c47c42013c2efdce
3
+ metadata.gz: 45b3474978095a864424909ed2dc0d7f939317ade6f3275ed6e483f6453340c2
4
+ data.tar.gz: feeb25585b1a3dec0029fc711812b677121d1fd196f0f3e5ec1a56e172b144e8
5
5
  SHA512:
6
- metadata.gz: fdedb95e684847f4f4003fbdc803b8cd6af7d87b992aec6625d8d9fc01d5716a1117112353ed3ffb67a4a92de6fcee1eb113fb12e3e4ceb3ddf164893ee81e0c
7
- data.tar.gz: 1c2b05f9e1ee63eea15139c664a9daa4eb93b7321c49230ad005b579de9d2000e0f9d4a63c50f2b777a1362f2ff8d303a8e31e431705179d8c19312f2bb0c0a6
6
+ metadata.gz: 05eae7a56af97afe039894ab2977877503eae4eb0ab0ddd567327697901b4311a119b2a3d51c05c099157d285ea828af7edf587c15435b3ef72c6889638c3e75
7
+ data.tar.gz: 13b98de889c292bb8ee196c4cc1a5c68cddccb8bca678b228b00f39de608331f486c52fe31168d29834a2b9bf82fa480fb68fcc875594465c979830ce20d1677
data/exe/episounzip CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # % epunzip out.episopass
3
+ # % epunzip out.zip
4
4
  #
5
5
 
6
6
  epfile = ARGV[0]
7
7
  if !epfile || !File.exist?(epfile)
8
- STDERR.puts "% epunzip file.episopass"
8
+ STDERR.puts "% epunzip file.zip"
9
9
  exit
10
10
  end
11
11
 
@@ -17,9 +17,11 @@ end
17
17
  Dir.mkdir(dir)
18
18
 
19
19
  path = File.expand_path(epfile)
20
- system "pushd #{dir} > /dev/null; unzip #{path} ; unzip -P `episopass episopass.html` episopass.zip; rm episopass.zip episopass.html ; popd > /dev/null"
20
+ # system "pushd #{dir} > /dev/null; unzip #{path} ; unzip -P `episopass episopass.html` episopass.zip; rm episopass.zip episopass.html ; popd > /dev/null"
21
+ system "cd #{dir} ; unzip #{path} ; unzip -P `episopass episopass.html` episopass.zip; rm episopass.zip episopass.html"
22
+
23
+ system "(cd #{dir}; tar cf - .) | tar xvf -"
21
24
 
22
- system "/bin/mv #{dir}/* ."
23
25
  system "/bin/rm -r #{dir}"
24
26
 
25
27
 
data/exe/episozip CHANGED
@@ -1,12 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # % episozip [-P episopassのHTML] out.episopass file1 file2
3
+ # % episozip [-P episopassのHTML] out.zip file1 file2
4
4
  #
5
5
 
6
6
  path = "#{__dir__}/../data/sample.html" # gemのファイル指定する方法は?
7
7
  localpath = File.expand_path("~/.episopass.html")
8
8
  path = localpath if File.exist?(localpath)
9
9
 
10
+ def dir
11
+ "/tmp/EpisoPassDir#{$$}"
12
+ end
13
+
14
+ def usage
15
+ STDERR.puts "% episozip [-P episopassのHTML] out.zip file1 file2 ..."
16
+ system "/bin/rm -r #{dir}"
17
+ exit
18
+ end
19
+
10
20
  if ARGV[0] == "-P"
11
21
  path = ARGV[1]
12
22
  ARGV.shift 2
@@ -21,13 +31,12 @@ end
21
31
 
22
32
  if html == ''
23
33
  STDERR.puts "EpisoPass問題(#{path})がみつかりません"
24
- exit
34
+ usage
25
35
  end
26
36
 
27
- dir = "/tmp/EpisoPassDir#{$$}"
28
37
  if File.exist?(dir)
29
38
  STDERR.puts "もう一度試してください"
30
- exit
39
+ usage
31
40
  end
32
41
 
33
42
  system "mkdir #{dir}"
@@ -39,25 +48,19 @@ File.open("#{dir}/episopass.html","w"){ |f|
39
48
  zipfile = ARGV.shift
40
49
  if !zipfile
41
50
  STDERR.puts "出力ファイル名を指定してください"
42
- system "/bin/rm -r #{dir}"
43
- exit
51
+ usage
44
52
  end
45
- if zipfile !~ /\.episopass$/
46
- STDERR.puts "出力ファイルの拡張子は.episopassにしてください"
47
- system "/bin/rm -r #{dir}"
48
- exit
53
+ if zipfile !~ /\.zip$/
54
+ STDERR.puts "出力ファイルの拡張子は.zipにしてください"
55
+ usage
49
56
  end
50
57
  if File.exist?(zipfile)
51
58
  STDERR.puts "#{zipfile}が既に存在します"
52
- system "/bin/rm -r #{dir}"
53
- exit
59
+ usage
54
60
  end
55
61
 
56
62
  system "zip -e -P `episopass #{dir}/episopass.html` #{dir}/episopass.zip #{ARGV.join(' ')}"
57
- system "pushd #{dir} > /dev/null; zip #{zipfile} episopass.zip episopass.html; popd > /dev/null"
58
- system "/bin/mv #{dir}/#{zipfile} ."
59
- system "/bin/rm -r #{dir}"
60
-
61
-
62
-
63
63
 
64
+ system "cd #{dir} ; zip out.zip episopass.zip episopass.html"
65
+ system "/bin/mv #{dir}/out.zip #{zipfile}"
66
+ system "/bin/rm -r #{dir}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EpisoPass
4
- VERSION = "0.2.2" # episozip追加
4
+ VERSION = "0.2.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: episopass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toshiyuki Masui
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-17 00:00:00.000000000 Z
11
+ date: 2021-02-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Run EpisoPass from CLI
14
14
  email: