tmuxification 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -6,7 +6,7 @@ with two windows in your project root, vim is started in the first window.
6
6
  ## Tested on
7
7
 
8
8
  * Ruby 1.9
9
- * zsh
9
+ * zsh & fish shells
10
10
 
11
11
  ## Installation
12
12
 
@@ -16,35 +16,53 @@ with two windows in your project root, vim is started in the first window.
16
16
 
17
17
  ### Create a new tmux project
18
18
 
19
- cd ~/code/my_project
20
- tmuxification create
19
+ $ cd ~/code/my_project
20
+ $ tmuxification create
21
+
22
+ You will need to reload your shell config file. The easiest way is to replace
23
+ the current process with a new instance of your shell, e.g `exec zsh`.
21
24
 
22
25
  ### Start the project (from any directory)
23
26
 
24
- start_my_project
27
+ $ start_my_project
28
+
29
+ Note: The above will also autocomplete.
30
+
31
+ ### List all your projects
32
+
33
+ $ tmuxification list
34
+
35
+ ### Delete a project
36
+
37
+ $ cd ~/code/my_project
38
+ $ tmuxification destroy
25
39
 
26
40
  ### Templates
27
41
 
28
- You can create your own templates, just drop them in `.tmuxinator` with a
42
+ You can create your own templates, just drop them in `~/.tmuxinator` with a
29
43
  filename such as `basic.tmux.erb` and specify your template as such:
30
44
 
31
- tmuxification create --template-name=basic
45
+ $ tmuxification create --template-name=basic
46
+
47
+ You can also edit the `default.{zsh,fish}.tmux.erb` templates which are used when
48
+ no `template-name` is specified.
32
49
 
33
- You can also edit the `default.tmux.erb` which is used when no `template-name` is
34
- specified.
50
+ The default template is chosen based on the default shell.
35
51
 
36
52
  ### Project name
37
53
 
38
54
  By default the tmux project is named after the root directory of the project, you
39
55
  can specify a different project name as such:
40
56
 
41
- cd ~/code/my_project
42
- tmuxification create --project-name=foobar
43
- start_foobar
57
+ $ cd ~/code/my_project
58
+ $ tmuxification create --project-name=foobar
59
+ $ start_foobar
44
60
 
45
61
  ## Warning
46
62
 
47
- Every project created will append a line per project to your `.zshrc` file.
63
+ Every project created will append a line per project to `.projects`, `.zshrc` or
64
+ `config.fish` file. The `.projects` is used if it exists otherwise the rc file
65
+ for th current shell is used.
48
66
 
49
67
  ## Contributing
50
68
 
data/bin/tmuxification CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  require "rubygems"
4
4
  require "thor"
5
- require 'tmuxification'
5
+ require_relative '../lib/tmuxification'
6
6
 
7
7
  Tmuxification::App.start
@@ -1,3 +1,3 @@
1
1
  module Tmuxification
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/tmuxification.rb CHANGED
@@ -12,11 +12,11 @@ module Tmuxification
12
12
  setup
13
13
  @project_name = options.fetch('project_name') { Dir.pwd.split('/').last }
14
14
  @project_root = Dir.pwd
15
- @template_name = options.fetch('template_name') { 'default' }
15
+ @template_name = options.fetch('template_name') { "default.#{current_shell}" }
16
16
 
17
17
  template template_file, project_file
18
18
  chmod project_file, 777 # ha!
19
- append_to_file shellrc_file, "source #{project_file}\n"
19
+ append_to_file shellrc_file, "#{shell_source_command} #{project_file}\n"
20
20
  end
21
21
 
22
22
  desc 'destroy', 'Destroys a tmux project'
@@ -35,8 +35,10 @@ module Tmuxification
35
35
  desc 'setup', 'Create folder for tmux projects'
36
36
  def setup
37
37
  empty_directory config_directory
