muxify 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +62 -5
- data/Rakefile +2 -0
- data/lib/muxify/builder.rb +15 -2
- data/lib/muxify/cli.rb +2 -0
- data/lib/muxify/linker.rb +2 -0
- data/lib/muxify/version.rb +3 -1
- data/lib/muxify.rb +2 -0
- data/muxify.gemspec +7 -6
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c4737c89a2923ba7fe743328b1431802e3576f1d1e7b9a0225c9a058b9cf3cd
|
4
|
+
data.tar.gz: 158303895c198e9d8ce430397a1c0ff2ee5afec6715b2694a06548f6a80dd91d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0efec262d17e6d827c2e73afaf64505bded82ce552fafd3cf2b334786629a83acbdc871fb17227a183e247a2deada7d692a961dbe0b80a6bb68b798ce4201f4d
|
7
|
+
data.tar.gz: 62917a4b44014294f0e5bb7dd9c776fe8f7b7785078e00c8c88ee2e85a5706e7c30b3a6bc1c24be2499585502a6aca777dadd2db235401be6c34488cc3f6db73
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,19 +1,76 @@
|
|
1
1
|
# Muxify
|
2
2
|
|
3
|
-
|
3
|
+
Sets up consistent tmux development environment for projects.
|
4
|
+
|
5
|
+
Why?
|
6
|
+
|
7
|
+
* Saves time and effort switching projects.
|
8
|
+
* Ensures consistent layout which is faster to navigate via muscle memory.
|
9
|
+
* Avoids visual and mental overhead of maintaining numerous tabs.
|
10
|
+
|
11
|
+
## Dependencies
|
12
|
+
|
13
|
+
* MacOS (may work on Linux)
|
14
|
+
* Ruby
|
15
|
+
* Tmux (`which tmux || brew install tmux`)
|
4
16
|
|
5
17
|
## Installation
|
6
18
|
|
7
19
|
```sh
|
8
|
-
|
9
|
-
sudo gem install muxify
|
20
|
+
$ gem install muxify
|
10
21
|
```
|
11
22
|
|
12
23
|
## Usage
|
13
24
|
|
14
25
|
```sh
|
15
|
-
muxify
|
16
|
-
|
26
|
+
$ muxify -h
|
27
|
+
|
28
|
+
Commands:
|
29
|
+
muxify add # Adds tmuxinator config for current (or supplied) path
|
30
|
+
muxify debug # Prints tmuxinator config of current (or supplied) path to stdout
|
31
|
+
muxify help [COMMAND] # Describe available commands or one specific command
|
32
|
+
muxify stop # Kills tmux session
|
33
|
+
```
|
34
|
+
|
35
|
+
For example, add a project like so:
|
36
|
+
|
37
|
+
```sh
|
38
|
+
$ muxify add /path/to/my_app
|
39
|
+
$ mux my_app
|
40
|
+
```
|
41
|
+
|
42
|
+
Depending on its type, this will create the following tmux windows for a project:
|
43
|
+
|
44
|
+
* Standard (applies to all projects)
|
45
|
+
* shell (performs `git fetch` when `.git` is present)
|
46
|
+
* editor (invokes terminal editor, defaulting to `vim` when `$EDITOR` is unset)
|
47
|
+
* logs (when present, truncates then tails `log/*.log`)
|
48
|
+
* Rails (identified by presence of `bin/rails`)
|
49
|
+
* db (`rails db`)
|
50
|
+
* console (`rails console`)
|
51
|
+
* NodeJS (identified by presence of `package.json` when non-Rails)
|
52
|
+
* console (`node`)
|
53
|
+
* Elixir (identified by presence of `mix.exs` when non-Phoenix)
|
54
|
+
* console (`iex -S mix`)
|
55
|
+
* server (`mix`)
|
56
|
+
* Elixir/Phoenix (identified by presence of `deps/phoenix`)
|
57
|
+
* console (`iex -S mix phoenix.server`)
|
58
|
+
* server (`mix phoenix.server`)
|
59
|
+
* Django (identified by `requirements.txt` containing `django`)
|
60
|
+
* db (`python manage.py dbshell`)
|
61
|
+
* console (`python manage.py shell`)
|
62
|
+
* server (`python manage.py runserver`)
|
63
|
+
|
64
|
+
## Customising projects
|
65
|
+
|
66
|
+
To add a custom tmux window for a project:
|
67
|
+
|
68
|
+
1. Create a file called `~/.muxifyrc`.
|
69
|
+
1. Edit it in YAML format; eg to add a tmux window to `my_app` project which is named `server` and invokes `yarn dev`:
|
70
|
+
```yaml
|
71
|
+
my_app:
|
72
|
+
windows:
|
73
|
+
server: yarn dev
|
17
74
|
```
|
18
75
|
|
19
76
|
## Thanks
|
data/Rakefile
CHANGED
data/lib/muxify/builder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
|
3
5
|
module Muxify
|
@@ -39,7 +41,9 @@ module Muxify
|
|
39
41
|
end
|
40
42
|
|
41
43
|
def custom_windows
|
42
|
-
|
44
|
+
return {} unless File.exist?(CUSTOM_CONFIG_PATH)
|
45
|
+
|
46
|
+
YAML.load_file(CUSTOM_CONFIG_PATH).dig(name, 'windows')
|
43
47
|
end
|
44
48
|
|
45
49
|
class Windows
|
@@ -86,10 +90,19 @@ module Muxify
|
|
86
90
|
end
|
87
91
|
|
88
92
|
def logs
|
89
|
-
return [] if
|
93
|
+
return [] if logfiles.empty?
|
94
|
+
logfiles.each(&method(:truncate_file))
|
90
95
|
[{'logs' => 'tail -f log/*.log'}]
|
91
96
|
end
|
92
97
|
|
98
|
+
def logfiles
|
99
|
+
@logfiles ||= Dir["#{root}/log/*.log"]
|
100
|
+
end
|
101
|
+
|
102
|
+
def truncate_file(path)
|
103
|
+
File.truncate(path, 0)
|
104
|
+
end
|
105
|
+
|
93
106
|
def foreman
|
94
107
|
return [] unless foreman?
|
95
108
|
[{'foreman' => <<-SH.strip}]
|
data/lib/muxify/cli.rb
CHANGED
data/lib/muxify/linker.rb
CHANGED
data/lib/muxify/version.rb
CHANGED
data/lib/muxify.rb
CHANGED
data/muxify.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'muxify/version'
|
5
6
|
|
@@ -9,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
9
10
|
spec.authors = ["Zubin Henner"]
|
10
11
|
spec.email = ['zubin@users.noreply.github.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
+
spec.summary = "Simple tmux project config"
|
13
14
|
spec.homepage = 'https://github.com/zubin/muxify'
|
14
15
|
|
15
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -22,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
22
23
|
spec.add_dependency 'thor'
|
23
24
|
spec.add_dependency 'tmuxinator'
|
24
25
|
|
25
|
-
spec.add_development_dependency 'bundler'
|
26
|
-
spec.add_development_dependency 'rake'
|
27
|
-
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'bundler'
|
27
|
+
spec.add_development_dependency 'rake'
|
28
|
+
spec.add_development_dependency 'rspec'
|
28
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muxify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zubin Henner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -42,44 +42,44 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
description:
|
84
84
|
email:
|
85
85
|
- zubin@users.noreply.github.com
|
@@ -121,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
|
125
|
-
rubygems_version: 2.7.3
|
124
|
+
rubygems_version: 3.0.3
|
126
125
|
signing_key:
|
127
126
|
specification_version: 4
|
128
127
|
summary: Simple tmux project config
|