summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-05-25 12:51:47 +0200
committerAzul <azul@riseup.net>2016-05-25 12:51:47 +0200
commitb883fa9e91ffd7c526a17f37df54ef63c5c6a4b8 (patch)
tree2291052d1a0bf5eadae43969aa915af44855a0aa /lib
parent69f9b2cb51ff3b9fb3de39f657f734e507ccec68 (diff)
rubocop: initialize and use ruby 1.9 hash syntax
Diffstat (limited to 'lib')
-rw-r--r--lib/nickserver/couch/fetch_key.rb2
-rw-r--r--lib/nickserver/daemon.rb2
-rw-r--r--lib/nickserver/hkp/fetch_key.rb4
-rw-r--r--lib/nickserver/hkp/fetch_key_info.rb4
-rw-r--r--lib/nickserver/server.rb12
5 files changed, 12 insertions, 12 deletions
diff --git a/lib/nickserver/couch/fetch_key.rb b/lib/nickserver/couch/fetch_key.rb
index c671515..3fe2a63 100644
--- a/lib/nickserver/couch/fetch_key.rb
+++ b/lib/nickserver/couch/fetch_key.rb
@@ -24,7 +24,7 @@ module Nickserver; module Couch
#
def couch_request(uid)
query = {"reduce" => "false", "key" => "\"#{uid}\""}
- request = EventMachine::HttpRequest.new(FetchKey.couch_url).get(:timeout => @timeout, :query => query)
+ request = EventMachine::HttpRequest.new(FetchKey.couch_url).get(timeout: @timeout, query: query)
request.callback {|http|
if http.response_header.status != 200
self.fail http.response_header.status, 'Unknown Error'
diff --git a/lib/nickserver/daemon.rb b/lib/nickserver/daemon.rb
index 36fe581..a7326d9 100644
--- a/lib/nickserver/daemon.rb
+++ b/lib/nickserver/daemon.rb
@@ -164,7 +164,7 @@ module Nickserver
#
def redirect_output
if log_path = Config.log_file
- FileUtils.mkdir_p File.dirname(log_path), :mode => 0755
+ FileUtils.mkdir_p File.dirname(log_path), mode: 0755
FileUtils.touch log_path
File.chmod(0600, log_path)
if Config.user && Process::Sys.getuid == 0
diff --git a/lib/nickserver/hkp/fetch_key.rb b/lib/nickserver/hkp/fetch_key.rb
index c24b2c7..44621d3 100644
--- a/lib/nickserver/hkp/fetch_key.rb
+++ b/lib/nickserver/hkp/fetch_key.rb
@@ -26,8 +26,8 @@ module Nickserver; module HKP
# fetches ascii armored OpenPGP public key from the keyserver
#
def get_key_by_fingerprint(key_id)
- params = {:op => 'get', :search => "0x" + key_id, :exact => 'on', :options => 'mr'}
- http = EventMachine::HttpRequest.new(Config.hkp_url).get(:query => params)
+ params = {op: 'get', search: "0x" + key_id, exact: 'on', options: 'mr'}
+ http = EventMachine::HttpRequest.new(Config.hkp_url).get(query: params)
http.callback {
if http.response_header.status != 200
self.fail http.response_header.status, "HKP Request failed"
diff --git a/lib/nickserver/hkp/fetch_key_info.rb b/lib/nickserver/hkp/fetch_key_info.rb
index bc12488..2448bb1 100644
--- a/lib/nickserver/hkp/fetch_key_info.rb
+++ b/lib/nickserver/hkp/fetch_key_info.rb
@@ -10,8 +10,8 @@ module Nickserver; module HKP
def search(uid)
# in practice, exact=on seems to have no effect
- params = {:op => 'vindex', :search => uid, :exact => 'on', :options => 'mr', :fingerprint => 'on'}
- EventMachine::HttpRequest.new(Config.hkp_url).get(:query => params).callback {|http|
+ params = {op: 'vindex', search: uid, exact: 'on', options: 'mr', fingerprint: 'on'}
+ EventMachine::HttpRequest.new(Config.hkp_url).get(query: params).callback {|http|
parser = ParseKeyInfo.new http.response_header, http.response
keys = parser.keys(uid)
if keys.any?
diff --git a/lib/nickserver/server.rb b/lib/nickserver/server.rb
index 9487b43..32afdae 100644
--- a/lib/nickserver/server.rb
+++ b/lib/nickserver/server.rb
@@ -21,7 +21,7 @@ module Nickserver
#
def self.start(opts={})
Nickserver::Config.load
- options = {:host => '127.0.0.1', :port => Nickserver::Config.port.to_i}.merge(opts)
+ options = {host: '127.0.0.1', port: Nickserver::Config.port.to_i}.merge(opts)
unless defined?(TESTING)
puts "Starting nickserver #{options[:host]}:#{options[:port]}"
end
@@ -51,15 +51,15 @@ module Nickserver
private
def send_error(msg = "not supported")
- send_response(:status => 500, :content => "500 #{msg}\n")
+ send_response(status: 500, content: "500 #{msg}\n")
end
def send_not_found(msg = "Not Found")
- send_response(:status => 404, :content => "404 #{msg}\n")
+ send_response(status: 404, content: "404 #{msg}\n")
end
def send_response(opts = {})
- options = {:status => 200, :content_type => 'text/plain', :content => ''}.merge(opts)
+ options = {status: 200, content_type: 'text/plain', content: ''}.merge(opts)
response = EM::DelegatedHttpResponse.new(self)
response.status = options[:status]
response.content_type options[:content_type]
@@ -69,7 +69,7 @@ module Nickserver
def send_key(uid)
get_key_from_uid(uid) do |key|
- send_response :content => format_response(:address => uid, :openpgp => key)
+ send_response content: format_response(address: uid, openpgp: key)
end
end
@@ -98,7 +98,7 @@ module Nickserver
if status == 404
send_not_found
else
- send_response(:status => status, :content => msg)
+ send_response(status: status, content: msg)
end
}
end