tmuxification 0.0.1
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 +36 -0
- data/Rakefile +1 -0
- data/bin/tmuxification +7 -0
- data/lib/tmuxification/version.rb +3 -0
- data/lib/tmuxification.rb +71 -0
- data/templates/default.tmux.erb +17 -0
- data/tmuxification.gemspec +21 -0
- metadata +72 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Kris Leech
|
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,36 @@
|
|
1
|
+
# Tmuxification
|
2
|
+
|
3
|
+
Generator for tmux configurations, by default it opens two windows, one
|
4
|
+
containing vim in your project root.
|
5
|
+
|
6
|
+
## Tested on
|
7
|
+
|
8
|
+
* Ruby 1.9
|
9
|
+
* zsh
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
$ gem install tmuxification
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
# create a new tmux project
|
18
|
+
|
19
|
+
cd ~/code/my_project
|
20
|
+
tmuxification create
|
21
|
+
|
22
|
+
# start the project
|
23
|
+
|
24
|
+
start_my_project
|
25
|
+
|
26
|
+
## Warning
|
27
|
+
|
28
|
+
This will append a line per project to your `.zshrc` file.
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/tmuxification
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
require "tmuxification/version"
|
2
|
+
|
3
|
+
module Tmuxification
|
4
|
+
class App < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
attr_reader :project_name, :template_name, :project_root
|
8
|
+
|
9
|
+
desc 'create', 'Creates a new tmux project'
|
10
|
+
method_options :project_name => :string, :template_name => :string
|
11
|
+
def create
|
12
|
+
setup
|
13
|
+
@project_name = options.fetch('project_name') { Dir.pwd.split('/').last }
|
14
|
+
@project_root = Dir.pwd
|
15
|
+
@template_name = options.fetch('template_name') { 'default' }
|
16
|
+
|
17
|
+
template template_file, project_file
|
18
|
+
chmod project_file, 777 # ha!
|
19
|
+
append_to_file shellrc_file, "source #{project_file}\n"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'destroy', 'Destroys a tmux project'
|
23
|
+
def destroy(project_name = nil)
|
24
|
+
@project_name ||= Dir.pwd.split('/').last
|
25
|
+
File.delete project_file if File.exists?(project_file)
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'list', 'List all tmux projects'
|
29
|
+
def list
|
30
|
+
Dir.glob(config_directory + '/*.tmux').map { |path| path.split('/').last }.each do |project_name|
|
31
|
+
puts project_name
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'setup', 'Create folder for tmux projects'
|
36
|
+
def setup
|
37
|
+
empty_directory config_directory
|
38
|
+
@template_name = 'default'
|
39
|
+
copy_file 'templates/default.tmux.erb', template_file unless File.exists?(template_file)
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'teardown', 'Delete all projects and containing folder'
|
43
|
+
def teardown
|
44
|
+
Dir.rmdir(config_directory) if yes? 'Are you sure?'
|
45
|
+
end
|
46
|
+
|
47
|
+
# source root for templates etc.
|
48
|
+
def self.source_root
|
49
|
+
File.dirname(__FILE__) + '/..'
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def shellrc_file
|
55
|
+
File.expand_path '~/.zshrc'
|
56
|
+
end
|
57
|
+
|
58
|
+
def template_file
|
59
|
+
File.join(config_directory, template_name) + '.tmux.erb'
|
60
|
+
end
|
61
|
+
|
62
|
+
def project_file
|
63
|
+
File.join(config_directory, project_name) + '.tmux'
|
64
|
+
end
|
65
|
+
|
66
|
+
# or set destination_root
|
67
|
+
def config_directory
|
68
|
+
File.expand_path '~/.tmuxification'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,17 @@
|
|
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 vim
|
10
|
+
tmux new-window -t <%= @project_name %>:1 -n shell
|
11
|
+
|
12
|
+
tmux send-keys -t <%= @project_name %>:0 "cd $BASE; vim" C-m
|
13
|
+
tmux send-keys -t <%= @project_name %>:1 "cd $BASE;" C-m
|
14
|
+
|
15
|
+
tmux select-window -t <%= @project_name %>:0
|
16
|
+
tmux attach-session -t <%= @project_name %>
|
17
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tmuxification/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "tmuxification"
|
8
|
+
gem.version = Tmuxification::VERSION
|
9
|
+
gem.authors = ["Kris Leech"]
|
10
|
+
gem.email = ["kris.leech@gmail.com"]
|
11
|
+
gem.description = 'Generate tmux configurations for your projects'
|
12
|
+
gem.summary = 'Generate tmux configurations for your projects'
|
13
|
+
gem.homepage = "https://github.com/krisleech/tmuxinator"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_runtime_dependency 'thor'
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tmuxification
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kris Leech
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: Generate tmux configurations for your projects
|
31
|
+
email:
|
32
|
+
- kris.leech@gmail.com
|
33
|
+
executables:
|
34
|
+
- tmuxification
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files: []
|
37
|
+
files:
|
38
|
+
- .gitignore
|
39
|
+
- Gemfile
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/tmuxification
|
44
|
+
- lib/tmuxification.rb
|
45
|
+
- lib/tmuxification/version.rb
|
46
|
+
- templates/default.tmux.erb
|
47
|
+
- tmuxification.gemspec
|
48
|
+
homepage: https://github.com/krisleech/tmuxinator
|
49
|
+
licenses: []
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.8.23
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: Generate tmux configurations for your projects
|
72
|
+
test_files: []
|