Skip to content

Commit

Permalink
Merge pull request #292 from mroth/peg-rubocop-gem-and-fix-issues
Browse files Browse the repository at this point in the history
Peg RuboCop gem to 0.37.2 and fix any remaining cop issues
  • Loading branch information
matthutchinson committed Feb 20, 2016
2 parents aabf69c + 2de742e commit 3ab9700
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Rake::TestTask.new do |t|
end

Rake::FileUtilsExt.verbose(false)
CUKE_RESULTS = 'results.html'
CUKE_RESULTS = 'results.html'.freeze
CLEAN << CUKE_RESULTS
Cucumber::Rake::Task.new(:features) do |t|
optstr = "features --format html -o #{CUKE_RESULTS} --format Fivemat -x"
Expand Down
5 changes: 2 additions & 3 deletions bin/lolcommits
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def do_capture
}

# fire off runner with the overriden fake commit metadata
runner = Lolcommits::Runner.new(capture_options.merge override_text)
runner = Lolcommits::Runner.new(capture_options.merge(override_text))
runner.run

# automatically open so user can see the test image results immediately
Expand Down Expand Up @@ -322,8 +322,7 @@ elsif Choice.choices[:plugins]
configuration.puts_plugins
elsif Choice.choices[:devices]
puts Platform.device_list
puts "Specify a device with --device=\"{device name}\" "\
'or set the LOLCOMMITS_DEVICE env variable'
puts 'Specify a device with --device="{device name}" or set the LOLCOMMITS_DEVICE env variable'
elsif Choice.choices[:last]
do_last
elsif Choice.choices[:browse]
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/lolcommits_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def default_loldir
loldir = absolute_path("~/.lolcommits/#{repo}")
FileUtils.mkdir_p loldir
num_images.to_i.times do
hex = "#{format '%011x', (rand * 0xfffffffffff)}"
hex = format('%011x', (rand * 0xfffffffffff)).to_s
FileUtils.cp 'test/images/test_image.jpg', File.join(loldir, "#{hex}.jpg")
end
end
Expand Down
2 changes: 1 addition & 1 deletion features/support/path_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module PathHelpers
def reject_paths_with_cmd(cmd)
# make a new subdir that still contains cmds
tmpbindir = File.expand_path(File.join @dirs, 'bin')
tmpbindir = File.expand_path(File.join(@dirs, 'bin'))
FileUtils.mkdir_p tmpbindir

preseve_cmds_in_path(%w(git mplayer), tmpbindir)
Expand Down
2 changes: 1 addition & 1 deletion lib/lolcommits/capturer/capture_linux_animated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def video_fps(file)

def frame_skip(fps)
# of frames to skip depends on movie fps
case (fps)
case fps
when 0..15
2
when 16..28
Expand Down
2 changes: 1 addition & 1 deletion lib/lolcommits/capturer/capture_mac_animated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def video_fps(file)

def frame_skip(fps)
# of frames to skip depends on movie fps
case (fps)
case fps
when 0..15
2
when 16..28
Expand Down
2 changes: 1 addition & 1 deletion lib/lolcommits/cli/timelapse_gif.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def run(args = nil)
gif = MiniMagick::Image.new File.join @configuration.archivedir, filename

# This is for ruby 1.8.7, *lolimages just doesn't work with ruby 187
gif.run_command('convert', *['-delay', '50', '-loop', '0', lolimages, "#{gif.path}"].flatten)
gif.run_command('convert', *['-delay', '50', '-loop', '0', lolimages, gif.path.to_s].flatten)

puts "*** #{gif.path} generated."
end
Expand Down
4 changes: 2 additions & 2 deletions lib/lolcommits/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def archivedir
end

def most_recent
Dir.glob(File.join loldir, '*.{jpg,gif}').max_by { |f| File.mtime(f) }
Dir.glob(File.join(loldir, '*.{jpg,gif}')).max_by { |f| File.mtime(f) }
end

