Skip to content

Instantly share code, notes, and snippets.

@detournemint
Last active June 28, 2018 14:32
Show Gist options
  • Save detournemint/96d819c19bb58dff3581ea9fd653ccf1 to your computer and use it in GitHub Desktop.
Save detournemint/96d819c19bb58dff3581ea9fd653ccf1 to your computer and use it in GitHub Desktop.
Docker-api log capture
@output = []
@container.start
# sleep 10 # If I put the sleep here, it gives me the output correctly but I don't want to use a sleep.
@container.streaming_logs(stdout: true) { |stream, chunk| @output << chunk }
puts @output
>> ["Cloning https://github.com/RailsApps/learn-rails.git\n"]
Expected Output:
~ docker logs 5be66680bea4
Cloning https://github.com/RailsApps/learn-rails.git
Inspecting 47 files
.CCCCC.CCC.CCC.CC..C..C..CCCCCCCC.CCCCWCCC..CCC
Offenses:
project/Gemfile:4:69: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
^^^
project/Gemfile:15:1: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem coffee-rails should appear before uglifier.
gem 'coffee-rails', '~> 4.2'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/Gemfile:17:1: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem jbuilder should appear before turbolinks.
gem 'jbuilder', '~> 2.5'
^^^^^^^^^^^^^^^^^^^^^^^^
project/Gemfile:19:28: C: Style/SymbolArray: Use %i or %I for an array of symbols.
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
^^^^^^^^^^^^^^^^^^^^^^^^^^
project/Gemfile:25:3: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem listen should appear before web-console.
gem 'listen', '>= 3.0.5', '< 3.2'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/Rakefile:2:81: C: Metrics/LineLength: Line is too long. [90/80]
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
^^^^^^^^^^
project/test/integration/home_page_test.rb:8:1: C: Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.
project/test/test_helper.rb:1:14: C: Style/ExpandPathArguments: Use expand_path('../config/environment', __dir__) instead of expand_path('../../config/environment', __FILE__).
require File.expand_path('../../config/environment', __FILE__)
^^^^^^^^^^^
project/test/test_helper.rb:4:1: C: Style/Documentation: Missing top-level class documentation comment.
class ActiveSupport::TestCase
^^^^^
project/test/test_helper.rb:4:7: C: Style/ClassAndModuleChildren: Use nested module/class definitions instead of compact style.
class ActiveSupport::TestCase
^^^^^^^^^^^^^^^^^^^^^^^
project/test/test_helper.rb:5:81: C: Metrics/LineLength: Line is too long. [82/80]
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
^^
project/test/models/visitor_test.rb:4:1: C: Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.
project/test/models/visitor_test.rb:5:26: C: Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
let(:visitor_params) { {email: 'user@example.com'} }
^
project/test/models/visitor_test.rb:5:52: C: Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
let(:visitor_params) { {email: 'user@example.com'} }
^
project/test/models/visitor_test.rb:18:1: C: Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end.
project/test/models/visitor_test.rb:19:4: C: Layout/TrailingBlankLines: Final newline missing.
end
project/test/mailers/previews/user_mailer_preview.rb:3:1: C: Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning.
project/test/application_system_test_case.rb:1:9: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
require "test_helper"
^^^^^^^^^^^^^
project/test/application_system_test_case.rb:3:1: C: Style/Documentation: Missing top-level class documentation comment.
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
^^^^^
project/config/puma.rb:7:27: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
^^^^^^^^^^^^^^^^^^^
project/config/puma.rb:10:81: C: Metrics/LineLength: Line is too long. [85/80]
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
^^^^^
project/config/puma.rb:12:23: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
port ENV.fetch("PORT") { 3000 }
^^^^^^
project/config/puma.rb:16:23: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
environment ENV.fetch("RAILS_ENV") { "development" }
^^^^^^^^^^^
project/config/puma.rb:16:38: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
environment ENV.fetch("RAILS_ENV") { "development" }
^^^^^^^^^^^^^
project/config/environments/development.rb:1:1: C: Metrics/BlockLength: Block has too many lines. [34/25]
Rails.application.configure do ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/config/environments/development.rb:2:81: C: Metrics/LineLength: Line is too long. [85/80]
# Settings specified here will take precedence over those in config/application.rb.
^^^^^
project/config/environments/development.rb:46:14: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
address: "smtp.sendgrid.net",
^^^^^^^^^^^^^^^^^^^
project/config/environments/development.rb:49:21: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
authentication: "plain",
^^^^^^^
project/config/environments/development.rb:55:48: C: Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
^^^^^^^^
project/config/environments/test.rb:2:81: C: Metrics/LineLength: Line is too long. [85/80]
# Settings specified here will take precedence over those in config/application.rb.
^^^^^
project/config/environments/production.rb:1:1: C: Metrics/BlockLength: Block has too many lines. [33/25]
Rails.application.configure do ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/config/environments/production.rb:2:81: C: Metrics/LineLength: Line is too long. [85/80]
# Settings specified here will take precedence over those in config/application.rb.
^^^^^
project/config/environments/production.rb:33:81: C: Metrics/LineLength: Line is too long. [102/80]
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
^^^^^^^^^^^^^^^^^^^^^^
project/config/environments/production.rb:45:81: C: Metrics/LineLength: Line is too long. [96/80]
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
^^^^^^^^^^^^^^^^
project/config/environments/production.rb:47:81: C: Metrics/LineLength: Line is too long. [96/80]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
^^^^^^^^^^^^^^^^
project/config/environments/production.rb:55:22: C: Layout/SpaceInsideArrayLiteralBrackets: Do not use space inside array brackets.
config.log_tags = [ :request_id ]
^
project/config/environments/production.rb:55:34: C: Layout/SpaceInsideArrayLiteralBrackets: Do not use space inside array brackets.
config.log_tags = [ :request_id ]
^
project/config/environments/production.rb:60:81: C: Metrics/LineLength: Line is too long. [83/80]
# Use a real queuing backend for Active Job (and separate queues per environment)
^^^
project/config/environments/production.rb:66:81: C: Metrics/LineLength: Line is too long. [100/80]
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
^^^^^^^^^^^^^^^^^^^^
project/config/environments/production.rb:81:81: C: Metrics/LineLength: Line is too long. [83/80]
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
^^^
project/config/environments/production.rb:83:10: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
if ENV["RAILS_LOG_TO_STDOUT"].present?
^^^^^^^^^^^^^^^^^^^^^
project/config/environments/production.rb:94:14: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
address: "smtp.sendgrid.net",
^^^^^^^^^^^^^^^^^^^
project/config/environments/production.rb:97:21: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
authentication: "plain",
^^^^^^^
project/config/environments/production.rb:103:48: C: Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
config.action_mailer.default_url_options = { :host => Rails.application.secrets.domain_name }
^^^^^^^^
project/config/environments/production.rb:103:81: C: Metrics/LineLength: Line is too long. [95/80]
config.action_mailer.default_url_options = { :host => Rails.application.secrets.domain_name }
^^^^^^^^^^^^^^^
project/config/spring.rb:1:1: C: Style/PercentLiteralDelimiters: %w-literals should be delimited by [ and ].
%w( ...
^^^
project/config/application.rb:10:3: C: Style/Documentation: Missing top-level class documentation comment.
class Application < Rails::Application
^^^^^
project/config/application.rb:14:81: C: Metrics/LineLength: Line is too long. [82/80]
# Settings in config/environments/* take precedence over those specified here.
^^
project/config/initializers/backtrace_silencers.rb:3:81: C: Metrics/LineLength: Line is too long. [107/80]
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/config/initializers/backtrace_silencers.rb:6:81: C: Metrics/LineLength: Line is too long. [112/80]
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/config/initializers/wrap_parameters.rb:6:81: C: Metrics/LineLength: Line is too long. [96/80]
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
^^^^^^^^^^^^^^^^
project/config/routes.rb:3:30: C: Style/SymbolArray: Use %i or %I for an array of symbols.
resources :contacts, only: [:new, :create]
^^^^^^^^^^^^^^^
project/config/routes.rb:4:30: C: Style/SymbolArray: Use %i or %I for an array of symbols.
resources :visitors, only: [:new, :create]
^^^^^^^^^^^^^^^
project/bin/spring:11:56: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
spring = lockfile.specs.detect { |spec| spec.name == "spring" }
^^^^^^^^
project/bin/update:4:1: C: Style/MixinUsage: include is used at the top level. Use inside class or module.
include FileUtils
^^^^^^^^^^^^^^^^^
project/bin/update:7:30: C: Style/ExpandPathArguments: Use expand_path('..', __dir__) instead of expand_path('../../', __FILE__).
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
^^^^^^^^^^^
project/bin/rake:3:13: C: Style/ExpandPathArguments: Use expand_path('spring', __dir__) instead of expand_path('../spring', __FILE__).
load File.expand_path('../spring', __FILE__)
^^^^^^^^^^^
project/bin/bundle:2:32: C: Style/ExpandPathArguments: Use expand_path('../Gemfile', __dir__) instead of expand_path('../../Gemfile', __FILE__).
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
^^^^^^^^^^^
project/bin/setup:4:1: C: Style/MixinUsage: include is used at the top level. Use inside class or module.
include FileUtils
^^^^^^^^^^^^^^^^^
project/bin/setup:7:30: C: Style/ExpandPathArguments: Use expand_path('..', __dir__) instead of expand_path('../../', __FILE__).
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
^^^^^^^^^^^
project/bin/setup:24:1: C: Layout/EmptyLines: Extra blank line detected.
project/bin/rails:3:13: C: Style/ExpandPathArguments: Use expand_path('spring', __dir__) instead of expand_path('../spring', __FILE__).
load File.expand_path('../spring', __FILE__)
^^^^^^^^^^^
project/bin/yarn:5:31: C: Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
exec "yarnpkg #{ARGV.join(" ")}"
^^^
project/bin/yarn:7:5: C: Style/StderrPuts: Use warn instead of $stderr.puts to allow such output to be disabled.
$stderr.puts "Yarn executable was not detected in the system."
^^^^^^^^^^^^
project/bin/yarn:7:18: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
$stderr.puts "Yarn executable was not detected in the system."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/bin/yarn:8:5: C: Style/StderrPuts: Use warn instead of $stderr.puts to allow such output to be disabled.
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
^^^^^^^^^^^^
project/bin/yarn:8:18: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/app/controllers/application_controller.rb:1:1: C: Style/Documentation: Missing top-level class documentation comment.
class ApplicationController < ActionController::Base
^^^^^
project/app/controllers/visitors_controller.rb:1:1: C: Style/Documentation: Missing top-level class documentation comment.
class VisitorsController < ApplicationController
^^^^^
project/app/controllers/visitors_controller.rb:2:1: C: Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning.
project/app/controllers/visitors_controller.rb:23:1: C: Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body end.
project/app/controllers/contacts_controller.rb:1:1: C: Style/Documentation: Missing top-level class documentation comment.
class ContactsController < ApplicationController
^^^^^
project/app/controllers/contacts_controller.rb:2:1: C: Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning.
project/app/controllers/contacts_controller.rb:23:1: C: Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body end.
project/app/models/application_record.rb:1:1: C: Style/Documentation: Missing top-level class documentation comment.
class ApplicationRecord < ActiveRecord::Base
^^^^^
project/app/models/contact.rb:1:1: C: Style/Documentation: Missing top-level class documentation comment.
class Contact
^^^^^
project/app/models/contact.rb:4:3: W: Lint/DuplicateMethods: Method Contact#string is defined at both project/app/models/contact.rb:3 and project/app/models/contact.rb:4.
attr_accessor :email, :string
^^^^^^^^^^^^^
project/app/models/contact.rb:5:3: W: Lint/DuplicateMethods: Method Contact#string is defined at both project/app/models/contact.rb:3 and project/app/models/contact.rb:5.
attr_accessor :content, :string
^^^^^^^^^^^^^
project/app/models/contact.rb:11:5: C: Layout/AlignParameters: Align the parameters of a method call if they span more than one line.
with: /\A[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}\z/i
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/app/models/contact.rb:12:33: C: Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
validates_length_of :content, :maximum => 500
^^^^^^^^^^^
project/app/models/contact.rb:13:1: C: Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body end.
project/app/models/visitor.rb:1:1: C: Style/Documentation: Missing top-level class documentation comment.
class Visitor
^^^^^
project/app/models/visitor.rb:5:81: C: Metrics/LineLength: Line is too long. [87/80]
validates_format_of :email, with: /\A[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}\z/i
^^^^^^^
project/app/models/visitor.rb:8:81: C: Metrics/LineLength: Line is too long. [89/80]
mailchimp = Gibbon::Request.new(api_key: Rails.application.secrets.mailchimp_api_key)
^^^^^^^^^
project/app/models/visitor.rb:12:24: C: Style/RedundantSelf: Redundant self detected.
email_address: self.email,
^^^^^^^^^^
project/app/models/visitor.rb:14:5: C: Layout/IndentHash: Indent the right brace the same as the start of the line where the left brace is.
})
^
project/app/models/visitor.rb:14:6: C: Layout/MultilineMethodCallBraceLayout: Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
})
^
project/app/models/visitor.rb:15:37: C: Style/RedundantSelf: Redundant self detected.
Rails.logger.info("Subscribed #{self.email} to MailChimp") if result
^^^^^^^^^^
project/app/models/visitor.rb:17:1: C: Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body end.
project/app/mailers/application_mailer.rb:1:1: C: Style/Documentation: Missing top-level class documentation comment.
class ApplicationMailer < ActionMailer::Base
^^^^^
project/app/mailers/user_mailer.rb:1:1: C: Style/Documentation: Missing top-level class documentation comment.
class UserMailer < ApplicationMailer
^^^^^
project/app/mailers/user_mailer.rb:2:17: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
default from: "do-not-reply@example.com"
^^^^^^^^^^^^^^^^^^^^^^^^^^
project/app/mailers/user_mailer.rb:6:75: C: Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
mail(to: Rails.application.secrets.owner_email, from: @contact.email, :subject => "Website Contact")
^^^^^^^^^^^
project/app/mailers/user_mailer.rb:6:81: C: Metrics/LineLength: Line is too long. [104/80]
mail(to: Rails.application.secrets.owner_email, from: @contact.email, :subject => "Website Contact")
^^^^^^^^^^^^^^^^^^^^^^^^
project/app/mailers/user_mailer.rb:6:87: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
mail(to: Rails.application.secrets.owner_email, from: @contact.email, :subject => "Website Contact")
^^^^^^^^^^^^^^^^^
project/app/helpers/application_helper.rb:1:1: C: Style/Documentation: Missing top-level module documentation comment.
module ApplicationHelper
^^^^^^
project/db/seeds.rb:1:81: C: Metrics/LineLength: Line is too long. [103/80]
# This file should contain all the record creation needed to seed the database with its default values.
^^^^^^^^^^^^^^^^^^^^^^^
project/db/seeds.rb:2:81: C: Metrics/LineLength: Line is too long. [111/80]
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project/db/seeds.rb:6:81: C: Metrics/LineLength: Line is too long. [81/80]
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
^
project/db/schema.rb:3:81: C: Metrics/LineLength: Line is too long. [81/80]
# incrementally modify your database, and then regenerate this schema definition.
^
project/db/schema.rb:8:81: C: Metrics/LineLength: Line is too long. [86/80]
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
^^^^^^
project/db/schema.rb:11:81: C: Metrics/LineLength: Line is too long. [86/80]
# It's strongly recommended that you check this file into your version control system.
^^^^^^
project/db/schema.rb:14:1: C: Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.
47 files inspected, 103 offenses detected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment