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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c1ad3e038f71529b02ca361f5d43e8d7b4fb232
4
- data.tar.gz: 53615ba0e0e8da3fb3f3b806781161289ad791bb
3
+ metadata.gz: ac4e9b5ee614251051ff34a2616484532590b557
4
+ data.tar.gz: 1dd21bd2d50c0703b345ae338a49fd5efc4f3b95
5
5
  SHA512:
6
- metadata.gz: c49090ebcdc5e2396426e66eb5ec8757da7f35cad89da7c6de084b79e21aabf1bcdff42d252b6696b518574dd13d8dfb30b4cbf265a5645bec0987c93637912a
7
- data.tar.gz: e028d2fe10287bf74038c4152dd3f8d4b0cb671f76ea3c4a167a24e8fb9c8a2cf0397c017022d808b73a068a8f2d4b1bf986258b66c877f693b497d8c07c073a
6
+ metadata.gz: 19c0b50dd46667f3654dd66f0a5e811aacf303f500ee971d9cae67ea5e4c5a8591a4ea521d0ec8fd80d2d9862a3ffc8b08451a0d017b0ec991c64a8c7395d18b
7
+ data.tar.gz: 7a92a1f0d69addc354a64c4fb9c78f243cd16fc2d31c9b3033f2d11778074892cffa7532e5fe8d3cb991b8bd34b61fb8bcdc3fb9e0d6c6ddff9ca1770ebd23b2
data/CHANGELOG ADDED
@@ -0,0 +1,7 @@
1
+ * Sat Nov 19 2016 - version 1.1.0
2
+ - Fix expiration set by --year and --month
3
+ - Use DateTime.iso8601 to parse expiration times
4
+ - New option --forever to disable expiration altogether
5
+
6
+ * Mon Aug 15 2016 - version 1.0.0
7
+ - Initial release
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] = Time.iso8601(v).to_i
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*7*30,
66
- year: 60*60*24*7*30*12
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)) }
@@ -1,5 +1,5 @@
1
1
  module HaveSnippet
2
2
  module Client
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
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.0.0
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-08-15 00:00:00.000000000 Z
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.5
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