muxit 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/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +56 -0
- data/Rakefile +1 -0
- data/bin/muxit +5 -0
- data/lib/muxit.rb +7 -0
- data/lib/muxit/cli.rb +37 -0
- data/lib/muxit/version.rb +3 -0
- data/muxit.gemspec +24 -0
- metadata +111 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Andrew Nordman
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Muxit
|
2
|
+
|
3
|
+
Muxit is a script to simplify tmux usage in solo development. I tend to have the same setup for every single project:
|
4
|
+
|
5
|
+
* One session per project
|
6
|
+
* 2 vsplit panes per session
|
7
|
+
* Each session maps to a directory in the `$PROJECTS` folder
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'muxit'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install muxit
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
`muxit start NAME` - starts a new tmux session named NAME
|
26
|
+
`muxit attach NAME` - attaches to an existing tmux session
|
27
|
+
`muxit list` - list all sessions in tmux
|
28
|
+
`muxit nuke NAME` - kills off a tmux session
|
29
|
+
`muxit code NAME` - opens a named session, changes directory to `$PROJECTS/NAME`, creates a split window,
|
30
|
+
and opens the editor specified by `$EDITOR` in the left pane.
|
31
|
+
|
32
|
+
Thus, opening a muxit session to edit the muxit library would look like this:
|
33
|
+
|
34
|
+
```
|
35
|
+
export $PROJECTS=~/code
|
36
|
+
git clone cadwallion/muxit ~/code/muxit
|
37
|
+
|
38
|
+
muxit code muxit
|
39
|
+
```
|
40
|
+
|
41
|
+
If your project happens to be in a subdirectory, muxit will name it after the last folder specified.
|
42
|
+
|
43
|
+
```
|
44
|
+
export $PROJECTS=~/code
|
45
|
+
git clone cadwallion/muxit ~/code/oss/muxit
|
46
|
+
|
47
|
+
muxit code oss/muxit
|
48
|
+
```
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
1. Fork it
|
53
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
54
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
55
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
56
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/muxit
ADDED
data/lib/muxit.rb
ADDED
data/lib/muxit/cli.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Muxit
|
2
|
+
class CLI < Thor
|
3
|
+
desc 'start NAME', 'Start a named tmux session'
|
4
|
+
def start name
|
5
|
+
tmux_exec ['tmux', 'new-session', '-s', '#{name}']
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'list', 'List all existing tmux sessions'
|
9
|
+
def list
|
10
|
+
tmux_exec ['tmux', 'list-sessions']
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'attach NAME', 'Attach to NAME session'
|
14
|
+
def attach name
|
15
|
+
tmux_exec ['tmux', 'attach-session', '-t', name]
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'nuke NAME', 'Destroy a named session'
|
19
|
+
def nuke name
|
20
|
+
tmux_exec ['tmux', 'kill-session', '-t', name]
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'code NAME', 'opens up a new tmux session with split windows, in the project directory, with an $EDITOR pane'
|
24
|
+
def code project
|
25
|
+
name = project.split('/').last
|
26
|
+
directory = "#{ENV['PROJECTS']}/#{project}"
|
27
|
+
tmux_exec "tmux new-session -s #{name} 'cd #{directory} && #{ENV['EDITOR']}' \\; split-window -h -c #{directory}"
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def tmux_exec tmux_command
|
32
|
+
IO.popen(tmux_command, 'r') do |process|
|
33
|
+
puts process.gets until process.eof?
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/muxit.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'muxit/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "muxit"
|
8
|
+
spec.version = Muxit::VERSION
|
9
|
+
spec.authors = ["Andrew Nordman"]
|
10
|
+
spec.email = ["cadwallion@gmail.com"]
|
11
|
+
spec.description = %q{Simplify solo development with tmux}
|
12
|
+
spec.summary = %q{Mux your local dev environment}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_runtime_dependency "thor"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: muxit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andrew Nordman
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: thor
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Simplify solo development with tmux
|
63
|
+
email:
|
64
|
+
- cadwallion@gmail.com
|
65
|
+
executables:
|
66
|
+
- muxit
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- bin/muxit
|
76
|
+
- lib/muxit.rb
|
77
|
+
- lib/muxit/cli.rb
|
78
|
+
- lib/muxit/version.rb
|
79
|
+
- muxit.gemspec
|
80
|
+
homepage: ''
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
hash: 3686140669794919330
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
hash: 3686140669794919330
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 1.8.23
|
108
|
+
signing_key:
|
109
|
+
specification_version: 3
|
110
|
+
summary: Mux your local dev environment
|
111
|
+
test_files: []
|