我刚刚开始研究粉碎(以前称为破折号)。
根据此处的网址https://github.com/Shopify/dashing/wiki/Dashing-Workshop
我想做的只是从本地文件中简单读取。
本地文件位于其他目录(名为googlestatus)中,并且包含:
connected
jobs / ops.orb包含:
gstatus = puts File.read(./status/googlestatus)
############ scheduler
SCHEDULER.every '1s', :first_in => 0 do |job|
send_event('response_time', { value: gstatus })
end
但是当我运行smashing start时,它给了我以下错误:
Arrived
bundler: failed to load command: thin (/usr/local/bin/thin)
Errno::ENOENT: No such file or directory @ rb_sysopen - googlestatus
/home/test/monitorama/monitorama/jobs/test-r.rb:3:in `initialize'
/home/test/monitorama/monitorama/jobs/test-r.rb:3:in `open'
/home/test/monitorama/monitorama/jobs/test-r.rb:3:in `get_file_as_string'
/home/test/monitorama/monitorama/jobs/test-r.rb:12:in `<top (required)>'
/var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:170:in `require'
/var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:170:in `block in require_glob'
/var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:169:in `each'
/var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:169:in `require_glob'
/var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:180:in `<top (required)>'
/var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing.rb:3:in `require'
/var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing.rb:3:in `<top (required)>'
config.ru:1:in `require'
config.ru:1:in `block in <main>'
/var/lib/gems/2.7.0/gems/rack-2.2.2/lib/rack/builder.rb:125:in `instance_eval'
/var/lib/gems/2.7.0/gems/rack-2.2.2/lib/rack/builder.rb:125:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/var/lib/gems/2.7.0/gems/thin-1.7.2/lib/rack/adapter/loader.rb:33:in `eval'
/var/lib/gems/2.7.0/gems/thin-1.7.2/lib/rack/adapter/loader.rb:33:in `load'
/var/lib/gems/2.7.0/gems/thin-1.7.2/lib/thin/controllers/controller.rb:182:in `load_rackup_config'
/var/lib/gems/2.7.0/gems/thin-1.7.2/lib/thin/controllers/controller.rb:72:in `start'
/var/lib/gems/2.7.0/gems/thin-1.7.2/lib/thin/runner.rb:203:in `run_command'
/var/lib/gems/2.7.0/gems/thin-1.7.2/lib/thin/runner.rb:159:in `run!'
/var/lib/gems/2.7.0/gems/thin-1.7.2/bin/thin:6:in `<top (required)>'
/usr/local/bin/thin:23:in `load'
/usr/local/bin/thin:23:in `<top (required)>'
答案 0 :(得分:0)
您的代码有些错误:
puts File.read("./status/googlestatus")