Class: FireUp
- Inherits:
-
Object
- Object
- FireUp
- Defined in:
- lib/fire_up.rb
Constant Summary collapse
- CONFIG_PATH =
File. "~/.fire_up_config"
Instance Method Summary collapse
-
#initialize(project_name) ⇒ FireUp
constructor
A new instance of FireUp.
- #log_path ⇒ Object
- #open_window ⇒ Object
- #project_dir ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(project_name) ⇒ FireUp
Returns a new instance of FireUp.
8 9 10 11 |
# File 'lib/fire_up.rb', line 8 def initialize(project_name) @project_name = project_name load_config! end |
Instance Method Details
#log_path ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/fire_up.rb', line 51 def log_path path = File.(File.join(project_dir, 'log', 'development.log')) if File.exist?(path) path else get_config('log_path', "Where is your server log file?", :type => :path) end end |
#open_window ⇒ Object
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 |
# File 'lib/fire_up.rb', line 13 def open_window this = self ItermWindow.open do open_tab :log do write "cd #{this.project_dir}" write "tail -f #{this.log_path}" # Using Passenger, just tail log set_title "#{this.title} Log" end open_tab :console do write "cd #{this.project_dir}" if File.exist?(File.(File.join(this.project_dir, 'script', 'console'))) write "script/console" else write "rails console" end set_title "#{this.title} Console" end open_tab :dir do write "cd #{this.project_dir}" if tmproj = Dir[File.(File.join(this.project_dir, '*.tmproj'))].first write "open #{tmproj}" else write "mate ./" end set_title "#{this.title} Dir" end end write_config! end |
#project_dir ⇒ Object
43 44 45 |
# File 'lib/fire_up.rb', line 43 def project_dir get_config('project_dir', "What is your project directory's path?", :type => :path) end |
#title ⇒ Object
47 48 49 |
# File 'lib/fire_up.rb', line 47 def title get_config('title', "What is the title of this project?") end |