Skip to content

Commit

Permalink
Improve code to fit rubocop rules
Browse files Browse the repository at this point in the history
  • Loading branch information
elct9620 committed May 12, 2017
1 parent b644a5a commit cee46e3
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
inherit_from: .rubocop_todo.yml
AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.4
Include:
- Rakefile
- lib/**/*.rake
Exclude:
- Gemfile
- Appraisals
- rails-letsencrypt.gemspec
- lib/generators/lets_encrypt/templates/migration.rb
Rails:
Enabled: true
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
source 'https://rubygems.org'

# Declare your gem's dependencies in lets_encrypt.gemspec.
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'bundler/setup'
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions app/jobs/lets_encrypt/application_job.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module LetsEncrypt
class ApplicationJob < ActiveJob::Base
end
Expand Down
2 changes: 2 additions & 0 deletions app/models/concerns/lets_encrypt/certificate_issuable.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module LetsEncrypt
# :nodoc:
module CertificateIssuable
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/lets_encrypt/certificate_verifiable.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module LetsEncrypt
# :nodoc:
module CertificateVerifiable
Expand Down Expand Up @@ -52,9 +54,7 @@ def retry_on_verify_error(e)
@retries ||= 0
if e.is_a?(Acme::Client::Error::BadNonce) && @retries < 5
@retries += 1
# rubocop:disable Metrics/LineLength
logger.info "Bad nounce encountered. Retrying (#{@retries} of 5 attempts)"
# rubocop:enable Metrics/LineLength
sleep 1
verify
else
Expand Down
2 changes: 2 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

LetsEncrypt::Engine.routes.draw do
get '/acme-challenge/:verification_path', to: 'verifications#show'
end
2 changes: 1 addition & 1 deletion lib/generators/lets_encrypt/register_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def setup_environment
end

def generate_key
# rubocop:disable Metric/LineLength
# rubocop:disable Metrics/LineLength
key_path = ask("Where you to save private key [#{LetsEncrypt.private_key_path}]:", path: true)
# rubocop:enable Metrics/LineLength
key_path = LetsEncrypt.private_key_path if key_path.blank?
Expand Down
6 changes: 4 additions & 2 deletions lib/letsencrypt.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'openssl'
require 'acme-client'
require 'redis'
Expand All @@ -9,8 +11,8 @@

# :nodoc:
module LetsEncrypt
ENDPOINT = 'https://acme-v01.api.letsencrypt.org/'.freeze
ENDPOINT_STAGING = 'https://acme-staging.api.letsencrypt.org'.freeze
ENDPOINT = 'https://acme-v01.api.letsencrypt.org/'
ENDPOINT_STAGING = 'https://acme-staging.api.letsencrypt.org'

class << self
def client
Expand Down
2 changes: 2 additions & 0 deletions lib/letsencrypt/engine.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module LetsEncrypt
# :nodoc:
class Engine < ::Rails::Engine
Expand Down
2 changes: 2 additions & 0 deletions lib/letsencrypt/logger_proxy.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module LetsEncrypt
# :nodoc:
class LoggerProxy
Expand Down
2 changes: 2 additions & 0 deletions lib/letsencrypt/redis.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module LetsEncrypt
# :nodoc:
class Redis
Expand Down
2 changes: 2 additions & 0 deletions lib/letsencrypt/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module LetsEncrypt
VERSION = '0.4.0'
end
2 changes: 2 additions & 0 deletions lib/rails-letsencrypt.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

require 'letsencrypt'
2 changes: 2 additions & 0 deletions rails-letsencrypt.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

$:.push File.expand_path("../lib", __FILE__)

# Maintain your gem's version:
Expand Down
2 changes: 2 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
Expand Down

0 comments on commit cee46e3

Please sign in to comment.