havesnippet-client 1.1.0 → 1.2.0

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
- SHA1:
3
- metadata.gz: ac4e9b5ee614251051ff34a2616484532590b557
4
- data.tar.gz: 1dd21bd2d50c0703b345ae338a49fd5efc4f3b95
2
+ SHA256:
3
+ metadata.gz: 53dc988b7083baa27b165b60221bc9c10ac21ebbf83c0ad1e31b60d33c3a05ac
4
+ data.tar.gz: 2600f0fc76533942809b698acd984adf54f859c7ef3378a8177f9b770888a18f
5
5
  SHA512:
6
- metadata.gz: 19c0b50dd46667f3654dd66f0a5e811aacf303f500ee971d9cae67ea5e4c5a8591a4ea521d0ec8fd80d2d9862a3ffc8b08451a0d017b0ec991c64a8c7395d18b
7
- data.tar.gz: 7a92a1f0d69addc354a64c4fb9c78f243cd16fc2d31c9b3033f2d11778074892cffa7532e5fe8d3cb991b8bd34b61fb8bcdc3fb9e0d6c6ddff9ca1770ebd23b2
6
+ metadata.gz: bfe54298ec900ddf47aebbdc6c16f1f2730f8cbd25a4ad5fcb96d3d1c72652a5352740d856a6bb60b8e6524c640904ebf16a1644a34755af0cefb0dcd22fd0b4
7
+ data.tar.gz: c715748dd00ab2608ce53a2f7c325753049ad7259a44f61b56c0e7e67368ff761e8f502098daceba7b0ac53e369e0c5cece12972c8513d1d3414865595ce390f
@@ -0,0 +1,11 @@
1
+ # http://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+
8
+ [*.rb]
9
+ indent_size = 2
10
+ indent_style = space
11
+ trim_trailing_whitespace = true
@@ -0,0 +1,2 @@
1
+ pkg
2
+ Gemfile.lock
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ * Wed Sep 05 2018 - version 1.2.0
2
+ - Rename local config to ~/.havesnippet-client
3
+ - Search for configs in /etc/havesnippet-client and /var/secrets/havesnippet-client
4
+ - Read all available configs and merge configuration options
5
+
1
6
  * Sat Nov 19 2016 - version 1.1.0
2
7
  - Fix expiration set by --year and --month
3
8
  - Use DateTime.iso8601 to parse expiration times
@@ -0,0 +1,31 @@
1
+ let
2
+ pkgs = import <nixpkgs> {};
3
+ stdenv = pkgs.stdenv;
4
+
5
+ in stdenv.mkDerivation rec {
6
+ name = "havesnippet-client";
7
+
8
+ buildInputs = [
9
+ pkgs.ruby
10
+ pkgs.git
11
+ pkgs.openssl
12
+ ];
13
+
14
+ shellHook = ''
15
+ mkdir -p /tmp/dev-ruby-gems
16
+ export GEM_HOME="/tmp/dev-ruby-gems"
17
+ export GEM_PATH="$GEM_HOME:$PWD/lib"
18
+ export PATH="$GEM_HOME/bin:$PATH"
19
+
20
+ BUNDLE="$GEM_HOME/bin/bundle"
21
+
22
+ [ ! -x "$BUNDLE" ] && ${pkgs.ruby}/bin/gem install bundler
23
+
24
+ export BUNDLE_PATH="$GEM_HOME"
25
+ export BUNDLE_GEMFILE="$PWD/Gemfile"
26
+
27
+ $BUNDLE install
28
+
29
+ export RUBYOPT=-rbundler/setup
30
+ '';
31
+ }
@@ -33,23 +33,23 @@ END
33
33
  opts.on('-k', '--api-key KEY', 'API key used to authenticate the user') do |v|
34
34
  @opts[:api_key] = v
35
35
  end
36
-
36
+
37
37
  opts.on('-f', '--filename NAME', 'File name, including the extension') do |v|
38
38
  @opts[:file_name] = v
39
39
  end
40
-
40
+
41
41
  opts.on('-l', '--language LANG', 'Language used to highlight the syntax') do |v|
42
42
  @opts[:language] = v
43
43
  end
44
-
44
+
45
45
  opts.on('-L', '--list-languages', 'List available languages') do
46
46
  @opts[:languages] = true
47
47
  end