def jpg_images
Dir.glob(File.join loldir, '*.jpg').sort_by { |f| File.mtime(f) }
Dir.glob(File.join(loldir, '*.jpg')).sort_by { |f| File.mtime(f) }
end

def jpg_images_today
Expand Down
2 changes: 1 addition & 1 deletion lib/lolcommits/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.capturer_class(animate = false)
elsif platform_cygwin?
CaptureCygwin
else
fail 'Unknown / Unsupported Platform.'
raise 'Unknown / Unsupported Platform.'
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/lolcommits/plugins/dot_com.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Lolcommits
class DotCom < Plugin
BASE_URL = 'http://lolcommits-dot-com.herokuapp.com'
BASE_URL = 'http://lolcommits-dot-com.herokuapp.com'.freeze

def initialize(runner)
super
Expand Down
2 changes: 1 addition & 1 deletion lib/lolcommits/plugins/lol_slack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Lolcommits
class LolSlack < Plugin
ENDPOINT_URL = 'https://slack.com/api/files.upload'
ENDPOINT_URL = 'https://slack.com/api/files.upload'.freeze
RETRY_COUNT = 2

def self.name
Expand Down
13 changes: 5 additions & 8 deletions lib/lolcommits/plugins/lol_tumblr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

module Lolcommits
class LolTumblr < Plugin
TUMBLR_API_ENDPOINT = 'https://www.tumblr.com'
TUMBLR_CONSUMER_KEY = '2FtMEDpEPkxjoUdkpHh42h9wqTu9IVS7Ra0QyNZGixdCvhllN2'
TUMBLR_CONSUMER_SECRET = 'qWuvxgFUR2YyWKtbWOkDTMAiBEbj7ZGaNLaNQPba0PI1N4JpBs'
TUMBLR_API_ENDPOINT = 'https://www.tumblr.com'.freeze
TUMBLR_CONSUMER_KEY = '2FtMEDpEPkxjoUdkpHh42h9wqTu9IVS7Ra0QyNZGixdCvhllN2'.freeze
TUMBLR_CONSUMER_SECRET = 'qWuvxgFUR2YyWKtbWOkDTMAiBEbj7ZGaNLaNQPba0PI1N4JpBs'.freeze

def run_postcapture
return unless valid_configuration?
Expand All @@ -29,11 +29,8 @@ def configure_options!
# ask user to configure tokens if enabling
if options['enabled']
auth_config = configure_auth!
if auth_config
options = options.merge(auth_config).merge(configure_tumblr_name)
else
return # return nil if configure_auth failed
end
return unless auth_config
options = options.merge(auth_config).merge(configure_tumblr_name)
end
options
end
Expand Down
15 changes: 6 additions & 9 deletions lib/lolcommits/plugins/lol_twitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

module Lolcommits
class LolTwitter < Plugin
TWITTER_API_ENDPOINT = 'https://api.twitter.com'
TWITTER_CONSUMER_KEY = 'qc096dJJCxIiqDNUqEsqQ'
TWITTER_CONSUMER_SECRET = 'rvjNdtwSr1H0TvBvjpk6c4bvrNydHmmbvv7gXZQI'
TWITTER_API_ENDPOINT = 'https://api.twitter.com'.freeze
TWITTER_CONSUMER_KEY = 'qc096dJJCxIiqDNUqEsqQ'.freeze
TWITTER_CONSUMER_SECRET = 'rvjNdtwSr1H0TvBvjpk6c4bvrNydHmmbvv7gXZQI'.freeze
TWITTER_RETRIES = 2
TWITTER_PIN_REGEX = /^\d{4,}$/ # 4 or more digits
DEFAULT_SUFFIX = '#lolcommits'
DEFAULT_SUFFIX = '#lolcommits'.freeze

