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' source 'https://rubygems.org'
group :development do group :development do

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
DockerManager::Engine.routes.draw do DockerManager::Engine.routes.draw do
get "admin/docker", to: redirect("/admin/upgrade"), constraints: AdminConstraint.new get "admin/docker", to: redirect("/admin/upgrade"), constraints: AdminConstraint.new
get "admin/upgrade" => "admin#index", 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 # like Grit just very very minimal
class DockerManager::GitRepo class DockerManager::GitRepo
attr_reader :path, :name, :branch attr_reader :path, :name, :branch
@ -96,7 +98,7 @@ class DockerManager::GitRepo
return unless result.present? return unless result.present?
if result =~ /-(\d+)-/ if result =~ /-(\d+)-/
result.gsub!(/-(\d+)-.*/, " +#{$1}") result = result.gsub(/-(\d+)-.*/, " +#{$1}")
end end
result result
end end
@ -106,7 +108,7 @@ class DockerManager::GitRepo
end end
def commit_date(commit) 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 Time.at(unix_timestamp).to_datetime
end end

View File

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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# name: docker_manager # name: docker_manager
# about: Docker manager for Discourse image # about: Docker manager for Discourse image
# version: 0.1 # version: 0.1
@ -6,7 +8,7 @@
module ::DockerManager module ::DockerManager
# should be automatic, but something is weird # 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 class Engine < ::Rails::Engine
engine_name "docker_manager" engine_name "docker_manager"
isolate_namespace DockerManager isolate_namespace DockerManager

View File

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

View File

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