episopass 0.1.7 → 0.2.4

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: c3f927a52f6e4aa774f33c6b920c1d4061017f229b0714d347e35ee7a4e5b68f
4
- data.tar.gz: 00eab44234841ea8033387d7d6d78555bacabbadac322440ffeef5654086bee4
3
+ metadata.gz: 6d9c2c54c1959419ac2ad407bb9edf9471f304aafc6321637d6caf38ab8bef6e
4
+ data.tar.gz: 1479ebfcf3cdbecd754d459207681fc9c566afac9ebc2901663c6f943a964369
5
5
  SHA512:
6
- metadata.gz: ba6cda6eed643a94db45f9a76fb54e7bfc06d0746ab45899348f288362e9d9880ede7dc00e5fb03b0d2575abe04f79f90bed9c3eed0aebb9a3af8488bd814e71
7
- data.tar.gz: c7d4ec29bc1ea79e57f96b578f55857f3913a146dcd4eb65a19e4ea29beadfedb74958d4467a5da8c3863f7f77f6e7ced08d2a523cc78a17b84555e7c4a5c9ec
6
+ metadata.gz: 738362b0ae549787afcc4a2b8ac9a46885785ccf7af9a39af6ee5d45d530fc3a59e8d41dd46854693ab51f7d7380167728d473151fda7be6b43f40917dc8e518
7
+ data.tar.gz: 53c5bc9c97f2aba659011ae3c428ee59b2b556c33b46c6606eae12dafb618c50b8a63d9b49cdd0cca8c39c21d4c749cf7f32dda963f63f2c6f6e93e4453b3fc5
data/exe/episopass CHANGED
@@ -17,8 +17,11 @@ if arg
17
17
  html = File.read(arg)
18
18
  end
19
19
  else
20
- # サンプルデータ利用
21
- html = File.read("#{__dir__}/../data/sample.html") # gemのファイル指定する方法は?
20
+ path = "#{__dir__}/../data/sample.html" # gemのファイル指定する方法は?
21
+ localpath = File.expand_path("~/.episopass.html")
22
+ path = localpath if File.exist?(localpath)
23
+
24
+ html = File.read(path)
22
25
  end
23
26
 
24
27
  opencmd = "open"
data/exe/episounzip ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # % epunzip out.episopass
4
+ #
5
+
6
+ epfile = ARGV[0]
7
+ if !epfile || !File.exist?(epfile)
8
+ STDERR.puts "% epunzip file.episopass"
9
+ exit
10
+ end
11
+
12
+ dir = "/tmp/EpisoPassDir#{$$}"
13
+ if File.exist?(dir)
14
+ STDERR.puts "もう一度実行してください"
15
+ exit
16
+ end
17
+ Dir.mkdir(dir)
18
+
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"
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 -"
24
+
25
+ system "/bin/rm -r #{dir}"
26
+
27
+
28
+
29
+
30
+
data/exe/episozip ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # % episozip [-P episopassのHTML] out.episopass file1 file2
4
+ #
5
+
6
+ path = "#{__dir__}/../data/sample.html" # gemのファイル指定する方法は?
7
+ localpath = File.expand_path("~/.episopass.html")
8
+ path = localpath if File.exist?(localpath)
9
+
10
+ if ARGV[0] == "-P"
11
+ path = ARGV[1]
12
+ ARGV.shift 2
13
+ end
14
+
15
+ html = ''
16
+ if path =~ /^http/
17
+ html = Net::HTTP.get(URI.parse(arg))
18
+ elsif File.exist?(path)
19
+ html = File.read(path)
20
+ end
21
+
22
+ if html == ''
23
+ STDERR.puts "EpisoPass問題(#{path})がみつかりません"
24
+ exit
25
+ end
26
+
27
+ dir = "/tmp/EpisoPassDir#{$$}"
28
+ if File.exist?(dir)
29
+ STDERR.puts "もう一度試してください"
30
+ exit
31
+ end
32
+
33
+ system "mkdir #{dir}"
34
+
35
+ File.open("#{dir}/episopass.html","w"){ |f|
36
+ f.print html
37
+ }
38
+
39
+ zipfile = ARGV.shift
40
+ if !zipfile
41
+ STDERR.puts "出力ファイル名を指定してください"
42
+ system "/bin/rm -r #{dir}"
43
+ exit
44
+ end
45
+ if zipfile !~ /\.episopass$/
46
+ STDERR.puts "出力ファイルの拡張子は.episopassにしてください"
47
+ system "/bin/rm -r #{dir}"
48
+ exit
49
+ end
50
+ if File.exist?(zipfile)
51
+ STDERR.puts "#{zipfile}が既に存在します"
52
+ system "/bin/rm -r #{dir}"
53
+ exit
54
+ end
55
+
56
+ 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 "cd #{dir} ; zip #{zipfile} episopass.zip episopass.html"
59
+ system "/bin/mv #{dir}/#{zipfile} ."
60
+ system "/bin/rm -r #{dir}"
61
+
62
+
63
+
64
+
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EpisoPass
4
- VERSION = "0.1.7"
4
+ VERSION = "0.2.4" # episozip追加
5
5
  end
metadata CHANGED
@@ -1,25 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: episopass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.2.4
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-08 00:00:00.000000000 Z
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Run EpisoPass from CLI
14
14
  email:
15
15
  - masui@pitecan.com
16
16
  executables:
17
17
  - episopass
18
+ - episounzip
19
+ - episozip
18
20
  extensions: []
19
21
  extra_rdoc_files: []
20
22
  files:
21
23
  - data/sample.html
22
24
  - exe/episopass
25
+ - exe/episounzip
26
+ - exe/episozip
23
27
  - lib/episopass.rb
24
28
  - lib/episopass/version.rb
25
29
  homepage: http://EpisoPass.com
@@ -43,8 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
47
  - !ruby/object:Gem::Version
44
48
  version: '0'
45
49
  requirements: []
46
- rubyforge_project:
47
- rubygems_version: 2.7.6.2
50
+ rubygems_version: 3.0.3
48
51
  signing_key:
49
52
  specification_version: 4
50
53
  summary: Run EpisoPass from CLI