def run_postcapture
return unless valid_configuration?
Expand Down Expand Up @@ -50,11 +50,8 @@ def configure_options!
# ask user to configure tokens if enabling
if options['enabled']
auth_config = configure_auth!
if auth_config
options = options.merge(auth_config).merge(configure_prefix_suffix)
else
return # return nil if configure_auth failed
end
return unless auth_config
options = options.merge(auth_config).merge(configure_prefix_suffix)
end
options
end
Expand Down
15 changes: 6 additions & 9 deletions lib/lolcommits/plugins/lol_yammer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
require 'rest_client'

# https://developer.yammer.com/oauth2-quickstart/
YAMMER_CLIENT_ID = 'bgORyeKtnjZJSMwp8oln9g'
YAMMER_CLIENT_SECRET = 'oer2WdGzh74a5QBbW3INUxblHK3yg9KvCZmiBa2r0'
YAMMER_ACCESS_TOKEN_URL = 'https://www.yammer.com/oauth2/access_token.json'
YAMMER_CLIENT_ID = 'bgORyeKtnjZJSMwp8oln9g'.freeze
YAMMER_CLIENT_SECRET = 'oer2WdGzh74a5QBbW3INUxblHK3yg9KvCZmiBa2r0'.freeze
YAMMER_ACCESS_TOKEN_URL = 'https://www.yammer.com/oauth2/access_token.json'.freeze
YAMMER_RETRY_COUNT = 2

module Lolcommits
Expand All @@ -28,7 +28,7 @@ def configure_access_token
print 'Enter code param from the redirected URL, then press enter: '
code = STDIN.gets.to_s.strip

url = "#{YAMMER_ACCESS_TOKEN_URL}"
url = YAMMER_ACCESS_TOKEN_URL
debug "access_token url: #{url}"
params = {
'client_id' => YAMMER_CLIENT_ID,
Expand All @@ -47,11 +47,8 @@ def configure_options!
# ask user to configure tokens if enabling
if options['enabled']
auth_config = configure_access_token
if auth_config
options.merge!(auth_config)
else
return # return nil if configure_auth failed
end
return unless auth_config
options.merge!(auth_config)
end
options
end
Expand Down
3 changes: 1 addition & 2 deletions lib/lolcommits/plugins/tranzlate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module Lolspeak
/want/ => %w(wants),
/ead\b/ => %w(edd),
/ck/ => %w(kk kkk),
/sion/ => %w(shun),
/cat|kitten|kitty/ => %w(kitteh kittehz cat fuzzeh fuzzyrumpus foozles fuzzbut fluffernutter beast mew),
/eak/ => %w(ekk),
/age/ => %w(uj),
Expand Down Expand Up @@ -79,7 +78,7 @@ module Lolspeak
/can\si\s(?:ple(?:a|e)(?:s|z)e?)?\s?have\sa/ => ['i can haz'],
/(?:hello|\bhi\b|\bhey\b|howdy|\byo\b),?/ => ['oh hai,'],
/(?:god\b|allah|buddah?|diety|lord)/ => ['ceiling cat']
}
}.freeze

def tranzlate(str)
lolstr = str.dup
Expand Down
14 changes: 8 additions & 6 deletions lib/lolcommits/plugins/uploldz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ class Uploldz < Plugin

def initialize(runner)
super
options.concat(%w(
endpoint
optional_key
optional_http_auth_username
optional_http_auth_password
))
options.concat(
%w(
endpoint
optional_key
optional_http_auth_username
optional_http_auth_password
)
)
end

def run_postcapture
Expand Down
2 changes: 1 addition & 1 deletion lib/lolcommits/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding : utf-8 -*-
module Lolcommits
VERSION = '0.6.1'
VERSION = '0.6.1'.freeze
end
2 changes: 1 addition & 1 deletion lolcommits.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ Gem::Specification.new do |s|

if RUBY_VERSION >= '1.9.3'
s.add_development_dependency('travis', '~> 1.7.4')
s.add_development_dependency('rubocop', '~> 0.35')
s.add_development_dependency('rubocop', '~> 0.37.2')
end
end

0 comments on commit 3ab9700

Please sign in to comment.