fire_up 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGELOG.rdoc +7 -0
  2. data/LICENSE +20 -0
  3. data/README.rdoc +13 -0
  4. data/lib/fire_up.rb +87 -0
  5. metadata +67 -0
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = FireUp CHANGELOG
2
+
3
+ == Version 0.1
4
+ * Initial Implementation
5
+ * Automation support for iTerm
6
+ * Assumes use of TextMate
7
+ * Assumes use of Passenger
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Chris Powers
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,13 @@
1
+ = FireUp
2
+
3
+ <em>Developed by Chris Powers, March 27, 2010</em>
4
+
5
+ == What Does It Do?
6
+
7
+ The FireUp gem gives you a handy <tt>fire_up</tt> command that will fire up all the iTerm tabs you need for your project, and opens the project up in TextMate. FireUp uses a CLI dialog to get your project preferences and stores them in <tt>~/.fire_up_config</tt>.
8
+
9
+ == What Software Is Supported?
10
+
11
+ Right now support is admittedly narrow, it only supports my personal workflow of using iTerm for a terminal and TextMate for my editor, and it also assumes that projects are already running on Passenger.
12
+
13
+ I would like to eventually add support for using Terminal, other text editors like vim and emacs, and add the ability to fire up Mongrel / Thin / Unicorn servers rather than just Passenger.
data/lib/fire_up.rb ADDED
@@ -0,0 +1,87 @@
1
+ class FireUp
2
+ require 'rubygems'
3
+ require 'iterm_window'
4
+ require 'yaml'
5
+
6
+ CONFIG_PATH = File.expand_path "~/.fire_up_config"
7
+
8
+ def initialize(project_name)
9
+ @project_name = project_name
10
+ load_config!
11
+ end
12
+
13
+ def open_window
14
+ this = self
15
+ ItermWindow.open do
16
+ open_tab :log do
17
+ write "cd #{this.project_dir}"
18
+ write "tail -f #{this.log_path}" # Using Passenger, just tail log
19
+ set_title "#{this.title} Log"
20
+ end
21
+ open_tab :console do
22
+ write "cd #{this.project_dir}"
23
+ if File.exist?(File.expand_path(File.join(this.project_dir, 'script', 'console')))
24
+ write "script/console"
25
+ else
26
+ write "rails console"
27
+ end
28
+ set_title "#{this.title} Console"
29
+ end
30
+ open_tab :dir do
31
+ write "cd #{this.project_dir}"
32
+ if tmproj = Dir[File.expand_path(File.join(this.project_dir, '*.tmproj'))].first
33
+ write "open #{tmproj}"
34
+ else
35
+ write "mate ./"
36
+ end
37
+ set_title "#{this.title} Dir"
38
+ end
39
+ end
40
+ write_config!
41
+ end
42
+
43
+ def project_dir
44
+ get_config('project_dir', "What is your project directory's path?", :type => :path)
45
+ end
46
+
47
+ def title
48
+ get_config('title', "What is the title of this project?")
49
+ end
50
+
51
+ def log_path
52
+ path = File.expand_path(File.join(project_dir, 'log', 'development.log'))
53
+ if File.exist?(path)
54
+ path
55
+ else
56
+ get_config('log_path', "Where is your server log file?", :type => :path)
57
+ end
58
+ end
59
+
60
+ private
61
+
62
+ def get_config(key, question, options={})
63
+ options[:regex] ||= /\w+/
64
+ until @config[key] =~ options[:regex]
65
+ puts question
66
+ value = gets.chomp
67
+ if options[:type] == :path
68
+ value = File.expand_path(value)
69
+ end
70
+ @config[key] = value
71
+ end
72
+ @config[key]
73
+ end
74
+
75
+ def load_config!
76
+ @full_config = File.exist?(CONFIG_PATH) ? YAML.load(File.read(CONFIG_PATH)) : {}
77
+ @config = @full_config[@project_name] || {}
78
+ end
79
+
80
+ def write_config!
81
+ @full_config[@project_name] = @config
82
+ File.open(CONFIG_PATH, 'w') do |f|
83
+ f.puts YAML.dump(@full_config)
84
+ end
85
+ end
86
+
87
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fire_up
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - Chris Powers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-03-27 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: iterm_window
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.3.3
24
+ version:
25
+ description:
26
+ email: chrisjpowers@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - README.rdoc
35
+ - CHANGELOG.rdoc
36
+ - LICENSE
37
+ - lib/fire_up.rb
38
+ has_rdoc: true
39
+ homepage: http://github.com/chrisjpowers/fire_up
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options: []
44
+
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ requirements: []
60
+
61
+ rubyforge_project:
62
+ rubygems_version: 1.3.5
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: The FlexibleCsv gem uses the FasterCSV gem to parse user created CSV files that may not have standard headers.
66
+ test_files: []
67
+