/
.railsrc
44 lines (35 loc) · 840 Bytes
/
.railsrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/ruby
begin
require 'hirb' # sudo gem install cldwalker-hirb --source http://gems.github.com
Hirb.enable
rescue LoadError
end
def change_log(stream)
ActiveRecord::Base.logger = Logger.new(stream)
ActiveRecord::Base.clear_active_connections!
end
def show_log
change_log(STDOUT)
end
def hide_log
change_log(nil)
end
def get_task(task_id)
TaskEngine::Core::TaskInstance.find(task_id)
end
def exec_last
TaskEngine::Core::TaskInstance.last.execute!
end
def qtasks(state='queued')
TaskEngine::Core::TaskInstance.find_all_by_state(state)
end
def load_routes
puts %q{
>> rts = ActionController::Routing::Routes
>> rts.recognize_path("/")
=> {:controller=>"albums", :action=>"index"}
>> rts.generate(:controller=>'albums',:action=>'index')
=> "/music"
}
ActionController::Routing::Routes
end