48
-
48
+
49
49
  opts.on('-t', '--title TITLE', 'Title for the snippet') do |v|
50
50
  @opts[:title] = v
51
51
  end
52
-
52
+
53
53
  opts.on('-a', '--access MODE', ACCESS_MODES, "Accessibility (#{ACCESS_MODES.join(',')})") do |v|
54
54
  @opts[:accessibility] = translate_access(v)
55
55
  end
@@ -76,11 +76,11 @@ END
76
76
  @opts[:expiration] = nil
77
77
  @expiration_delta = nil
78
78
  end
79
-
79
+
80
80
  opts.on('--clear', 'Clear any previously configured options') do
81
81
  @opts.clear
82
82
  end
83
-
83
+
84
84
  opts.on('--save', 'Save settings to config file') do
85
85
  @opts[:save] = true
86
86
  end
@@ -136,12 +136,18 @@ END
136
136
  end
137
137
 
138
138
  def load
139
- return unless File.exists?(config_path)
139
+ rename_config
140
+
141
+ config_paths.each do |path|
142
+ next unless File.exist?(path)
143
+
144
+ cfg = YAML.load(File.read(path))
140
145
 
141
- @opts = YAML.load(File.read(config_path))
142
-
143
- if @opts[:expiration_interval]
144
- @opts[:expiration] = Time.now.to_i + @opts[:expiration_interval]
146
+ if cfg[:expiration_interval]
147
+ cfg[:expiration] = Time.now.to_i + cfg[:expiration_interval]
148
+ end
149
+
150
+ @opts.update(cfg)
145
151
  end
146
152
  end
147
153
 
@@ -157,11 +163,27 @@ END
157
163
  data.delete(:expiration_interval)
158
164
  end
159
165
 
160
- File.open(config_path, 'w') { |f| f.write(YAML.dump(data)) }
166
+ File.open(local_config_path, 'w') { |f| f.write(YAML.dump(data)) }
167
+ end
168
+
169
+ def local_config_path
170
+ File.join(Dir.home, '.havesnippet-client')
161
171
  end
162
172
 
163
- def config_path
164
- File.join(Dir.home, '.havesnippet')
173
+ def config_paths
174
+ [
175
+ '/etc/havesnippet-client',
176
+ '/var/secrets/havesnippet-client',
177
+ local_config_path,
178
+ ]
179
+ end
180
+
181
+ def rename_config
182
+ old = File.join(Dir.home, '.havesnippet')
183
+
184
+ if File.exist?(old) && !File.exist?(local_config_path)
185
+ File.rename(old, local_config_path)
186
+ end
165
187
  end
166
188
  end
167
189
  end
@@ -1,5 +1,5 @@
1
1
  module HaveSnippet
2
2
  module Client
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: havesnippet-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.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-19 00:00:00.000000000 Z
11
+ date: 2018-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.11'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: json
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Client for HaveSnippet, a self-hosted paste service
@@ -61,6 +61,8 @@ executables:
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
+ - ".editorconfig"
65
+ - ".gitignore"
64
66
  - CHANGELOG
65
67
  - Gemfile
66
68
  - LICENSE.txt
@@ -68,6 +70,7 @@ files:
68
70
  - Rakefile
69
71
  - bin/havesnippet
70
72
  - bin/hs
73
+ - default.nix
71
74
  - havesnippet-client.gemspec
72
75
  - lib/havesnippet-client/cli.rb
73
76
  - lib/havesnippet-client/client.rb
@@ -83,19 +86,18 @@ require_paths:
83
86
  - lib
84
87
  required_ruby_version: !ruby/object:Gem::Requirement
85
88
  requirements:
86
- - - '>='
89
+ - - ">="
87
90
  - !ruby/object:Gem::Version
88
91
  version: '0'
89
92
  required_rubygems_version: !ruby/object:Gem::Requirement
90
93
  requirements:
91
- - - '>='
94
+ - - ">="
92
95
  - !ruby/object:Gem::Version
93
96
  version: '0'
94
97
  requirements: []
95
98
  rubyforge_project:
96
- rubygems_version: 2.5.2
99
+ rubygems_version: 2.7.6
97
100
  signing_key:
98
101
  specification_version: 4
99
102
  summary: Client for HaveSnippet, a self-hosted paste service
100
103
  test_files: []
101
- has_rdoc: