lolitado 0.0.7 → 0.0.8

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: 60aba2a596d0b30bf8d00686f88b96207ac719d72320d1f5e0efa59847c07113
4
- data.tar.gz: 3b6dc09b94cfc1d5da6c97b9d71455abe89e9e57ec759f6b0106e436adba087f
3
+ metadata.gz: 9c680b69ccfdd2b65f17e34620494d141e94241a9ffbf7b475baf370a323eaa4
4
+ data.tar.gz: 7f7b4b404ae6d9d8bc6d54c612216f1d125caf3b7c4fd65ad29410c50c61a2da
5
5
  SHA512:
6
- metadata.gz: 3903f7f7fb762ba87637b47e987a7eb59a99a0b3977675779efc93c22b0d89519ec55d4d7e00e51448f198b11fc9bf48256146abb21c25ec49cc99c6764099c7
7
- data.tar.gz: 2587a69b01397949a3dbb1745f50c4aef31f4ea0c4fce097b0b656f788cbd3293189f4989acd46220641edce69c83d4a576f23b0fcaee33851287aaefb302829
6
+ metadata.gz: d522c333a7c845b3bf34f5bb24d331fea0b51cc57d54e2a697619ad98abe682672678a3b0181d0eef5a344d6daf580e0dbdb41216b65c25fdd413c1f27f68744
7
+ data.tar.gz: edb4a324e9a147514005ee259f50f1a2b25187e6988a5e5824e2c108cb03be32f4d3ad10b57bbaa3a1106bda3d1bcb951d03265114d8bb9832b2791f51bfde07
data/lib/box.rb ADDED
@@ -0,0 +1,29 @@
1
+ require 'rbnacl'
2
+ require 'base64'
3
+
4
+ class Box
5
+
6
+ def initialize key
7
+ key_env = ENV[key]
8
+ if key_env.nil?
9
+ puts "There's no environment variable #{key}..."
10
+ return
11
+ end
12
+ key = Base64.decode64(key_env)
13
+ @box = RbNaCl::SimpleBox.from_secret_key(key)
14
+ end
15
+
16
+ def file_encrypt file
17
+ plaintext = File.read(file)
18
+ ciphertext = @box.encrypt(plaintext)
19
+ enc_file = file + '.enc'
20
+ File.write(enc_file, Base64.encode64(ciphertext))
21
+ end
22
+
23
+ def file_decrypt file
24
+ ciphertext = File.read(file)
25
+ plaintext = @box.decrypt(Base64.decode64(ciphertext))
26
+ plain_file = file[0..-5]
27
+ File.write(plain_file, plaintext)
28
+ end
29
+ end
data/lib/db.rb CHANGED
@@ -9,7 +9,7 @@ class DBFactory
9
9
  @db = db
10
10
  end
11
11
 
12
- def query sql, waiting_time = 10
12
+ def query sql
13
13
  result = db[sql].all
14
14
  return result
15
15
  end
data/lib/lolitado.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'pool'
2
2
  require 'db'
3
3
  require 'request'
4
+ require 'box'
4
5
 
5
6
  module LolitaDo
6
7
  class LolitaClass
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lolitado
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolitado
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dolores Zhang
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.14'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rbnacl-libsodium
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.0.10
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.0.10
69
83
  description: Lolitado DSL that works with Watir
70
84
  email:
71
85
  - 379808610@qq.com
@@ -74,6 +88,7 @@ extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
76
90
  - lib/accessors.rb
91
+ - lib/box.rb
77
92
  - lib/db.rb
78
93
  - lib/lolitado.rb
79
94
  - lib/pool.rb