38
- @template_name = 'default'
39
- copy_file 'templates/default.tmux.erb', template_file unless File.exists?(template_file)
38
+ @template_name = 'default.zsh'
39
+ copy_file 'templates/default.zsh.tmux.erb', template_file unless File.exists?(template_file)
40
+ @template_name = 'default.fish'
41
+ copy_file 'templates/default.fish.tmux.erb', template_file unless File.exists?(template_file)
40
42
  end
41
43
 
42
44
  desc 'teardown', 'Delete all projects and containing folder'
@@ -52,7 +54,15 @@ module Tmuxification
52
54
  private
53
55
 
54
56
  def shellrc_file
55
- File.expand_path '~/.zshrc'
57
+ projects_rc = File.expand_path('~/.projects')
58
+ return File.expand_path projects_rc if File.exists?(projects_rc)
59
+ return File.expand_path '~/.zshrc' if zsh?
60
+ return File.expand_path '~/.config/fish/config.fish' if fish?
61
+ end
62
+
63
+ def shell_source_command
64
+ "source" if zsh?
65
+ "." if fish?
56
66
  end
57
67
 
58
68
  def template_file
@@ -67,5 +77,17 @@ module Tmuxification
67
77
  def config_directory
68
78
  File.expand_path '~/.tmuxification'
69
79
  end
80
+
81
+ def zsh?
82
+ current_shell == 'zsh'
83
+ end
84
+
85
+ def fish?
86
+ current_shell == 'fish'
87
+ end
88
+
89
+ def current_shell
90
+ ENV['SHELL'].split('/').last
91
+ end
70
92
  end
71
93
  end
@@ -0,0 +1,14 @@
1
+ function start_<%= @project_name %>
2
+ set -l BASE "<%= @project_root %>"
3
+ cd $BASE
4
+
5
+ tmux start-server
6
+ tmux new-session -d -s <%= @project_name %> -n vim
7
+ tmux new-window -t <%= @project_name %>:1 -n shell
8
+
9
+ tmux send-keys -t <%= @project_name %>:0 "cd $BASE; vim" C-m
10
+ tmux send-keys -t <%= @project_name %>:1 "cd $BASE;" C-m
11
+
12
+ tmux select-window -t <%= @project_name %>:0
13
+ tmux attach-session -t <%= @project_name %>
14
+ end
@@ -1,5 +1,3 @@
1
- #!/bin/sh
2
-
3
1
  function start_<%= @project_name %>
4
2
  {
5
3
  BASE="<%= @project_root %>"
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ function start_<%= @project_name %>
4
+ {
5
+ BASE="<%= @project_root %>"
6
+ cd $BASE
7
+
8
+ tmux start-server
9
+ tmux new-session -d -s <%= @project_name %> -n editor
10
+ tmux new-window -t <%= @project_name %>:1 -n shell
11
+
12
+ tmux send-keys -t <%= @project_name %>:0 "cd $BASE; vi" C-m
13
+ tmux send-keys -t <%= @project_name %>:1 "cd $BASE; env OPEN_BROWSER=yes script/start && clear" C-m
14
+
15
+ tmux select-window -t <%= @project_name %>:0
16
+ tmux attach-session -t <%= @project_name %>
17
+
18
+ script/stop
19
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmuxification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-30 00:00:00.000000000 Z
12
+ date: 2013-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -43,7 +43,9 @@ files:
43
43
  - bin/tmuxification
44
44
  - lib/tmuxification.rb
45
45
  - lib/tmuxification/version.rb
46
- - templates/default.tmux.erb
46
+ - templates/default.fish.tmux.erb
47
+ - templates/default.zsh.tmux.erb
48
+ - templates/example.tmux.erb
47
49
  - tmuxification.gemspec
48
50
  homepage: https://github.com/krisleech/tmuxinator
49
51
  licenses: []
@@ -65,8 +67,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
67
  version: '0'
66
68
  requirements: []
67
69
  rubyforge_project:
68
- rubygems_version: 1.8.23
70
+ rubygems_version: 1.8.24
69
71
  signing_key:
70
72
  specification_version: 3
71
73
  summary: Generate tmux configurations for your projects
72
74
  test_files: []
75
+ has_rdoc: