Merge pull request #223 from okkez/rails5.x

Update Rails to 5.2.0
This commit is contained in:
okkez 2018-04-20 17:31:23 +09:00 committed by GitHub
commit 620e88c1a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 335 additions and 334 deletions

View File

@ -1,9 +1,21 @@
rvm: 2.1.3
rvm: 2.2.10
sudo: required
addons:
- chrome: stable
env:
global:
DISPLAY: ":99.0"
before_install:
- google-chrome-stable --version
- wget http://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- sudo mv chromedriver /usr/local/bin/chromedriver
install:
- bundle -v
- gem i bundler
- sudo sh -c 'curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-precise-td-agent2.sh | sh'
- sudo sh -c 'curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent2.sh | sh'
- bundle install --jobs=4 --retry=4

12
Gemfile
View File

@ -12,17 +12,17 @@ group :development, :test do
end
group :development do
gem 'i18n_generators', '1.2.1'
gem 'i18n_generators', '2.1.1'
gem 'better_errors'
gem 'web-console', '~> 2.0'
gem 'web-console', '~> 3.6'
end
group :test do
gem "factory_girl_rails"
gem "capybara", "~> 2.4.0"
gem "factory_bot_rails"
gem "capybara", "~> 3.0.2"
gem "capybara-screenshot"
gem "simplecov", "~> 0.16.1", require: false
gem "webmock", "~> 1.18.0"
gem "webmock", "~> 3.3.0"
gem "timecop"
gem "poltergeist"
gem "selenium-webdriver", "~> 3.11"
end

View File

