letscert 0.4.1 → 0.4.2

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.
@@ -0,0 +1,34 @@
1
+ module LetsCert
2
+ class Runner
3
+
4
+ # Custom logger formatter
5
+ class LoggerFormatter < Logger::Formatter
6
+
7
+ # @private log format
8
+ FORMAT = "[%s] %5s: %s\n".freeze
9
+
10
+ # @private time format string
11
+ TIME_FORMAT = '%Y-%m-%d %H:%M:%S'.freeze
12
+
13
+ # @param [String] severity
14
+ # @param [Datetime] time
15
+ # @param [nil,String] _progname
16
+ # @param [String] msg
17
+ # @return [String]
18
+ def call(severity, time, _progname, msg)
19
+ FORMAT % [format_datetime(time), severity, msg2str(msg)]
20
+ end
21
+
22
+ private
23
+
24
+ # @private simple datetime formatter
25
+ # @param [DateTime] time
26
+ # @return [String]
27
+ def format_datetime(time)
28
+ time.strftime TIME_FORMAT
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,48 @@
1
+ module LetsCert
2
+ class Runner
3
+
4
+ # Class used to process validation time from String.
5
+ # @author Sylvain Daubert
6
+ class ValidTime
7
+
8
+ # @param [String] str time string. May be:
9
+ # * an integer -> time in seconds
10
+ # * an integer plus a letter:
11
+ # * 30m: 30 minutes,
12
+ # * 30h: 30 hours,
13
+ # * 30d: 30 days.
14
+ def initialize(str)
15
+ m = str.match(/^(\d+)([mhd])?$/)
16
+ if m
17
+ @seconds = case m[2]
18
+ when nil
19
+ m[1].to_i
20
+ when 'm'
21
+ m[1].to_i * 60
22
+ when 'h'
23
+ m[1].to_i * 60 * 60
24
+ when 'd'
25
+ m[1].to_i * 24 * 60 * 60
26
+ end
27
+ else
28
+ raise OptionParser::InvalidArgument,
29
+ "invalid argument: --valid-min #{str}"
30
+ end
31
+ @string = str
32
+ end
33
+
34
+ # Get time in seconds
35
+ # @return [Integer]
36
+ def to_seconds
37
+ @seconds
38
+ end
39
+
40
+ # Get time as string
41
+ # @return [String]
42
+ def to_s
43
+ @string
44
+ end
45
+ end
46
+
47
+ end
48
+ end
@@ -1,6 +1,6 @@
1
1
  module LetsCert
2
2
 
3
3
  # Letscert version number
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.2'.freeze
5
5
 
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letscert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Daubert
@@ -31,7 +31,7 @@ cert_chain:
31
31
  dMi8WSKt03lfzyxIqZseBwVYYn+XMlzCcJLXCUgZXHcBRRRDH5wGDqOqXjL25b2O
32
32
  6m3JJngqkCFrOw==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-08-29 00:00:00.000000000 Z
34
+ date: 2016-09-23 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: acme-client
@@ -47,20 +47,6 @@ dependencies:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: 0.4.0
50
- - !ruby/object:Gem::Dependency
51
- name: json
52
- requirement: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - "~>"
55
- - !ruby/object:Gem::Version
56
- version: 1.8.3
57
- type: :runtime
58
- prerelease: false
59
- version_requirements: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - "~>"
62
- - !ruby/object:Gem::Version
63
- version: 1.8.3
64
50
  - !ruby/object:Gem::Dependency
65
51
  name: bundler
66
52
  requirement: !ruby/object:Gem::Requirement
@@ -155,6 +141,7 @@ extensions: []
155
141
  extra_rdoc_files: []
156
142
  files:
157
143
  - ".gitignore"
144
+ - ".rubocop.yml"
158
145
  - Gemfile
159
146
  - LICENSE
160
147
  - README.md
@@ -165,8 +152,18 @@ files:
165
152
  - lib/letscert.rb
166
153
  - lib/letscert/certificate.rb
167
154
  - lib/letscert/io_plugin.rb
155
+ - lib/letscert/io_plugins/account_key.rb
156
+ - lib/letscert/io_plugins/cert_file.rb
157
+ - lib/letscert/io_plugins/chain_file.rb
158
+ - lib/letscert/io_plugins/file_io_plugin_mixin.rb
159
+ - lib/letscert/io_plugins/full_chain_file.rb
160
+ - lib/letscert/io_plugins/jwk_io_plugin_mixin.rb
161
+ - lib/letscert/io_plugins/key_file.rb
162
+ - lib/letscert/io_plugins/openssl_io_plugin.rb
168
163
  - lib/letscert/loggable.rb
169
164
  - lib/letscert/runner.rb
165
+ - lib/letscert/runner/logger_formatter.rb
166
+ - lib/letscert/runner/valid_time.rb
170
167
  - lib/letscert/version.rb
171
168
  homepage: https://github.com/sdaubert/letscert
172
169
  licenses:
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- ��QM���D:��g��#!7j][�v>[�sVg$�=�0r�M�������̍�2vvO�51$��4B�iCw���G�V-�0���oE#^>�٧ϰ%�>7�O�=�oM��%ؒ��
2
- �;�,ۼ���@E#�������ֵ��1�"Y(j֠��8�6�� ���PN�|_v�jAԼ��e�Ҿ2T]�p�JJӲd0^��H>Ͼ���L�'�th>M��m濨�ġL���T�������w+�:ٷU����
1
+ o���_�΋Ne/�kNO