episopass 0.1.5 → 0.1.6

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: 621909b87d7a4b339319627fa93befce9c2e8e26c8f56b5cff194b487faced20
4
- data.tar.gz: 369bc28612bdab465479080a949ab464c94f53c16fa6f403fd97c6002d8232ba
3
+ metadata.gz: c2badbf05230c2cddd7c09644ff0571eeebf3a51513aac860f67bf254a51f563
4
+ data.tar.gz: 7b01bef0ccbec7b1b272c094eafc6704aabb3ad123de244565366f14d7cb3aae
5
5
  SHA512:
6
- metadata.gz: 664d34162eb36915333317dbd479bf7a08f680057840438c2e497ceabd101d9c2d56348017db0f103590d5f74893b094196f5f1d09603a299e9d38a52b7f25f1
7
- data.tar.gz: c254fbfddf9357815902ac47cf64aabf6092fbe5435a6ffd920db891d7ee01f7a7915632c937f709190fd76bab1c265ae40cc975082ad3e119401e8c9cf0321e
6
+ metadata.gz: 9c1685c870d8e1da30de7f8e2fcdda0f4fe319c1df794b7e064fe9530c6e34f6a520d116d74ba55eadba7553edf0272b2adf15ae9f5e89d19a43767c207c5562
7
+ data.tar.gz: f873b47c9c716ded6463a264ed456016982f9eb119eb3b119cfbf6c276a9472a2964fcca5882b31391f96d284bd588c5b65946d3da638839fadfa58db287fc82
data/exe/episopass CHANGED
@@ -1,8 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'net/http'
4
+ require 'uri'
3
5
  require 'webrick'
4
6
  require "episopass"
5
7
 
8
+ html = ''
9
+ arg = ARGV[0]
10
+ if arg
11
+ if arg =~ /^http/
12
+ html = Net::HTTP.get(URI.parse(arg))
13
+ elsif File.exist?(arg)
14
+ html = File.read(arg)
15
+ end
16
+ else
17
+ html = File.read("#{__dir__}/../data/EpisoPassCLI.html") # gemのファイル指定する方法は?
18
+ end
19
+
6
20
  opencmd = "open"
7
21
  opencmd = "xdg-open" if File.exist?("/usr/bin/xdg-open")
8
22
 
@@ -15,11 +29,10 @@ server = WEBrick::HTTPServer.new( # サーバを立てる
15
29
 
16
30
  # パスワード計算後に/EpisoPassResultに移動
17
31
  server.mount_proc('/EpisoPassCall') do |req, res|
18
- body = File.read("#{__dir__}/../data/EpisoPassCLI.html") # gemのファイル指定する方法は?
19
32
 
20
33
  res.status = 200
21
34
  res['Content-Type'] = 'text/html'
22
- res.body = body
35
+ res.body = html
23
36
  end
24
37
 
25
38
  # /EpisoPassResult?qwerty のような形式でパスワードを返す
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EpisoPass
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: episopass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toshiyuki Masui