@ -5,7 +5,7 @@ PATH
addressable
bundler
diff-lcs
draper (~> 2.1)
draper (~> 3.0)
fluentd (>= 0.10.56, < 0.14)
font-awesome-rails
haml-rails (~> 1.0)
@ -15,109 +15,104 @@ PATH
kramdown (> 1.0.0)
kramdown-haml
puma
rails (~> 4.2.0)
rails (~> 5.2.0)
rubyzip (~> 1.1)
sass-rails (~> 4.0.3)
sass-rails (~> 5.0.7)
settingslogic
sucker_punch (~> 1.6.0)
sucker_punch (~> 2.0.4)
thor
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.10)
actionpack (= 4.2.10)
actionview (= 4.2.10)
activejob (= 4.2.10)
actioncable (5.2.0)
actionpack (= 5.2.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.10)
actionview (= 4.2.10)
activesupport (= 4.2.10)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-dom-testing (~> 2.0)
actionpack (5.2.0)
actionview (= 5.2.0)
activesupport (= 5.2.0)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.10)
activesupport (= 4.2.10)
actionview (5.2.0)
activesupport (= 5.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (4.2.10)
activesupport (= 4.2.10)
globalid (>= 0.3.0)
activemodel (4.2.10)
activesupport (= 4.2.10)
activejob (5.2.0)
activesupport (= 5.2.0)
globalid (>= 0.3.6)
activemodel (5.2.0)
activesupport (= 5.2.0)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (4.2.10)
activemodel (= 4.2.10)
activesupport (= 4.2.10)
arel (~> 6.0)
activesupport (4.2.10)
i18n (~> 0.7)
activerecord (5.2.0)
activemodel (= 5.2.0)
activesupport (= 5.2.0)
arel (>= 9.0)
activestorage (5.2.0)
actionpack (= 5.2.0)
activerecord (= 5.2.0)
marcel (~> 0.3.1)
activesupport (5.2.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
arel (6.0.4)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
arel (9.0.0)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bindex (0.5.0)
builder (3.2.3)
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-screenshot (1.0.14)
capybara (>= 1.0, < 3)
capybara (3.0.2)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
xpath (~> 3.0)
capybara-screenshot (1.0.19)
capybara (>= 1.0, < 4)
launchy
celluloid (0.17.3)
celluloid-essentials
celluloid-extras
celluloid-fsm
celluloid-pool
celluloid-supervision
timers (>= 4.1.1)
celluloid-essentials (0.20.5)
timers (>= 4.1.1)
celluloid-extras (0.20.5)
timers (>= 4.1.1)
celluloid-fsm (0.20.5)
timers (>= 4.1.1)
celluloid-pool (0.20.5)
timers (>= 4.1.1)
celluloid-supervision (0.20.6)
timers (>= 4.1.1)
cliver (0.3.2)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
coderay (1.1.1)
concurrent-ruby (1.0.5)
cool.io (1.5.3)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.4)
debug_inspector (0.0.2)
diff-lcs (1.3)
docile (1.3.0)
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0)
draper (2.1.0)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
draper (3.0.1)
actionpack (~> 5.0)
activemodel (~> 5.0)
activemodel-serializers-xml (~> 1.0)
activesupport (~> 5.0)
request_store (~> 1.0)
erubi (1.7.1)
erubis (2.7.0)
factory_girl (4.8.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
factory_bot_rails (4.8.2)
factory_bot (~> 4.8.2)
railties (>= 3.0.0)
ffi (1.9.23)
fluentd (0.12.43)
cool.io (>= 1.2.2, < 2.0.0)
http_parser.rb (>= 0.5.1, < 0.7.0)
@ -141,26 +136,22 @@ GEM
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
hike (1.2.3)
hitimes (1.2.6)
hashdiff (0.3.7)
html2haml (2.2.0)
erubis (~> 2.7.0)
haml (>= 4.0, < 6)
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
http-cookie (1.0.3)
domain_name (~> 0.5)
http_parser.rb (0.6.0)
httpclient (2.8.3)
i18n (0.9.5)
i18n (1.0.1)
concurrent-ruby (~> 1.0)
i18n_generators (1.2.1)
mechanize
i18n_generators (2.1.1)
rails (>= 3.0.0)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-rails (4.3.1)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
@ -175,69 +166,57 @@ GEM
nokogiri (>= 1.5.9)
mail (2.7.0)
mini_mime (>= 0.1.1)
mechanize (2.7.5)
domain_name (~> 0.5, >= 0.5.1)
http-cookie (~> 1.0)
mime-types (>= 1.17.2)
net-http-digest_auth (~> 1.1, >= 1.1.1)
net-http-persistent (~> 2.5, >= 2.5.2)
nokogiri (~> 1.6)
ntlm-http (~> 0.1, >= 0.1.1)
webrobots (>= 0.0.9, < 0.2)
marcel (0.3.2)
mimemagic (~> 0.3.2)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mimemagic (0.3.2)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
msgpack (1.2.4)
multi_json (1.13.1)
net-http-digest_auth (1.4.1)
net-http-persistent (2.9.4)
nio4r (2.3.0)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
ntlm-http (0.1.1)
poltergeist (1.14.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rails (0.3.6)
pry (>= 0.10.4)
public_suffix (2.0.5)
public_suffix (3.0.2)
puma (3.11.4)
rack (1.6.9)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.10)
actionmailer (= 4.2.10)
actionpack (= 4.2.10)
actionview (= 4.2.10)
activejob (= 4.2.10)
activemodel (= 4.2.10)
activerecord (= 4.2.10)
activesupport (= 4.2.10)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.10)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.9)
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rack (2.0.4)
rack-test (1.0.0)
rack (>= 1.0, < 3)
rails (5.2.0)
actioncable (= 5.2.0)
actionmailer (= 5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
activemodel (= 5.2.0)
activerecord (= 5.2.0)
activestorage (= 5.2.0)
activesupport (= 5.2.0)
bundler (>= 1.3.0)
railties (= 5.2.0)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (4.2.10)
actionpack (= 4.2.10)
activesupport (= 4.2.10)
railties (5.2.0)
actionpack (= 5.2.0)
activesupport (= 5.2.0)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
request_store (1.4.1)
rack (>= 1.4)
rspec-core (3.5.4)
@ -261,12 +240,20 @@ GEM
sexp_processor (~> 4.9)
rubyzip (1.2.1)
safe_yaml (1.0.4)
sass (3.2.19)
sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.2)
sprockets (~> 2.8, < 3.0)
sprockets-rails (~> 2.0)
sass (3.5.6)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.11.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
settingslogic (2.0.9)
sexp_processor (4.11.0)
sigdump (0.2.4)
@ -276,46 +263,39 @@ GEM
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
slop (3.6.0)
sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
string-scrub (0.0.5)
sucker_punch (1.6.0)
celluloid (~> 0.17.2)
sucker_punch (2.0.4)
concurrent-ruby (~> 1.0.0)
temple (0.8.0)
thor (0.20.0)
thread_safe (0.3.6)
tilt (1.4.1)
tilt (2.0.8)
timecop (0.8.1)
timers (4.1.2)
hitimes
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2018.4)
tzinfo (>= 1.0.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.4)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
webmock (1.18.0)
web-console (3.6.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webmock (3.3.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
webrobots (0.1.2)
websocket-driver (0.6.5)
hashdiff
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)
websocket-extensions (0.1.3)
xpath (3.0.0)
nokogiri (~> 1.8)
yajl-ruby (1.3.1)
PLATFORMS
@ -323,20 +303,20 @@ PLATFORMS
DEPENDENCIES
better_errors
capybara (~> 2.4.0)
capybara (~> 3.0.2)
capybara-screenshot
factory_girl_rails
factory_bot_rails
fluentd-ui!
i18n_generators (= 1.2.1)
poltergeist
i18n_generators (= 2.1.1)
pry
pry-rails
rake
rspec-rails (~> 3.0)
selenium-webdriver (~> 3.11)
simplecov (~> 0.16.1)
timecop
web-console (~> 2.0)
webmock (~> 1.18.0)
web-console (~> 3.6)
webmock (~> 3.3.0)
BUNDLED WITH
1.16.1

View File

@ -28,7 +28,7 @@ module SettingHistoryConcern
else
flash = { danger: @fluentd.agent.log.tail(1).first }
end
redirect_to :back, flash: flash
redirect_back fallback_location: root_url, flash: flash
end
end

View File

@ -19,7 +19,7 @@ class MiscController < ApplicationController
end
def upgrading_status
if FluentdUiRestart::LOCK.present?
if FluentdUiRestartJob::LOCK.present?
return render text: "updating"
end
@ -73,6 +73,6 @@ class MiscController < ApplicationController
end
def update!
FluentdUiRestart.new.async.perform
FluentdUiRestart.perform_later
end
end

View File

@ -17,27 +17,27 @@ class PluginsController < ApplicationController
def install
params[:plugins].each do |gem_name|
GemInstaller.new.async.perform(gem_name)
GemInstallerJob.perform_later(gem_name)
end
redirect_to plugins_path
end
def uninstall
params[:plugins].each do |gem_name|
GemUninstaller.new.async.perform(gem_name)
GemUninstallerJob.perform_later(gem_name)
end
redirect_to plugins_path
end
def upgrade
GemInstaller.new.async.perform(params[:plugins][:name], params[:plugins][:version])
GemInstallerJob.perform_later(params[:plugins][:name], params[:plugins][:version])
redirect_to plugins_path
end
def bulk_upgrade
params[:plugins].each do |gem_name|
pl = Plugin.new(gem_name: gem_name)
GemInstaller.new.async.perform(gem_name, pl.latest_version)
GemInstallerJob.perform_later(gem_name, pl.latest_version)
end
redirect_to plugins_path
end

View File

@ -0,0 +1,10 @@
class AllPluginCheckUpdateJob < ApplicationJob
queue_as :default
def perform(*args)
Plugin.installed.each do |pl|
GemUpdateCheckJob.perform_later(pl.gem_name)
end
AllPluginCheckUpdateJob.set(wait: 1.hour).perform_later # will be checked every hour
end
end

View File

@ -0,0 +1,2 @@
class ApplicationJob < ActiveJob::Base
end

View File

@ -1,5 +1,5 @@
class FluentdUiRestart
include SuckerPunch::Job
class FluentdUiRestartJob < ApplicationJob
queue_as :default
LOCK = []
@ -20,7 +20,7 @@ class FluentdUiRestart
lock!
# NOTE: install will be failed before released fluentd-ui gem
SuckerPunch.logger.info "[restart] install new fluentd-ui"
logger.info "[restart] install new fluentd-ui"
Plugin.new(gem_name: "fluentd-ui").install!
if Rails.env.production?
@ -29,7 +29,7 @@ class FluentdUiRestart
cmd = %W(bundle exec rails s)
end
SuckerPunch.logger.info "[restart] will restart"
logger.info "[restart] will restart"
Bundler.with_clean_env do
restarter = "#{Rails.root}/bin/fluentd-ui-restart"
Process.spawn(*[restarter, $$.to_s, *cmd, *ARGV]) && Process.kill(:TERM, $$)

View File

@ -0,0 +1,11 @@
class FluentdUiUpdateCheckJob < ApplicationJob
queue_as :default
def perform
pl = Plugin.new(gem_name: "fluentd-ui")
if pl.gem_versions
FluentdUI.latest_version = pl.latest_version
end
FluentdUiUpdateCheckJob.set(wait: 1.hour).perform_later # will be checked every hour
end
end

View File

@ -1,6 +1,5 @@
class GemInstaller
include SuckerPunch::Job
workers 16
class GemInstallerJob < ApplicationJob
queue_as :default
def perform(gem_name, version = nil)
SuckerPunch.logger.info "install #{gem_name} #{version}"
@ -9,9 +8,9 @@ class GemInstaller
# NOTE: uninstall all versions of `gem_name` then install it for upgrade/downgrade
pl.uninstall! if pl.installed?
pl.install!
SuckerPunch.logger.info "installed #{gem_name} #{version}"
logger.info "installed #{gem_name} #{version}"
rescue Plugin::GemError
SuckerPunch.logger.warn "installing #{gem_name} #{version} is failed"
logger.warn "installing #{gem_name} #{version} is failed"
end
end
end

View File

@ -0,0 +1,14 @@
class GemUninstallerJob < ApplicationJob
queue_as :default
def perform(gem_name)
logger.info "uninstall #{gem_name}"
pl = Plugin.new(gem_name: gem_name)
begin
pl.uninstall!
logger.info "uninstalled #{gem_name}"
rescue Plugin::GemError
logger.warn "uninstalling #{gem_name} is failed"
end
end
end

View File

@ -0,0 +1,9 @@
class GemUpdateCheckJob < ApplicationJob
queue_as :default
def perform(gem_name)
logger.info "check #{gem_name} latest version"
pl = Plugin.new(gem_name: gem_name)
pl.gem_versions!
end
end

View File

@ -1,14 +0,0 @@
class AllPluginCheckUpdate
include SuckerPunch::Job
def perform
Plugin.installed.each do |pl|
GemUpdateCheck.new.async.perform(pl.gem_name)
end
later(3600) # will be checked every hour
end
def later(sec)
after(sec) { perform }
end
end

View File

@ -1,15 +0,0 @@
class FluentdUiUpdateCheck
include SuckerPunch::Job
def perform
pl = Plugin.new(gem_name: "fluentd-ui")
if pl.gem_versions
FluentdUI.latest_version = pl.latest_version
end
later(3600) # will be checked every hour
end
def later(sec)
after(sec) { perform }
end
end

View File

@ -1,15 +0,0 @@
class GemUninstaller
include SuckerPunch::Job
workers 16
def perform(gem_name)
SuckerPunch.logger.info "uninstall #{gem_name}"
pl = Plugin.new(gem_name: gem_name)
begin
pl.uninstall!
SuckerPunch.logger.info "uninstalled #{gem_name}"
rescue Plugin::GemError
SuckerPunch.logger.warn "uninstalling #{gem_name} is failed"
end
end
end

View File

@ -1,10 +0,0 @@
class GemUpdateCheck
include SuckerPunch::Job
workers 16
def perform(gem_name)
SuckerPunch.logger.info "check #{gem_name} latest version"
pl = Plugin.new(gem_name: gem_name)
pl.gem_versions!
end
end

View File

@ -35,7 +35,10 @@ module FluentdUi
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = 'en'
config.autoload_paths += %W(#{config.root}/app/workers #{config.root}/lib)
config.i18n.available_locales = %i(en ja)
config.autoload_paths += %W(#{config.root}/lib)
config.active_job.queue_adapter = :sucker_punch
# NOTE: currently, fluentd-ui does not using ActiveRecord, and using Time.now instead of Time.zone.now for each different TZ for users.
# If AR will be used, please comment in and check timezone.

View File

@ -13,8 +13,8 @@ Rails.application.configure do
config.eager_load = false
# Configure static file server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
config.public_file_server.enabled = true
config.public_file_server_headers = { 'Cache-Control' => 'public, max-age=3600' }
# Show full error reports and disable caching.
config.consider_all_requests_local = true

View File

@ -1,6 +1,7 @@
require "plugin" # Avoid: RuntimeError Circular dependency detected while autoloading constant Plugin
unless Rails.env.test?
unless FluentdUI.td_agent_ui?
# td-agent-ui shouldn't auto update
FluentdUiUpdateCheck.new.async.perform
FluentdUiUpdateCheckJob.perform_later
end
end

View File

@ -1 +1,2 @@
AllPluginCheckUpdate.new.async.perform
require "plugin" # Avoid: RuntimeError Circular dependency detected while autoloading constant Plugin
AllPluginCheckUpdateJob.perform_later

View File

@ -1,3 +1,4 @@
---
ja:
date:
abbr_day_names:
@ -31,9 +32,9 @@ ja:
- 金曜日
- 土曜日
formats:
default: ! '%Y/%m/%d'
long: ! '%Y年%m月%d日(%a)'
short: ! '%m/%d'
default: "%Y/%m/%d"
long: "%Y年%m月%d日(%a)"
short: "%m/%d"
month_names:
-
- 1月
@ -65,29 +66,32 @@ ja:
other: 約%{count}年
almost_x_years:
one: 1年弱
other: ! '%{count}年弱'
other: "%{count}年弱"
half_a_minute: 30秒前後
less_than_x_minutes:
one: 1分以内
other: ! '%{count}分未満'
other: "%{count}分未満"
less_than_x_seconds:
one: 1秒以内
other: ! '%{count}秒未満'
other: "%{count}秒未満"
over_x_years:
one: 1年以上
other: ! '%{count}年以上'
other: "%{count}年以上"
x_days:
one: 1日
other: ! '%{count}日'
other: "%{count}日"
x_minutes:
one: 1分
other: ! '%{count}分'
other: "%{count}分"
x_months:
one: 1ヶ月
other: ! '%{count}ヶ月'
other: "%{count}ヶ月"
x_years:
one: 1年
other: "%{count}年"
x_seconds:
one: 1秒
other: ! '%{count}秒'
other: "%{count}秒"
prompts:
day:
hour:
@ -96,40 +100,40 @@ ja:
second:
year:
errors:
format: ! '%{attribute}%{message}'
format: "%{attribute}%{message}"
messages:
accepted: を受諾してください
blank: を入力してください
present: は入力しないでください
confirmation: と%{attribute}の入力が一致しません
empty: を入力してください
equal_to: は%{count}にしてください
even: は偶数にしてください
exclusion: は予約されています
greater_than: は%{count}より大きい値にしてください
greater_than_or_equal_to: は%{count}以上の値にしてください
inclusion: は一覧にありません
invalid: は不正な値です
less_than: は%{count}より小さい値にしてください
less_than_or_equal_to: は%{count}以下の値にしてください
not_a_number: は数値で入力してください。
not_an_integer: は整数で入力してください。
odd: は奇数にしてください。
record_invalid: バリデーションに失敗しました。 %{errors}
restrict_dependent_destroy: ! '%{record}が存在しているので削除できません。'
taken: はすでに存在します
too_long: は%{count}文字以内で入力してください
too_short: は%{count}文字以上で入力してください
wrong_length: は%{count}文字で入力してください
other_than: "は%{count}以外の値にしてください。"
accepted: を受諾してください
blank: を入力してください
present: は入力しないでください
confirmation: と%{attribute}の入力が一致しません
empty: を入力してください
equal_to: は%{count}にしてください
even: は偶数にしてください
exclusion: は予約されています
greater_than: は%{count}より大きい値にしてください
greater_than_or_equal_to: は%{count}以上の値にしてください
inclusion: は一覧にありません
invalid: は不正な値です
less_than: は%{count}より小さい値にしてください
less_than_or_equal_to: は%{count}以下の値にしてください
model_invalid: "バリデーションに失敗しました: %{errors}"
not_a_number: は数値で入力してください
not_an_integer: は整数で入力してください
odd: は奇数にしてください
required: を入力してください
taken: はすでに存在します
too_long: は%{count}文字以内で入力してください
too_short: は%{count}文字以上で入力してください
wrong_length: は%{count}文字で入力してください
other_than: は%{count}以外の値にしてください
template:
body: 次の項目を確認してください
body: 次の項目を確認してください
header:
one: ! '%{model}にエラーが発生しました。'
other: ! '%{model}に%{count}個のエラーが発生しました。'
one: "%{model}にエラーが発生しました"
other: "%{model}に%{count}個のエラーが発生しました"
helpers:
select:
prompt: 選択してください
prompt: 選択してください
submit:
create: 登録する
submit: 保存する
@ -137,22 +141,22 @@ ja:
number:
currency:
format:
delimiter: ! ','
format: ! '%n%u'
delimiter: ","
format: "%n%u"
precision: 0
separator: .
separator: "."
significant: false
strip_insignificant_zeros: false
unit:
format:
delimiter: ! ','
delimiter: ","
precision: 3
separator: .
separator: "."
significant: false
strip_insignificant_zeros: false
human:
decimal_units:
format: ! '%n %u'
format: "%n %u"
units:
billion: 十億
million: 百万
@ -166,13 +170,13 @@ ja:
significant: true
strip_insignificant_zeros: true
storage_units:
format: ! '%n%u'
format: "%n%u"
units:
byte: バイト
gb: ギガバイト
kb: キロバイト
mb: メガバイト
tb: テラバイト
gb: GB
kb: KB
mb: MB
tb: TB
percentage:
format:
delimiter: ''
@ -182,13 +186,13 @@ ja:
delimiter: ''
support:
array:
last_word_connector:
two_words_connector:
words_connector:
last_word_connector:
two_words_connector:
words_connector:
time:
am: 午前
formats:
default: ! '%Y/%m/%d %H:%M:%S'
long: ! '%Y年%m月%d日(%a) %H時%M分%S秒 %z'
short: ! '%y/%m/%d %H:%M'
default: "%Y/%m/%d %H:%M:%S"
long: "%Y年%m月%d日(%a) %H時%M分%S秒 %z"
short: "%y/%m/%d %H:%M"
pm: 午後

View File

@ -25,15 +25,15 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.add_dependency "fluentd", [">= 0.10.56", "< 0.14"]
spec.add_dependency 'rails', '~> 4.2.0'
spec.add_dependency 'sucker_punch', "~> 1.6.0"
spec.add_dependency 'rails', '~> 5.2.0'
spec.add_dependency 'sucker_punch', "~> 2.0.4"
spec.add_dependency 'addressable'
spec.add_dependency "font-awesome-rails"
spec.add_dependency 'sass-rails', '~> 4.0.3'
spec.add_dependency 'sass-rails', '~> 5.0.7'
spec.add_dependency "haml-rails", "~> 1.0"
spec.add_dependency 'jquery-rails', "~> 4.3.1"
spec.add_dependency 'jbuilder', '~> 2.0'
spec.add_dependency "draper", '~> 2.1'
spec.add_dependency "draper", '~> 3.0'
spec.add_dependency "bundler"
spec.add_dependency "httpclient", "~> 2.5" # same as td-agent
spec.add_dependency "settingslogic"

View File

@ -6,24 +6,20 @@ describe DummyController do
controller DummyController do
skip_before_action :login_required
def index
render :text => "Hello World"
render plain: "Hello World"
end
end
describe '#set_locale' do
let!(:default_locale) { :en }
let!(:available_locales) { [:en, :ja] }
before do
I18n.stub(:default_locale).and_return(default_locale)
I18n.stub(:available_locales).and_return(available_locales)
I18n.locale = I18n.default_locale #initialize
end
context 'with params[:lang]' do
before do
get 'index', lang: param_lang
get 'index', params: { lang: param_lang }
end
context 'and in available_locales' do

View File

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :fluentd do
dir = Rails.root.join("tmp/fluentd-test").to_s
FileUtils.mkdir_p(dir)

View File

@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
# Read about factories at https://github.com/thoughtbot/factory_bot
FactoryGirl.define do
FactoryBot.define do
factory :plugin do
gem_name "fluent-plugin-dummy"
version "1.2.3"

View File

@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :user do
name "admin"
password "changeme"

View File

@ -35,16 +35,17 @@ describe "histories", stub: :daemon do
it 'show histories#show' do
page.should have_css('h1', text: I18n.t('fluentd.settings.histories.show.page_title'))
page.should have_text(last_backup_file.content)
page.should has_text?(last_backup_file.content)
end
describe 'diff' do
context 'has diff' do
it 'shows diff between current and target' do
page.should have_text("- type http")
page.should have_text("+ type forward")
page.should have_text("- port 8899")
page.should have_text("+ port 24224")
page.should has_text?("- type http")
page.should has_text?("+ type forward")
page.should has_text?("- port 8899")
page.should has_text?("+ port 24224")
end
end
@ -64,7 +65,7 @@ describe "histories", stub: :daemon do
page.should have_css('h1', text: I18n.t('fluentd.settings.show.page_title'))
page.should have_text(I18n.t('messages.config_successfully_copied', brand: 'fluentd') )
page.should have_text(last_backup_file.content)
page.should has_text?(last_backup_file.content)
end
describe "configtest" do

View File

@ -39,9 +39,10 @@ describe "running_backup", stub: :daemon do
describe 'diff' do
context 'has diff' do
it 'shows diff between current and running' do
expect(page).to have_text("- type http")
expect(page).to have_text("- port 8899")
expect(page).to have_text("+ Running backup file content")
diff = page.first(".diff pre").native.inner_text
expect(diff).to include("- type http")
expect(diff).to include("- port 8899")
expect(diff).to include("+ Running backup file content")
end
end

View File

@ -50,6 +50,7 @@ describe 'setting', stub: :daemon do
describe "config" do
before do
Fluentd::Agent::TdAgent.any_instance.stub(:dryrun).with(an_instance_of(String)).and_return(true)
daemon.agent.config_write conf
click_link I18n.t('terms.edit')
end

View File

@ -21,19 +21,19 @@ describe Fluentd do
context "not writable" do
before { FileUtils.chmod(0400, path) }
it { should_not be_blank }
it { subject.get(column).should include(I18n.t('activerecord.errors.messages.lack_write_permission')) }
it { subject[column].should include(I18n.t('activerecord.errors.messages.lack_write_permission')) }
end
context "not readable" do
before { FileUtils.chmod(0200, path) }
it { should_not be_blank }
it { subject.get(column).should include(I18n.t('activerecord.errors.messages.lack_read_permission')) }
it { subject[column].should include(I18n.t('activerecord.errors.messages.lack_read_permission')) }
end
context "is directory" do
before { fluentd.send("#{column}=", Rails.root + "tmp") }
it { should_not be_blank }
it { subject.get(column).should include(I18n.t('activerecord.errors.messages.is_a_directory')) }
it { subject[column].should include(I18n.t('activerecord.errors.messages.is_a_directory')) }
end
end
@ -50,7 +50,7 @@ describe Fluentd do
context "not writable" do
before { FileUtils.chmod(0500, dir) }
it { should_not be_blank }
it { subject.get(column).should include(I18n.t('activerecord.errors.messages.lack_write_permission')) }
it { subject[column].should include(I18n.t('activerecord.errors.messages.lack_write_permission')) }
end
end
end

View File

@ -9,8 +9,18 @@ require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
require 'capybara/rspec'
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app,
browser: :chrome,
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
chrome_options: {
args: %w(headless disable-gpu window-size=1920,1080),
},
)
)
end
Capybara.javascript_driver = :selenium
require 'capybara-screenshot/rspec'
# Requires supporting ruby files with custom matchers and macros, etc,
@ -27,8 +37,8 @@ RSpec.configure do |config|
# config.mock_with :flexmock
# config.mock_with :rr
# Syntax sugar to use the FactoryGirl methods directly instead FactoryGirl.create ete.
config.include FactoryGirl::Syntax::Methods
# Syntax sugar to use the FactoryBot methods directly instead FactoryBot.create ete.
config.include FactoryBot::Syntax::Methods
config.include LoginMacro
config.include JavascriptMacro
config.include StubDaemon