From 1fd3b7cf1b1555bcee0670f20c2a8cc304689b6a Mon Sep 17 00:00:00 2001 From: David Stancu Date: Sun, 30 Apr 2017 16:24:33 -0400 Subject: [PATCH 1/2] basic linting --- Gemfile | 9 +++++- Gemfile.lock | 24 +++++++++++++- Rakefile | 6 ++-- .../swagger_engine/application_controller.rb | 14 +++++---- .../swagger_engine/swaggers_controller.rb | 31 +++++++++++++------ .../swagger_engine/application_helper.rb | 2 ++ app/helpers/swagger_engine/swagger_helper.rb | 2 ++ bin/rails | 2 ++ config/routes.rb | 4 ++- lib/swagger_engine.rb | 4 ++- lib/swagger_engine/engine.rb | 19 ++++++------ lib/swagger_engine/version.rb | 4 ++- lib/tasks/swagger_engine_tasks.rake | 1 + swagger_engine.gemspec | 24 +++++++------- .../swagger_engine/swagger_controller_test.rb | 2 ++ test/dummy/Rakefile | 2 ++ .../app/controllers/application_controller.rb | 2 ++ test/dummy/app/helpers/application_helper.rb | 2 ++ test/dummy/bin/bundle | 2 ++ test/dummy/bin/rails | 4 ++- test/dummy/bin/rake | 2 ++ test/dummy/config.ru | 4 ++- test/dummy/config/application.rb | 13 ++++---- test/dummy/config/boot.rb | 2 ++ test/dummy/config/environment.rb | 2 ++ test/dummy/config/environments/development.rb | 2 ++ test/dummy/config/environments/production.rb | 2 ++ test/dummy/config/environments/test.rb | 4 ++- .../initializers/backtrace_silencers.rb | 1 + .../initializers/filter_parameter_logging.rb | 2 ++ test/dummy/config/initializers/inflections.rb | 1 + test/dummy/config/initializers/mime_types.rb | 1 + .../dummy/config/initializers/secret_token.rb | 2 ++ .../config/initializers/session_store.rb | 2 ++ .../config/initializers/wrap_parameters.rb | 2 ++ test/dummy/config/routes.rb | 5 +-- .../swagger_engine/swagger_helper_test.rb | 2 ++ test/integration/navigation_test.rb | 4 +-- test/swagger_engine_test.rb | 4 ++- test/test_helper.rb | 10 +++--- 40 files changed, 164 insertions(+), 63 deletions(-) diff --git a/Gemfile b/Gemfile index 1899644..1e25b64 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,6 @@ -source "https://rubygems.org" +# frozen_string_literal: true + +source 'https://rubygems.org' # Declare your gem's dependencies in swagger_engine.gemspec. # Bundler will treat runtime dependencies like base dependencies, and @@ -12,3 +14,8 @@ gemspec # To use debugger # gem 'debugger' + +group :development do + gem 'pry' + gem 'rubocop' +end diff --git a/Gemfile.lock b/Gemfile.lock index b290c72..bc6995e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,12 +6,34 @@ PATH GEM remote: https://rubygems.org/ specs: + ast (2.3.0) + coderay (1.1.1) + method_source (0.8.2) + parser (2.4.0.0) + ast (~> 2.2) + powerpack (0.1.1) + pry (0.10.4) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + rainbow (2.2.1) + rubocop (0.48.1) + parser (>= 2.3.3.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) + slop (3.6.0) + unicode-display_width (1.2.1) PLATFORMS ruby DEPENDENCIES + pry + rubocop swagger_engine! BUNDLED WITH - 1.11.2 + 1.14.6 diff --git a/Rakefile b/Rakefile index 7be4047..2564b24 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + begin require 'bundler/setup' rescue LoadError @@ -14,9 +16,6 @@ RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_files.include('lib/**/*.rb') end - - - Bundler::GemHelper.install_tasks require 'rake/testtask' @@ -28,5 +27,4 @@ Rake::TestTask.new(:test) do |t| t.verbose = false end - task default: :test diff --git a/app/controllers/swagger_engine/application_controller.rb b/app/controllers/swagger_engine/application_controller.rb index 7a582fe..4dd0cff 100644 --- a/app/controllers/swagger_engine/application_controller.rb +++ b/app/controllers/swagger_engine/application_controller.rb @@ -1,16 +1,18 @@ +# frozen_string_literal: true + module SwaggerEngine class ApplicationController < ActionController::Base - before_filter :authenticate protected + def authenticate - if SwaggerEngine.configuration.admin_username - authenticate_or_request_with_http_basic do |username, password| - username == SwaggerEngine.configuration.admin_username && password == SwaggerEngine.configuration.admin_password - end + return unless SwaggerEngine.configuration.admin_username + + authenticate_or_request_with_http_basic do |username, password| + username == SwaggerEngine.configuration.admin_username \ + && password == SwaggerEngine.configuration.admin_password end end - end end diff --git a/app/controllers/swagger_engine/swaggers_controller.rb b/app/controllers/swagger_engine/swaggers_controller.rb index a78f8e9..6387765 100644 --- a/app/controllers/swagger_engine/swaggers_controller.rb +++ b/app/controllers/swagger_engine/swaggers_controller.rb @@ -1,4 +1,6 @@ -require_dependency "swagger_engine/application_controller" +# frozen_string_literal: true + +require_dependency 'swagger_engine/application_controller' module SwaggerEngine class SwaggersController < ApplicationController @@ -7,23 +9,34 @@ class SwaggersController < ApplicationController before_filter :load_json_files def index - redirect_to swagger_path(@json_files.first[0]) if ( @json_files.size == 1 ) + redirect_to swagger_path(@json_files.first[0]) if @json_files.size == 1 end def show respond_to do |format| - format.html { - @swagger_json_url = swagger_path(params[:id], format: :json) - } - format.json { - send_file @json_files[params[:id].to_sym], type: 'application/json', disposition: 'inline' - } + format.html { show_html } + format.json { show_json } end end private + + def show_html + @swagger_json_url = swagger_path(params[:id], format: :json) + end + + def show_json + send_file( + @json_files[params[:id].to_sym], + type: 'application/json', + disposition: 'inline' + ) + end + def load_json_files - @json_files ||= SwaggerEngine.configuration.json_files || { default: "#{Rails.root}/lib/swagger_engine/swagger.json" } + @json_files ||= SwaggerEngine.configuration.json_files || { + default: "#{Rails.root}/lib/swagger_engine/swagger.json" + } end end end diff --git a/app/helpers/swagger_engine/application_helper.rb b/app/helpers/swagger_engine/application_helper.rb index b104aa7..085abe5 100644 --- a/app/helpers/swagger_engine/application_helper.rb +++ b/app/helpers/swagger_engine/application_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SwaggerEngine module ApplicationHelper end diff --git a/app/helpers/swagger_engine/swagger_helper.rb b/app/helpers/swagger_engine/swagger_helper.rb index 9d9353a..2ceb3c1 100644 --- a/app/helpers/swagger_engine/swagger_helper.rb +++ b/app/helpers/swagger_engine/swagger_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SwaggerEngine module SwaggerHelper end diff --git a/bin/rails b/bin/rails index 30c08fe..fcc0e3e 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application. ENGINE_ROOT = File.expand_path('../..', __FILE__) diff --git a/config/routes.rb b/config/routes.rb index 59c0d32..5506693 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,6 @@ +# frozen_string_literal: true + SwaggerEngine::Engine.routes.draw do - resources :swaggers, only: [:index, :show] + resources :swaggers, only: %i[index show] root to: 'swaggers#index' end diff --git a/lib/swagger_engine.rb b/lib/swagger_engine.rb index 83528a3..f70ea10 100644 --- a/lib/swagger_engine.rb +++ b/lib/swagger_engine.rb @@ -1,4 +1,6 @@ -require "swagger_engine/engine" +# frozen_string_literal: true + +require 'swagger_engine/engine' module SwaggerEngine end diff --git a/lib/swagger_engine/engine.rb b/lib/swagger_engine/engine.rb index 2bcf2df..c16a358 100644 --- a/lib/swagger_engine/engine.rb +++ b/lib/swagger_engine/engine.rb @@ -1,21 +1,19 @@ +# frozen_string_literal: true + module SwaggerEngine class Engine < ::Rails::Engine isolate_namespace SwaggerEngine - #https://gist.github.com/parndt/11381872 -=begin - initializer "swagger_engine.assets.precompile", group: :all do |app| - app.config.assets.precompile += ['swagger_engine/print.css', 'swagger_engine/reset.css'] - end -=end + # https://gist.github.com/parndt/11381872 config.to_prepare do - Rails.application.config.assets.precompile += ['swagger_engine/print.css', 'swagger_engine/reset.css'] + Rails.application.config.assets.precompile += %w[ + swagger_engine/print.css swagger_engine/reset.css + ] end - end class Configuration - #[{ default: "swagger.json" }] + # [{ default: "swagger.json" }] attr_accessor :json_files attr_accessor :admin_username attr_accessor :admin_password @@ -25,6 +23,7 @@ class << self end module_function + def configuration @configuration ||= Configuration.new end @@ -32,4 +31,4 @@ def configuration def configure yield(configuration) end - end +end diff --git a/lib/swagger_engine/version.rb b/lib/swagger_engine/version.rb index f0ad498..0a178d5 100644 --- a/lib/swagger_engine/version.rb +++ b/lib/swagger_engine/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SwaggerEngine - VERSION = "0.0.3" + VERSION = '0.0.3' end diff --git a/lib/tasks/swagger_engine_tasks.rake b/lib/tasks/swagger_engine_tasks.rake index 8e9d0fb..f93faa1 100644 --- a/lib/tasks/swagger_engine_tasks.rake +++ b/lib/tasks/swagger_engine_tasks.rake @@ -1,3 +1,4 @@ +# frozen_string_literal: true # desc "Explaining what the task does" # task :swagger_engine do # # Task goes here diff --git a/swagger_engine.gemspec b/swagger_engine.gemspec index f577bbf..053247d 100644 --- a/swagger_engine.gemspec +++ b/swagger_engine.gemspec @@ -1,19 +1,21 @@ -$:.push File.expand_path("../lib", __FILE__) +# frozen_string_literal: true + +$LOAD_PATH.push File.expand_path('../lib', __FILE__) # Maintain your gem's version: -require "swagger_engine/version" +require 'swagger_engine/version' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| - s.name = "swagger_engine" + s.name = 'swagger_engine' s.version = SwaggerEngine::VERSION - s.authors = ["batdevis"] - s.email = ["batdevis@gmail.com"] - s.homepage = "https://github.com/batdevis/swagger_engine" - s.summary = "Mount swagger-ui as rails engine." - s.description = "Api docs inside your rails project." - s.license = "MIT" + s.authors = ['batdevis'] + s.email = ['batdevis@gmail.com'] + s.homepage = 'https://github.com/batdevis/swagger_engine' + s.summary = 'Mount swagger-ui as rails engine.' + s.description = 'Api docs inside your rails project.' + s.license = 'MIT' - s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] - s.test_files = Dir["test/**/*"] + s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc'] + s.test_files = Dir['test/**/*'] end diff --git a/test/controllers/swagger_engine/swagger_controller_test.rb b/test/controllers/swagger_engine/swagger_controller_test.rb index 24a580c..e142f36 100644 --- a/test/controllers/swagger_engine/swagger_controller_test.rb +++ b/test/controllers/swagger_engine/swagger_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' module SwaggerEngine diff --git a/test/dummy/Rakefile b/test/dummy/Rakefile index 4135d7a..bdad2f7 100644 --- a/test/dummy/Rakefile +++ b/test/dummy/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. diff --git a/test/dummy/app/controllers/application_controller.rb b/test/dummy/app/controllers/application_controller.rb index d83690e..1ff0944 100644 --- a/test/dummy/app/controllers/application_controller.rb +++ b/test/dummy/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. diff --git a/test/dummy/app/helpers/application_helper.rb b/test/dummy/app/helpers/application_helper.rb index de6be79..15b06f0 100644 --- a/test/dummy/app/helpers/application_helper.rb +++ b/test/dummy/app/helpers/application_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module ApplicationHelper end diff --git a/test/dummy/bin/bundle b/test/dummy/bin/bundle index 66e9889..58115ec 100755 --- a/test/dummy/bin/bundle +++ b/test/dummy/bin/bundle @@ -1,3 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) load Gem.bin_path('bundler', 'bundle') diff --git a/test/dummy/bin/rails b/test/dummy/bin/rails index 728cd85..33f4d55 100755 --- a/test/dummy/bin/rails +++ b/test/dummy/bin/rails @@ -1,4 +1,6 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +# frozen_string_literal: true + +APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands' diff --git a/test/dummy/bin/rake b/test/dummy/bin/rake index 1724048..c199955 100755 --- a/test/dummy/bin/rake +++ b/test/dummy/bin/rake @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/test/dummy/config.ru b/test/dummy/config.ru index 5bc2a61..61c04e1 100644 --- a/test/dummy/config.ru +++ b/test/dummy/config.ru @@ -1,4 +1,6 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path('../config/environment', __FILE__) run Rails.application diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 5e57452..9a8e545 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -1,14 +1,16 @@ +# frozen_string_literal: true + require File.expand_path('../boot', __FILE__) # Pick the frameworks you want: # require "active_record/railtie" -require "action_controller/railtie" -require "action_mailer/railtie" -require "sprockets/railtie" -require "rails/test_unit/railtie" +require 'action_controller/railtie' +require 'action_mailer/railtie' +require 'sprockets/railtie' +require 'rails/test_unit/railtie' Bundler.require(*Rails.groups) -require "swagger_engine" +require 'swagger_engine' module Dummy class Application < Rails::Application @@ -25,4 +27,3 @@ class Application < Rails::Application # config.i18n.default_locale = :de end end - diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb index 6266cfc..1853653 100644 --- a/test/dummy/config/boot.rb +++ b/test/dummy/config/boot.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__) diff --git a/test/dummy/config/environment.rb b/test/dummy/config/environment.rb index 10e0cad..0be51cf 100644 --- a/test/dummy/config/environment.rb +++ b/test/dummy/config/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load the Rails application. require File.expand_path('../application', __FILE__) diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb index cd9e6e3..57c0824 100644 --- a/test/dummy/config/environments/development.rb +++ b/test/dummy/config/environments/development.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb index b690b1c..a7d2e60 100644 --- a/test/dummy/config/environments/production.rb +++ b/test/dummy/config/environments/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb index f8b102b..e15a7d2 100644 --- a/test/dummy/config/environments/test.rb +++ b/test/dummy/config/environments/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -14,7 +16,7 @@ # Configure static asset server for tests with Cache-Control for performance. config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" + config.static_cache_control = 'public, max-age=3600' # Show full error reports and disable caching. config.consider_all_requests_local = true diff --git a/test/dummy/config/initializers/backtrace_silencers.rb b/test/dummy/config/initializers/backtrace_silencers.rb index 59385cd..d0f0d3b 100644 --- a/test/dummy/config/initializers/backtrace_silencers.rb +++ b/test/dummy/config/initializers/backtrace_silencers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. diff --git a/test/dummy/config/initializers/filter_parameter_logging.rb b/test/dummy/config/initializers/filter_parameter_logging.rb index 4a994e1..7a4f47b 100644 --- a/test/dummy/config/initializers/filter_parameter_logging.rb +++ b/test/dummy/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. diff --git a/test/dummy/config/initializers/inflections.rb b/test/dummy/config/initializers/inflections.rb index ac033bf..aa7435f 100644 --- a/test/dummy/config/initializers/inflections.rb +++ b/test/dummy/config/initializers/inflections.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/test/dummy/config/initializers/mime_types.rb b/test/dummy/config/initializers/mime_types.rb index 72aca7e..f75864f 100644 --- a/test/dummy/config/initializers/mime_types.rb +++ b/test/dummy/config/initializers/mime_types.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: diff --git a/test/dummy/config/initializers/secret_token.rb b/test/dummy/config/initializers/secret_token.rb index b030a95..6d782f1 100644 --- a/test/dummy/config/initializers/secret_token.rb +++ b/test/dummy/config/initializers/secret_token.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. diff --git a/test/dummy/config/initializers/session_store.rb b/test/dummy/config/initializers/session_store.rb index 155f7b0..ba27628 100644 --- a/test/dummy/config/initializers/session_store.rb +++ b/test/dummy/config/initializers/session_store.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' diff --git a/test/dummy/config/initializers/wrap_parameters.rb b/test/dummy/config/initializers/wrap_parameters.rb index b81ea74..6fd7d42 100644 --- a/test/dummy/config/initializers/wrap_parameters.rb +++ b/test/dummy/config/initializers/wrap_parameters.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb index 184d173..c8e576a 100644 --- a/test/dummy/config/routes.rb +++ b/test/dummy/config/routes.rb @@ -1,4 +1,5 @@ -Rails.application.routes.draw do +# frozen_string_literal: true - mount SwaggerEngine::Engine => "/swagger_engine" +Rails.application.routes.draw do + mount SwaggerEngine::Engine => '/swagger_engine' end diff --git a/test/helpers/swagger_engine/swagger_helper_test.rb b/test/helpers/swagger_engine/swagger_helper_test.rb index b154871..1c490d5 100644 --- a/test/helpers/swagger_engine/swagger_helper_test.rb +++ b/test/helpers/swagger_engine/swagger_helper_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' module SwaggerEngine diff --git a/test/integration/navigation_test.rb b/test/integration/navigation_test.rb index eec8c0e..91d920f 100644 --- a/test/integration/navigation_test.rb +++ b/test/integration/navigation_test.rb @@ -1,9 +1,9 @@ +# frozen_string_literal: true + require 'test_helper' class NavigationTest < ActionDispatch::IntegrationTest - # test "the truth" do # assert true # end end - diff --git a/test/swagger_engine_test.rb b/test/swagger_engine_test.rb index 72cbc23..58782e3 100644 --- a/test/swagger_engine_test.rb +++ b/test/swagger_engine_test.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + require 'test_helper' class SwaggerEngineTest < ActiveSupport::TestCase - test "truth" do + test 'truth' do assert_kind_of Module, SwaggerEngine end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 1e26a31..0c166bf 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Configure Rails Environment -ENV["RAILS_ENV"] = "test" +ENV['RAILS_ENV'] = 'test' -require File.expand_path("../dummy/config/environment.rb", __FILE__) -require "rails/test_help" +require File.expand_path('../dummy/config/environment.rb', __FILE__) +require 'rails/test_help' Rails.backtrace_cleaner.remove_silencers! @@ -11,5 +13,5 @@ # Load fixtures from the engine if ActiveSupport::TestCase.method_defined?(:fixture_path=) - ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__) + ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__) end From ac4403310afb32d0a89b07e685afb03ab984f24f Mon Sep 17 00:00:00 2001 From: David Stancu Date: Sun, 30 Apr 2017 16:34:51 -0400 Subject: [PATCH 2/2] update readme, move deps to gemspec, add MRI 2.4.0 as .ruby-version --- .rubocop.yml | 13 +++++++++++++ .ruby-version | 1 + Gemfile | 16 ---------------- README.md | 18 ++++++------------ swagger_engine.gemspec | 3 +++ 5 files changed, 23 insertions(+), 28 deletions(-) create mode 100644 .rubocop.yml create mode 100644 .ruby-version diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..1ef3315 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +AllCops: + DisplayCopNames: true + Exclude: + - Gemfile + - ./*.gemspec + - ./bin/**/* + - ./test/**/* + +Style/Documentation: + Enabled: false + +Lint/Debugger: + Enabled: false \ No newline at end of file diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..197c4d5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.4.0 diff --git a/Gemfile b/Gemfile index 1e25b64..7f4f5e9 100644 --- a/Gemfile +++ b/Gemfile @@ -2,20 +2,4 @@ source 'https://rubygems.org' -# Declare your gem's dependencies in swagger_engine.gemspec. -# Bundler will treat runtime dependencies like base dependencies, and -# development dependencies will be added by default to the :development group. gemspec - -# Declare any dependencies that are still in development here instead of in -# your gemspec. These might include edge Rails or gems from your path or -# Git. Remember to move these dependencies to your gemspec before releasing -# your gem to rubygems.org. - -# To use debugger -# gem 'debugger' - -group :development do - gem 'pry' - gem 'rubocop' -end diff --git a/README.md b/README.md index f6726ac..78a90fd 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,6 @@ -# LOOKING FOR MAINTAINER - -I'm sorry but I can't maintain this project anymore. - -If you want to maintain this project, contact me (batdevis[at]gmail.com) and I will transfer the ownership. - # SwaggerEngine -Include [swagger-ui](https://github.com/swagger-api/swagger-ui) as rails engine. +Include [swagger-ui](https://github.com/swagger-api/swagger-ui) as Rails engine. ## Swagger specifications @@ -40,7 +34,7 @@ authenticate :user, lambda { |u| u.admin? } do end ``` -#### Basic http auth +#### Basic HTTP Auth Set username and password in `config/initializers/swagger_engine.rb`: @@ -53,7 +47,7 @@ end ## Configure -### Json files +### JSON files Set the path of your json files in a initializer: @@ -69,9 +63,9 @@ end ``` `lib/swagger/` is a good place to place them.. -### Edit your json files +### Edit your JSON files -Use [Swagger editor](https://github.com/swagger-api/swagger-editor). +Use [Swagger Editor](https://github.com/swagger-api/swagger-editor). ## License @@ -81,4 +75,4 @@ This project rocks and uses MIT-LICENSE. [Rawfish](http://rawfishindustries.com) -[![Rawfish Logo](http://rawfishindustries.com/wp-content/uploads/2015/03/logo_rawfish_WEB.jpg)](http://rawfishindustries.com) +[![Rawfish Logo](http://rawfishindustries.com/wp-content/uploads/2016/07/rawfish-logo-black.png)](http://rawfishindustries.com) diff --git a/swagger_engine.gemspec b/swagger_engine.gemspec index 053247d..17716cd 100644 --- a/swagger_engine.gemspec +++ b/swagger_engine.gemspec @@ -16,6 +16,9 @@ Gem::Specification.new do |s| s.description = 'Api docs inside your rails project.' s.license = 'MIT' + s.add_development_dependency('pry') + s.add_development_dependency('rubocop') + s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc'] s.test_files = Dir['test/**/*'] end