lib/tailog.rb in tailog-0.2.3 vs lib/tailog.rb in tailog-0.3.0
- old
+ new
@@ -1,14 +1,19 @@
require 'tailog/version'
+require 'tailog/watch_methods'
+require 'tailog/ext/file'
+
require 'sinatra/base'
require 'active_support/configurable'
-require 'tailog/ext/file'
+
require 'securerandom'
+require 'open3'
require 'json'
module Tailog
include ActiveSupport::Configurable
+ extend Tailog::WatchMethods
config_accessor :log_path do
File.expand_path("log", Dir.pwd)
end
@@ -59,8 +64,20 @@
}.to_json
end
get '/env' do
erb :env
+ end
+
+ get '/script' do
+ erb :'script/index'
+ end
+
+ post '/script' do
+ content = erb :"script/#{params[:type]}", locals: { script: params[:script] }, layout: false
+
+ {
+ content: content
+ }.to_json
end
end
end