muxify 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +10 -20
- data/bin/muxify +6 -2
- data/lib/muxify.rb +2 -2
- data/lib/muxify/builder.rb +71 -14
- data/lib/muxify/cli.rb +14 -9
- data/lib/muxify/linker.rb +1 -1
- data/lib/muxify/version.rb +1 -1
- data/muxify.gemspec +13 -13
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b894edbf3617f9e7110340a7b49cd0bb6ecf17a0eb7bccc856d9ff4d7bb748f1
|
4
|
+
data.tar.gz: bf074fc4b1d0b70016bab5c6ce901d149264c9e336239bfbd0f83606d00ae2f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e3d74dbca219e9bd14040af31fe0a63684397e6bea31b97017a644c3369ea1d418eb4758eb39bb194d493622344c63e63af194e075fb5c11a8f9f1bb1f12017
|
7
|
+
data.tar.gz: e77e6b6d5bf88d362ca42966e11cccdf1131e94a7288c7d295ca39e6453d50e412e1841d1febe058d5d03698af93fe8925f3fbed6009666a68e293177e81c583
|
data/README.md
CHANGED
@@ -1,34 +1,24 @@
|
|
1
1
|
# Muxify
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Simple tmux project config.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
gem 'muxify'
|
7
|
+
```sh
|
8
|
+
which tmux || brew install tmux
|
9
|
+
sudo gem install muxify
|
13
10
|
```
|
14
11
|
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install muxify
|
22
|
-
|
23
12
|
## Usage
|
24
13
|
|
25
|
-
|
26
|
-
|
27
|
-
|
14
|
+
```sh
|
15
|
+
muxify add /path/to/my_app
|
16
|
+
mux my_app
|
17
|
+
```
|
28
18
|
|
29
|
-
|
19
|
+
## Thanks
|
30
20
|
|
31
|
-
|
21
|
+
* https://github.com/tmuxinator/tmuxinator
|
32
22
|
|
33
23
|
## Contributing
|
34
24
|
|
data/bin/muxify
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if File.directory? File.expand_path('../../.git', __FILE__)
|
4
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'bundler/setup'
|
8
|
+
require 'muxify'
|
5
9
|
|
6
10
|
Muxify::CLI.start(ARGV)
|
data/lib/muxify.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'muxify/cli'
|
2
|
+
require 'muxify/version'
|
data/lib/muxify/builder.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require 'yaml'
|
2
2
|
|
3
3
|
module Muxify
|
4
4
|
class Builder
|
5
|
+
CUSTOM_CONFIG_PATH = File.join(ENV['HOME'], '.muxifyrc')
|
6
|
+
private_constant :CUSTOM_CONFIG_PATH
|
7
|
+
|
5
8
|
def self.call(*args)
|
6
9
|
new(*args).to_yaml
|
7
10
|
end
|
@@ -28,7 +31,15 @@ module Muxify
|
|
28
31
|
end
|
29
32
|
|
30
33
|
def windows
|
31
|
-
Windows.new(root).all
|
34
|
+
Windows.new(root).all.tap do |windows|
|
35
|
+
custom_windows.each do |name, command|
|
36
|
+
windows << {name => command}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def custom_windows
|
42
|
+
YAML.load_file(CUSTOM_CONFIG_PATH).dig(name, 'windows') || {}
|
32
43
|
end
|
33
44
|
|
34
45
|
class Windows
|
@@ -43,6 +54,9 @@ module Muxify
|
|
43
54
|
*logs,
|
44
55
|
*foreman,
|
45
56
|
*rails,
|
57
|
+
*elixir_non_phoenix,
|
58
|
+
*phoenix,
|
59
|
+
*nodejs,
|
46
60
|
*django,
|
47
61
|
]
|
48
62
|
end
|
@@ -52,26 +66,26 @@ module Muxify
|
|
52
66
|
attr_reader :root
|
53
67
|
|
54
68
|
def shell
|
55
|
-
[{shell
|
69
|
+
[{'shell' => ('git fetch; git status' if git?)}]
|
56
70
|
end
|
57
71
|
|
58
72
|
def git?
|
59
|
-
|
73
|
+
directory?('.git')
|
60
74
|
end
|
61
75
|
|
62
76
|
def editor
|
63
|
-
[{editor
|
77
|
+
[{'editor' => ENV.fetch('EDITOR', 'vim')}]
|
64
78
|
end
|
65
79
|
|
66
80
|
def logs
|
67
81
|
return [] if Dir["#{root}/log/*.log"].empty?
|
68
|
-
[{logs
|
82
|
+
[{'logs' => 'tail -f log/*.log'}]
|
69
83
|
end
|
70
84
|
|
71
85
|
def foreman
|
72
86
|
return [] unless foreman?
|
73
|
-
[{foreman
|
74
|
-
|
87
|
+
[{'foreman' => <<-SH.strip}]
|
88
|
+
ps aux | grep 'unicorn_rails master' | awk '{print $2}' | xargs kill; foreman start
|
75
89
|
SH
|
76
90
|
end
|
77
91
|
|
@@ -82,21 +96,56 @@ module Muxify
|
|
82
96
|
def rails
|
83
97
|
return [] unless rails?
|
84
98
|
[
|
85
|
-
{db
|
86
|
-
{console
|
99
|
+
{'db' => 'rails db'},
|
100
|
+
{'console' => 'rails console'},
|
87
101
|
]
|
88
102
|
end
|
89
103
|
|
90
104
|
def rails?
|
91
|
-
|
105
|
+
exists?('bin/rails')
|
106
|
+
end
|
107
|
+
|
108
|
+
def elixir_non_phoenix
|
109
|
+
return [] unless elixir_non_phoenix?
|
110
|
+
[
|
111
|
+
{'console' => 'iex -S mix'},
|
112
|
+
{'server' => 'mix'},
|
113
|
+
]
|
114
|
+
end
|
115
|
+
|
116
|
+
def elixir_non_phoenix?
|
117
|
+
exists?('mix.exs') && !phoenix?
|
118
|
+
end
|
119
|
+
|
120
|
+
def phoenix
|
121
|
+
return [] unless phoenix?
|
122
|
+
[
|
123
|
+
{'console' => 'iex -S mix phoenix.server'},
|
124
|
+
{'server' => 'mix phoenix.server'},
|
125
|
+
]
|
126
|
+
end
|
127
|
+
|
128
|
+
def phoenix?
|
129
|
+
directory?('deps/phoenix')
|
130
|
+
end
|
131
|
+
|
132
|
+
def nodejs
|
133
|
+
return [] unless nodejs?
|
134
|
+
[
|
135
|
+
{'console' => 'node'},
|
136
|
+
]
|
137
|
+
end
|
138
|
+
|
139
|
+
def nodejs?
|
140
|
+
exists?('package.json') && !rails?
|
92
141
|
end
|
93
142
|
|
94
143
|
def django
|
95
144
|
return [] unless django?
|
96
145
|
[
|
97
|
-
{db
|
98
|
-
{console
|
99
|
-
{server
|
146
|
+
{'db' => 'python manage.py dbshell'},
|
147
|
+
{'console' => 'python manage.py shell'},
|
148
|
+
{'server' => 'python manage.py runserver'},
|
100
149
|
]
|
101
150
|
end
|
102
151
|
|
@@ -104,6 +153,14 @@ module Muxify
|
|
104
153
|
python_requirements = File.join(root, 'requirements.txt')
|
105
154
|
File.exists?(python_requirements) && File.read(python_requirements).include?('django')
|
106
155
|
end
|
156
|
+
|
157
|
+
def directory?(relative_path)
|
158
|
+
File.directory?(File.join(root, relative_path))
|
159
|
+
end
|
160
|
+
|
161
|
+
def exists?(relative_path)
|
162
|
+
File.exists?(File.join(root, relative_path))
|
163
|
+
end
|
107
164
|
end
|
108
165
|
end
|
109
166
|
end
|
data/lib/muxify/cli.rb
CHANGED
@@ -1,17 +1,22 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'thor'
|
2
|
+
require 'muxify/builder'
|
3
|
+
require 'muxify/linker'
|
4
4
|
|
5
5
|
module Muxify
|
6
6
|
class CLI < Thor
|
7
|
-
desc "add", "Adds tmuxinator config for current path"
|
8
|
-
def add
|
9
|
-
Muxify::Linker.(root:
|
7
|
+
desc "add", "Adds tmuxinator config for current (or supplied) path"
|
8
|
+
def add(root = Dir.pwd)
|
9
|
+
Muxify::Linker.(root: root)
|
10
10
|
end
|
11
11
|
|
12
|
-
desc "debug", "Prints tmuxinator config of current path to stdout"
|
13
|
-
def debug
|
14
|
-
puts Muxify::Builder.(root:
|
12
|
+
desc "debug", "Prints tmuxinator config of current (or supplied) path to stdout"
|
13
|
+
def debug(root = Dir.pwd)
|
14
|
+
puts Muxify::Builder.(root: root)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "stop", "Kills tmux session"
|
18
|
+
def stop(name = File.basename(Dir.pwd))
|
19
|
+
Kernel.system("tmux kill-session -t #{name}")
|
15
20
|
end
|
16
21
|
end
|
17
22
|
end
|
data/lib/muxify/linker.rb
CHANGED
data/lib/muxify/version.rb
CHANGED
data/muxify.gemspec
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require 'muxify/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'muxify'
|
8
8
|
spec.version = Muxify::VERSION
|
9
9
|
spec.authors = ["Zubin Henner"]
|
10
|
-
spec.email = [
|
10
|
+
spec.email = ['zubin@users.noreply.github.com']
|
11
11
|
|
12
12
|
spec.summary = %q{Simple tmux project config}
|
13
|
-
spec.homepage =
|
13
|
+
spec.homepage = 'https://github.com/zubin/muxify'
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
16
|
f.match(%r{^(test|spec|features)/})
|
17
17
|
end
|
18
|
-
spec.bindir =
|
19
|
-
spec.executables = [
|
20
|
-
spec.require_paths = [
|
18
|
+
spec.bindir = 'bin'
|
19
|
+
spec.executables = ['muxify']
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_dependency
|
23
|
-
spec.add_dependency
|
22
|
+
spec.add_dependency 'thor'
|
23
|
+
spec.add_dependency 'tmuxinator'
|
24
24
|
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
28
|
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.2
|
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: 2018-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.7.3
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Simple tmux project config
|