tmuxinator 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,30 +33,31 @@ It also uses $SHELL variable. which is always set by your shell.
33
33
 
34
34
  ### Create a project ###
35
35
 
36
- $ tmuxinator open project_name
36
+ $ tmuxinator new project_name
37
37
 
38
- Create or edit your projects with this command. aliased to `o`. Your default editor ($EDITOR) is used to open the file. If this is a new project you will see this default config:
38
+ Create or edit your projects with this command, for editing you can also use `tmuxinator open project_name`. `new` aliased to `o`,`open` and `n`. Your default editor ($EDITOR) is used to open the file. If this is a new project you will see this default config:
39
39
 
40
40
  # ~/.tmuxinator/project_name.yml
41
41
  # you can make as many tabs as you wish...
42
42
 
43
- project_name: tmuxinator
43
+ project_name: Tmuxinator
44
44
  project_root: ~/code/rails_project
45
45
  rvm: 1.9.2@rails_project
46
46
  tabs:
47
- - shell: git pull
48
- - database: rails db
49
- - console: rails c
50
- - logs:
51
- - cd logs
52
- - tail -f development.log
53
- - ssh: ssh me@myhost
54
- - window_with_panes
47
+ - editor:
55
48
  layout: main-vertical
56
49
  panes:
57
50
  - vim
58
51
  - #empty, will just run plain bash
59
52
  - top
53
+ - shell: git pull
54
+ - database: rails db
55
+ - server: rails s
56
+ - logs: tail -f logs/development.log
57
+ - console: rails c
58
+ - capistrano:
59
+ - server: ssh me@myhost
60
+
60
61
 
61
62
  If a tab contains multiple commands, they will be 'joined' together with '&&'.
62
63
  If you want to have your own default config, place it into $HOME/.tmuxinator/default.yml
data/TODO CHANGED
@@ -1,12 +0,0 @@
1
- Add contributors
2
-
3
- Features:
4
- pane
5
- RVM
6
-
7
- Later:
8
- x. support panes
9
- x. install theme
10
- x. add documentation
11
- x. add tests
12
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -55,6 +55,8 @@ module Tmuxinator
55
55
  update_scripts
56
56
  end
57
57
  alias :o :open
58
+ alias :new :open
59
+ alias :n :open
58
60
 
59
61
  def copy *args
60
62
  @copy = args.shift
@@ -130,17 +132,17 @@ module Tmuxinator
130
132
 
131
133
  def doctor
132
134
  print " cheking if tmux is installed ==> "
133
- puts system("which tmux > /dev/null") ? "Yes" : "No"
135
+ puts system("which tmux > /dev/null") ? "Yes" : "No"
134
136
  print " cheking if $EDITOR is set ==> "
135
137
  puts ENV['EDITOR'] ? "Yes" : "No"
136
138
  print " cheking if $SHELL is set ==> "
137
139
  puts ENV['SHELL'] ? "Yes" : "No"
