Add frozen string literal comment to files.

This commit is contained in:
Guo Xiang Tan 2019-05-13 11:16:32 +08:00
parent 6ffba0676a
commit 00617a1fb5
11 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
source 'https://rubygems.org'
group :development do

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require_dependency 'docker_manager/git_repo'
require_dependency 'docker_manager/upgrader'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module DockerManager
class ApplicationController < ActionController::Base
helper DockerManager::ApplicationHelper

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module DockerManager::ApplicationHelper
def discourse_root_url
Discourse.base_uri

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
# Usage:
# bundle install

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
DockerManager::Engine.routes.draw do
get "admin/docker", to: redirect("/admin/upgrade"), constraints: AdminConstraint.new
get "admin/upgrade" => "admin#index", constraints: AdminConstraint.new

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# like Grit just very very minimal
class DockerManager::GitRepo
attr_reader :path, :name, :branch
@ -96,7 +98,7 @@ class DockerManager::GitRepo
return unless result.present?
if result =~ /-(\d+)-/
result.gsub!(/-(\d+)-.*/, " +#{$1}")
result = result.gsub(/-(\d+)-.*/, " +#{$1}")
end
result
end
@ -106,7 +108,7 @@ class DockerManager::GitRepo
end
def commit_date(commit)
unix_timestamp = run('show -s --format="%ct" ' << commit).to_i
unix_timestamp = run(+'show -s --format="%ct" ' << commit).to_i
Time.at(unix_timestamp).to_datetime
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class DockerManager::Upgrader
def initialize(user_id, repos, from_version)
@ -121,7 +123,7 @@ class DockerManager::Upgrader
def run(cmd)
log "$ #{cmd}"
msg = ""
msg = +""
allowed_env = %w{
PWD

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# name: docker_manager
# about: Docker manager for Discourse image
# version: 0.1
@ -6,7 +8,7 @@
module ::DockerManager
# should be automatic, but something is weird
load File.expand_path(File.dirname(__FILE__)) << '/app/helpers/application_helper.rb'
load File.expand_path(File.dirname(__FILE__)) + '/app/helpers/application_helper.rb'
class Engine < ::Rails::Engine
engine_name "docker_manager"
isolate_namespace DockerManager

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
require 'docker_manager/git_repo'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe DockerManager::AdminController do