muxify 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0c491e582468e322ed34bd2ab7c2c170f97fa81b
4
- data.tar.gz: b7a454d754003a91ea49d67755fa84e488f331b8
2
+ SHA256:
3
+ metadata.gz: b894edbf3617f9e7110340a7b49cd0bb6ecf17a0eb7bccc856d9ff4d7bb748f1
4
+ data.tar.gz: bf074fc4b1d0b70016bab5c6ce901d149264c9e336239bfbd0f83606d00ae2f2
5
5
  SHA512:
6
- metadata.gz: bb71d00bdbef20a69fecea455a55be396f13ae7e7900084f2ebc4a3dfe3ef533584cb54b841a328497c87d7d92c0931640df51128a134d7d8e71e42a63ec2fc0
7
- data.tar.gz: 4d0b9b0251f329297206ab5a02d3944169ad3afb2e8feeb51c9a140ff62d6c7cc77a2a962a4329546d1fd1a9791cec527d2a7cbd952ae1258c72259b6229b908
6
+ metadata.gz: 0e3d74dbca219e9bd14040af31fe0a63684397e6bea31b97017a644c3369ea1d418eb4758eb39bb194d493622344c63e63af194e075fb5c11a8f9f1bb1f12017
7
+ data.tar.gz: e77e6b6d5bf88d362ca42966e11cccdf1131e94a7288c7d295ca39e6453d50e412e1841d1febe058d5d03698af93fe8925f3fbed6009666a68e293177e81c583
data/README.md CHANGED
@@ -1,34 +1,24 @@
1
1
  # Muxify
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/muxify`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
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
- TODO: Write usage instructions here
26
-
27
- ## Development
14
+ ```sh
15
+ muxify add /path/to/my_app
16
+ mux my_app
17
+ ```
28
18
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
19
+ ## Thanks
30
20
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
- require "bundler/setup"
4
- require "muxify"
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)
@@ -1,2 +1,2 @@
1
- require "muxify/cli"
2
- require "muxify/version"
1
+ require 'muxify/cli'
2
+ require 'muxify/version'
@@ -1,7 +1,10 @@
1
- require "yaml"
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: ('git fetch; git status' if git?)}]
69
+ [{'shell' => ('git fetch; git status' if git?)}]
56
70
  end
57
71
 
58
72
  def git?
59
- File.exists?(File.join(root, '.git'))
73
+ directory?('.git')
60
74
  end
61
75
 
62
76
  def editor
63
- [{editor: ENV.fetch('EDITOR', 'vim')}]
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: 'tail -f log/*.log'}]
82
+ [{'logs' => 'tail -f log/*.log'}]
69
83
  end
70
84
 
71
85
  def foreman
72
86
  return [] unless foreman?
73
- [{foreman: <<-SH.strip}]
74
- ps aux | grep 'unicorn_rails master' | awk '{print $2}' | xargs kill; foreman start
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: 'rails db'},
86
- {console: 'rails console'},
99
+ {'db' => 'rails db'},
100
+ {'console' => 'rails console'},
87
101
  ]
88
102
  end
89
103
 
90
104
  def rails?
91
- File.exists?(File.join(root, 'bin/rails'))
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: 'python manage.py dbshell'},
98
- {console: 'python manage.py shell'},
99
- {server: 'python manage.py runserver'},
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
@@ -1,17 +1,22 @@
1
- require "thor"
2
- require "muxify/builder"
3
- require "muxify/linker"
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: Dir.pwd)
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: Dir.pwd)
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
@@ -1,4 +1,4 @@
1
- require "fileutils"
1
+ require 'fileutils'
2
2
 
3
3
  module Muxify
4
4
  class Linker
@@ -1,3 +1,3 @@
1
1
  module Muxify
2
- VERSION = "0.1.1"
2
+ VERSION = '0.1.2'
3
3
  end
@@ -1,28 +1,28 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "muxify/version"
4
+ require 'muxify/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "muxify"
7
+ spec.name = 'muxify'
8
8
  spec.version = Muxify::VERSION
9
9
  spec.authors = ["Zubin Henner"]
10
- spec.email = ["zubin@users.noreply.github.com"]
10
+ spec.email = ['zubin@users.noreply.github.com']
11
11
 
12
12
  spec.summary = %q{Simple tmux project config}
13
- spec.homepage = "https://github.com/zubin/muxify"
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 = "bin"
19
- spec.executables = ["muxify"]
20
- spec.require_paths = ["lib"]
18
+ spec.bindir = 'bin'
19
+ spec.executables = ['muxify']
20
+ spec.require_paths = ['lib']
21
21
 
22
- spec.add_dependency "thor"
23
- spec.add_dependency "tmuxinator"
22
+ spec.add_dependency 'thor'
23
+ spec.add_dependency 'tmuxinator'
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.15"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "rspec", "~> 3.0"
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.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: 2017-06-21 00:00:00.000000000 Z
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.6.11
125
+ rubygems_version: 2.7.3
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Simple tmux project config