Class: FireUp

Inherits:
Object
  • Object
show all
Defined in:
lib/fire_up.rb

Constant Summary collapse

CONFIG_PATH =
File.expand_path "~/.fire_up_config"

Instance Method Summary collapse

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_pathObject



51
52
53
54
55
56
57
58
# File 'lib/fire_up.rb', line 51

def log_path
  path = File.expand_path(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_windowObject



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.expand_path(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.expand_path(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_dirObject



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

#titleObject



47
48
49
# File 'lib/fire_up.rb', line 47

def title
  get_config('title', "What is the title of this project?")
end