havesnippet-client 1.0.0 → 1.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -0
- data/README.md +1 -0
- data/lib/havesnippet-client/cli.rb +12 -3
- data/lib/havesnippet-client/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac4e9b5ee614251051ff34a2616484532590b557
|
4
|
+
data.tar.gz: 1dd21bd2d50c0703b345ae338a49fd5efc4f3b95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19c0b50dd46667f3654dd66f0a5e811aacf303f500ee971d9cae67ea5e4c5a8591a4ea521d0ec8fd80d2d9862a3ffc8b08451a0d017b0ec991c64a8c7395d18b
|
7
|
+
data.tar.gz: 7a92a1f0d69addc354a64c4fb9c78f243cd16fc2d31c9b3033f2d11778074892cffa7532e5fe8d3cb991b8bd34b61fb8bcdc3fb9e0d6c6ddff9ca1770ebd23b2
|
data/CHANGELOG
ADDED
data/README.md
CHANGED
@@ -31,6 +31,7 @@ There are two executables, `havesnippet` and its abbreviation `hs`.
|
|
31
31
|
--week Expiration in one week
|
32
32
|
--month Expiration in one month
|
33
33
|
--year Expiration in one year
|
34
|
+
--forever Disable expiration
|
34
35
|
--clear Clear any previously configured options
|
35
36
|
--save Save settings to config file
|
36
37
|
-h, --help Show this message and exit
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'date'
|
1
2
|
require 'optparse'
|
2
3
|
require 'time'
|
3
4
|
require 'yaml'
|
@@ -55,21 +56,26 @@ END
|
|
55
56
|
|
56
57
|
opts.on('-e', '--expiration DATE', 'Date of expiration in ISO 8601') do |v|
|
57
58
|
@expiration_delta = nil
|
58
|
-
@opts[:expiration] =
|
59
|
+
@opts[:expiration] = DateTime.iso8601(v).to_time.to_i
|
59
60
|
end
|
60
61
|
|
61
62
|
{
|
62
63
|
hour: 60*60,
|
63
64
|
day: 60*60*24,
|
64
65
|
week: 60*60*24*7,
|
65
|
-
month: 60*60*24*
|
66
|
-
year: 60*60*24*
|
66
|
+
month: 60*60*24*30,
|
67
|
+
year: 60*60*24*30*12,
|
67
68
|
}.each do |k, v|
|
68
69
|
opts.on("--#{k}", "Expiration in one #{k}") do
|
69
70
|
@opts[:expiration] = Time.now.to_i + v
|
70
71
|
@expiration_delta = v
|
71
72
|
end
|
72
73
|
end
|
74
|
+
|
75
|
+
opts.on('--forever', 'Disable expiration') do
|
76
|
+
@opts[:expiration] = nil
|
77
|
+
@expiration_delta = nil
|
78
|
+
end
|
73
79
|
|
74
80
|
opts.on('--clear', 'Clear any previously configured options') do
|
75
81
|
@opts.clear
|
@@ -146,6 +152,9 @@ END
|
|
146
152
|
if @expiration_delta
|
147
153
|
data[:expiration_interval] = @expiration_delta
|
148
154
|
data.delete(:expiration)
|
155
|
+
|
156
|
+
else
|
157
|
+
data.delete(:expiration_interval)
|
149
158
|
end
|
150
159
|
|
151
160
|
File.open(config_path, 'w') { |f| f.write(YAML.dump(data)) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: havesnippet-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Skokan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -61,6 +61,7 @@ executables:
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
+
- CHANGELOG
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
93
|
version: '0'
|
93
94
|
requirements: []
|
94
95
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.2
|
96
|
+
rubygems_version: 2.5.2
|
96
97
|
signing_key:
|
97
98
|
specification_version: 4
|
98
99
|
summary: Client for HaveSnippet, a self-hosted paste service
|