138
140
  puts %{
139
141
  make sure you have this line in your ~/.bashrc file:
140
-
142
+
141
143
  [[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && source $HOME/.tmuxinator/scripts/tmuxinator
142
-
143
-
144
+
145
+
144
146
  }
145
147
  end
146
148
 
@@ -1,54 +1,54 @@
1
1
  module Tmuxinator
2
-
2
+
3
3
  class ConfigWriter
4
- attr :file_name, :file_path, :project_name, :project_root, :rvm, :tabs
5
-
4
+ attr_accessor :file_name, :file_path, :project_name, :project_root, :rvm, :tabs
5
+
6
6
  include Tmuxinator::Helper
7
-
7
+
8
8
  def self.write_aliases aliases
9
9
  File.open("#{ENV["HOME"]}/.tmuxinator/scripts/tmuxinator", 'w') {|f| f.write(aliases.join("\n")) }
10
10
  end
11
-
11
+
12
12
  def initialize this_full_path=nil
13
13
  self.file_path = this_full_path if this_full_path
14
14
  end
15
-
15
+
16
16
  def file_path= full_path
17
17
  @file_path = full_path
18
18
  @file_name = File.basename full_path, '.yml'
19
19
  process_config! if full_path && File.exist?(full_path)
20
20
  end
21
-
21
+
22
22
  def write!
23
23
  raise "Unable to write with out a file_name defined" unless self.file_name
24
24
  erb = ERB.new(IO.read(TMUX_TEMPLATE)).result(binding)
25
25
  tmp = File.open(config_path, 'w') {|f| f.write(erb) }
26
-
26
+
27
27
  "alias start_#{file_name}='$SHELL #{config_path}'"
28
28
  end
29
-
29
+
30
30
  def config_path
31
31
  "#{root_dir}#{file_name}.tmux" if file_name
32
32
  end
33
-
33
+
34
34
  private
35
-
35
+
36
36
  def root_dir
37
37
  "#{ENV["HOME"]}/.tmuxinator/"
38
38
  end
39
-
39
+
40
40
  def process_config!
41
41
  yaml = YAML.load(File.read(file_path))
42
42
 
43
43
  exit!("Your configuration file should include some tabs.") if yaml["tabs"].nil?
44
44
  exit!("Your configuration file didn't specify a 'project_root'") if yaml["project_root"].nil?
45
45
  exit!("Your configuration file didn't specify a 'project_name'") if yaml["project_name"].nil?
46
-
46
+
47
47
  @project_name = yaml["project_name"]
48
48
  @project_root = yaml["project_root"]
49
49
  @rvm = yaml["rvm"]
50
50
  @tabs = []
51
-
51
+
52
52
  yaml["tabs"].each do |tab|
53
53
  t = OpenStruct.new
54
54
  t.name = tab.keys.first
@@ -77,7 +77,7 @@ module Tmuxinator
77
77
 
78
78
  def parse_tabs tab_list
79
79
  end
80
-
80
+
81
81
  def write_alias stuff
82
82
  File.open("#{root_dir}scripts/#{@filename}", 'w') {|f| f.write(stuff) }
83
83
  end
@@ -96,5 +96,5 @@ module Tmuxinator
96
96
  "tmux send-keys -t #{window(window_number)} #{s cmd} C-m"
97
97
  end
98
98
  end
99
-
99
+
100
100
  end
@@ -1,11 +1,11 @@
1
1
  module Tmuxinator
2
2
  module Helper
3
-
3
+
4
4
  def exit!(msg)
5
5
  puts msg
6
6
  Kernel.exit(1)
7
7
  end
8
-
8
+
9
9
  def confirm!(msg)
10
10
  puts msg
11
11
  if %w(yes Yes YES y).include?(STDIN.gets.chop)
@@ -14,6 +14,6 @@ module Tmuxinator
14
14
  exit! "Aborting."
15
15
  end
16
16
  end
17
-
17
+
18
18
  end
19
19
  end
@@ -10,5 +10,5 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
10
10
  SAMPLE_CONFIG = File.join(File.dirname(__FILE__), '..', 'lib', 'tmuxinator', 'assets', 'sample.yml')
11
11
 
12
12
  RSpec.configure do |config|
13
-
13
+
14
14
  end
@@ -9,40 +9,40 @@ describe Tmuxinator::ConfigWriter do
9
9
  its(:tabs){ should be_nil }
10
10
  its(:config_path){ should be_nil }
11
11
  end
12
-
12
+
13
13
  context "While Defining the filename on init" do
14
14
  subject{ Tmuxinator::ConfigWriter.new(SAMPLE_CONFIG) }
15
15
  its(:file_path){ should eql SAMPLE_CONFIG }
16
16
  its(:file_name){ should eql "sample" }
17
17
  end
18
-
18
+
19
19
  context "After filename has been defined" do
20
20
  before do
21
21
  subject.file_path = SAMPLE_CONFIG
22
22
  end
23
-
23
+
24
24
  its(:file_path){ should eql SAMPLE_CONFIG }
25
25
  its(:file_name){ should eql File.basename(SAMPLE_CONFIG, '.yml')}
26
26
  its(:project_name){ should eql 'Tmuxinator' }
27
27
  its(:project_root){ should eql '~/code/rails_project' }
28
28
  its(:rvm){ should eql '1.9.2@rails_project' }
29
29
  its(:tabs){ should be_an Array }
30
-
30
+
31
31
  let(:first_tab){ subject.tabs[0] }
32
-
32
+
33
33
  specify{ first_tab.should be_an OpenStruct }
34
34
  specify{ first_tab.name.should eql "editor" }
35
35
  specify{ first_tab.layout.should eql "main-vertical" }
36
36
  specify{ first_tab.panes.should be_an Array }
37
-
37
+
38
38
  it "should prepend each pane with the rvm string" do
39
39
  first_tab.panes.map{|p| p.split(/ && /)[0] }.should eql ["rvm use 1.9.2@rails_project"] * 3
40
40
  end
41
-
41
+
42
42
  it "should append each pane with the command string" do
43
43
  first_tab.panes.map{|p| p.split(/ && /)[1] }.should eql ["vim", nil, "top"]
44
44
  end
45
-
45
+
46
46
  let(:second_tab){ subject.tabs[1] }
47
47
  specify{ second_tab.name.should eql "shell" }
48
48
  specify{ second_tab.command.should eql "rvm use 1.9.2@rails_project && git pull"}
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tmuxinator}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Allen Bargi"]
12
- s.date = %q{2011-03-08}
12
+ s.date = %q{2011-03-10}
13
13
  s.default_executable = %q{tmuxinator}
14
14
  s.description = %q{Create and manage complex tmux sessions easily.}
15
15
  s.email = %q{allen.bargi@gmail.com}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmuxinator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Allen Bargi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-08 00:00:00 +01:00
18
+ date: 2011-03-10 00:00:00 +01:00
19
19
  default_executable: tmuxinator
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency