muxify 0.1.10 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7643b48e39c0bdea0bcbe70da3bc38872eec60fb1256209ab462d3894c81ded
4
- data.tar.gz: f8c00a63134eae01e183340963afe1a8bcd63874d7beeb0ed2a6f4129e54ee6c
3
+ metadata.gz: 56167a6ae12faed56bee89852ed0e97297d1bb84d6a38f98060c5df1fb5fea23
4
+ data.tar.gz: 5ab6bea4d7d3906e4f9317e138a24809885c4ea79a250999804b6f9dd3436f90
5
5
  SHA512:
6
- metadata.gz: 9513967b1db9a34a44168798e16619ccd9aff89d1d66046ae466444b3185c3c46b9b44aae223029390c88e7dc512b6bfae62162277987fe18338b4c3bd98b59d
7
- data.tar.gz: 4c64b6891a1d6de45f3aa439c73f34da09044038964dd02f4a8d9aa5459e940289be6fffd8ba651b1d58cb4d9b4bff5d761b6e917e0697755e49384ff0d055d7
6
+ metadata.gz: 5c9c7d5bd6c246e676caf4bc0823b01b85ab87a8b5dc11374d8169dfa8e595da6ae2417c44d360466f1229e8b0d52d55685f34ee338d00793cfb3a9ba3e16304
7
+ data.tar.gz: e4a030588dc175bbc4975dd0b18edeaa84e43244c682a6fff0ee78526bd043ac9421aed48f13e4f8afccb9df2a2a173c36fbc6c91eb851c99f735f16a0d64217
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  language: ruby
3
3
  rvm:
4
- - 2.7
5
4
  - 3.0
5
+ - 3.1
6
6
  deploy:
7
7
  provider: rubygems
8
8
  on:
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in muxify.gemspec
6
6
  gemspec
data/README.md CHANGED
@@ -64,7 +64,9 @@ Depending on its type, this will create the following tmux windows for a project
64
64
 
65
65
  ## Customising projects
66
66
 
67
- To add a custom tmux window for a project:
67
+ Each project may have custom windows via a `.muxifyrc` file.
68
+
69
+ ### Using a .muxifyrc in your home directory
68
70
 
69
71
  1. Create a file called `~/.muxifyrc`.
70
72
  1. Edit it in YAML format; eg to add a tmux window to `my_app` project which is named `server` and invokes `yarn dev`:
@@ -75,6 +77,23 @@ my_app:
75
77
  server: yarn dev
76
78
  ```
77
79
 
80
+ If you want a custom window for all projects:
81
+
82
+ ```yaml
83
+ windows:
84
+ echo_all_projects: "echo 'this will apply to all projects'"
85
+ ```
86
+
87
+ ### Using a .muxifyrc in your project directory
88
+
89
+ 1. Create a file called `my_app/.muxifyrc` (given your project is in `my_app`).
90
+ 1. Edit it in YAML format; eg to add a tmux window to `my_app` project which is named `server` and invokes `yarn dev`:
91
+
92
+ ```yaml
93
+ windows:
94
+ server: yarn dev
95
+ ```
96
+
78
97
  ## Thanks
79
98
 
80
99
  - https://github.com/tmuxinator/tmuxinator
data/Rakefile CHANGED
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rubocop/rake_task'
5
- require 'rspec/core/rake_task'
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "standard/rake"
6
6
 
7
- RuboCop::RakeTask.new
8
7
  RSpec::Core::RakeTask.new(:spec)
9
8
 
10
- task default: %i[rubocop spec]
9
+ task default: %i[standard spec]
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'yaml'
3
+ require "yaml"
4
4
 
5
5
  module Muxify
6
6
  class Builder
7
- CUSTOM_CONFIG_PATH = File.join(ENV['HOME'], '.muxifyrc')
8
- private_constant :CUSTOM_CONFIG_PATH
7
+ DEFAULT_CUSTOM_CONFIG_PATH = File.join(ENV["HOME"], ".muxifyrc")
8
+ private_constant :DEFAULT_CUSTOM_CONFIG_PATH
9
9
 
10
10
  def self.call(*args)
11
11
  new(*args).to_yaml
12
12
  end
13
13
 
14
- def initialize(root, name: nil, custom_config_path: CUSTOM_CONFIG_PATH)
14
+ def initialize(root, name: nil, custom_config_path: nil)
15
15
  @root = File.expand_path(root)
16
16
  @name = name || File.basename(@root)
17
17
  @custom_config_path = custom_config_path
@@ -27,9 +27,9 @@ module Muxify
27
27
 
28
28
  def config
29
29
  {
30
- 'name' => name,
31
- 'root' => root,
32
- 'windows' => windows,
30
+ "name" => name,
31
+ "root" => root,
32
+ "windows" => windows
33
33
  }
34
34
  end
35
35
 
@@ -42,18 +42,24 @@ module Muxify
42
42
  end
43
43
 
44
44
  def custom_windows
45
- return {} unless custom_config.key?('windows')
46
-
47
- YAML.load_file(custom_config_path).dig(name, 'windows') || {}
45
+ custom_config_paths.each_with_object({}) do |custom_config_path, result|
46
+ [
47
+ YAML.safe_load_file(custom_config_path)&.dig(name, "windows"),
48
+ YAML.safe_load_file(custom_config_path)&.dig("windows")
49
+ ].compact.each(&result.method(:merge!))
50
+ end
48
51
  end
49
52
 
50
- def custom_config
51
- return {} unless File.exist?(custom_config_path)
52
-
53
- yaml = YAML.load_file(custom_config_path)
54
- return {} unless yaml
53
+ def custom_config_paths
54
+ [
55
+ DEFAULT_CUSTOM_CONFIG_PATH,
56
+ project_custom_config_path,
57
+ custom_config_path
58
+ ].compact.uniq.select(&File.method(:exist?))
59
+ end
55
60
 
56
- yaml.fetch(name, {})
61
+ def project_custom_config_path
62
+ File.join(root, ".muxifyrc")
57
63
  end
58
64
 
59
65
  class Windows
@@ -70,7 +76,7 @@ module Muxify
70
76
  *elixir_non_phoenix,
71
77
  *phoenix,
72
78
  *nodejs,
73
- *django,
79
+ *django
74
80
  ]
75
81
  end
76
82
 
@@ -79,28 +85,28 @@ module Muxify
79
85
  attr_reader :root
80
86
 
81
87
  def shell
82
- [{'shell' => init_shell}]
88
+ [{"shell" => init_shell}]
83
89
  end
84
90
 
85
91
  def init_shell
86
92
  return 'echo "Not a git repository."' unless git?
87
93
 
88
- 'git fetch; git status'
94
+ "git fetch; git status"
89
95
  end
90
96
 
91
97
  def git?
92
- directory?('.git')
98
+ directory?(".git")
93
99
  end
94
100
 
95
101
  def editor
96
- [{'editor' => ENV.fetch('EDITOR', 'vim')}]
102
+ [{"editor" => ENV.fetch("EDITOR", "vim")}]
97
103
  end
98
104
 
99
105
  def logs
100
106
  return [] if logfiles.empty?
101
107
 
102
108
  logfiles.each(&method(:truncate_file))
103
- [{'logs' => 'tail -f log/*.log'}]
109
+ [{"logs" => "tail -f log/*.log"}]
104
110
  end
105
111
 
106
112
  def logfiles
@@ -115,67 +121,67 @@ module Muxify
115
121
  return [] unless rails?
116
122
 
117
123
  [
118
- {'db' => 'rails db'},
119
- {'console' => 'rails console'},
120
- {'server' => File.expand_path('../../bin/rails_server_with_puma_dev', __dir__)},
124
+ {"db" => "rails db"},
125
+ {"console" => "rails console"},
126
+ {"server" => File.expand_path("../../bin/rails_server_with_puma_dev", __dir__)}
121
127
  ]
122
128
  end
123
129
 
124
130
  def rails?
125
- exists?('bin/rails')
131
+ exists?("bin/rails")
126
132
  end
127
133
 
128
134
  def elixir_non_phoenix
129
135
  return [] unless elixir_non_phoenix?
130
136
 
131
137
  [
132
- {'console' => 'iex -S mix'},
133
- {'server' => 'mix'},
138
+ {"console" => "iex -S mix"},
139
+ {"server" => "mix"}
134
140
  ]
135
141
  end
136
142
 
137
143
  def elixir_non_phoenix?
138
- exists?('mix.exs') && !phoenix?
144
+ exists?("mix.exs") && !phoenix?
139
145
  end
140
146
 
141
147
  def phoenix
142
148
  return [] unless phoenix?
143
149
 
144
150
  [
145
- {'console' => 'iex -S mix phoenix.server'},
146
- {'server' => 'mix phoenix.server'},
151
+ {"console" => "iex -S mix phx.server"},
152
+ {"server" => "mix phx.server"}
147
153
  ]
148
154
  end
149
155
 
150
156
  def phoenix?
151
- directory?('deps/phoenix')
157
+ directory?("deps/phoenix")
152
158
  end
153
159
 
154
160
  def nodejs
155
161
  return [] unless nodejs?
156
162
 
157
163
  [
158
- {'console' => 'node'},
164
+ {"console" => "node"}
159
165
  ]
160
166
  end
161
167
 
162
168
  def nodejs?
163
- exists?('package.json') && !rails?
169
+ exists?("package.json") && !rails?
164
170
  end
165
171
 
166
172
  def django
167
173
  return [] unless django?
168
174
 
169
175
  [
170
- {'db' => 'python manage.py dbshell'},
171
- {'console' => 'python manage.py shell'},
172
- {'server' => 'python manage.py runserver'},
176
+ {"db" => "python manage.py dbshell"},
177
+ {"console" => "python manage.py shell"},
178
+ {"server" => "python manage.py runserver"}
173
179
  ]
174
180
  end
175
181
 
176
182
  def django?
177
- python_requirements = File.join(root, 'requirements.txt')
178
- File.exist?(python_requirements) && File.read(python_requirements).include?('django')
183
+ python_requirements = File.join(root, "requirements.txt")
184
+ File.exist?(python_requirements) && File.read(python_requirements).include?("django")
179
185
  end
180
186
 
181
187
  def directory?(relative_path)
data/lib/muxify/cli.rb CHANGED
@@ -1,27 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thor'
4
- require 'muxify/builder'
5
- require 'muxify/linker'
3
+ require "thor"
4
+ require "muxify/builder"
5
+ require "muxify/linker"
6
6
 
7
7
  module Muxify
8
8
  class CLI < Thor
9
- desc 'add', 'Adds tmuxinator config for current (or supplied) path'
9
+ desc "add", "Adds tmuxinator config for current (or supplied) path"
10
10
  def add(root = Dir.pwd)
11
11
  Muxify::Linker.call(root: root)
12
12
  end
13
13
 
14
- desc 'debug', 'Prints tmuxinator config of current (or supplied) path to stdout'
14
+ desc "debug", "Prints tmuxinator config of current (or supplied) path to stdout"
15
15
  def debug(root = Dir.pwd)
16
16
  puts Muxify::Builder.call(root)
17
17
  end
18
18
 
19
- desc 'stop', 'Kills tmux session'
19
+ desc "stop", "Kills tmux session"
20
20
  def stop(name = File.basename(Dir.pwd))
21
21
  Kernel.system("tmux kill-session -t #{name}")
22
22
  end
23
23
 
24
- desc 'version', 'Print current version'
24
+ desc "version", "Print current version"
25
25
  def version
26
26
  puts Muxify::VERSION
27
27
  end
data/lib/muxify/linker.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'fileutils'
3
+ require "fileutils"
4
4
 
5
5
  module Muxify
6
6
  class Linker
7
- TMUXINATOR_CONFIG_PATH = File.expand_path(File.join(ENV.fetch('HOME'), '.tmuxinator')).freeze
7
+ TMUXINATOR_CONFIG_PATH = File.expand_path(File.join(ENV.fetch("HOME"), ".tmuxinator")).freeze
8
8
  private_constant :TMUXINATOR_CONFIG_PATH
9
9
 
10
10
  def self.call(**args)
@@ -17,7 +17,7 @@ module Muxify
17
17
 
18
18
  def call
19
19
  FileUtils.mkdir_p(TMUXINATOR_CONFIG_PATH)
20
- File.open(config_path, 'w') { |f| f << contents }
20
+ File.open(config_path, "w") { |f| f << contents }
21
21
  end
22
22
 
23
23
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Muxify
4
- VERSION = '0.1.10'
4
+ VERSION = "0.1.12"
5
5
  end
data/lib/muxify.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'muxify/cli'
4
- require 'muxify/version'
3
+ require "muxify/cli"
4
+ require "muxify/version"
data/muxify.gemspec CHANGED
@@ -1,31 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'muxify/version'
5
+ require "muxify/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'muxify'
9
- spec.version = Muxify::VERSION
10
- spec.authors = ['Zubin Henner']
11
- spec.email = ['zubin@users.noreply.github.com']
8
+ spec.name = "muxify"
9
+ spec.version = Muxify::VERSION
10
+ spec.authors = ["Zubin Henner"]
11
+ spec.email = ["zubin@users.noreply.github.com"]
12
12
 
13
- spec.summary = 'Simple tmux project config'
14
- spec.homepage = 'https://github.com/zubin/muxify'
13
+ spec.summary = "Simple tmux project config"
14
+ spec.homepage = "https://github.com/zubin/muxify"
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
17
  f.match(%r{^(test|spec|features)/})
18
18
  end
19
- spec.bindir = 'bin'
20
- spec.executables = ['muxify']
21
- spec.require_paths = ['lib']
22
- spec.required_ruby_version = '>= 2.7.0'
19
+ spec.bindir = "bin"
20
+ spec.executables = ["muxify"]
21
+ spec.require_paths = ["lib"]
22
+ spec.required_ruby_version = ">= 3.0.0"
23
23
 
24
- spec.add_dependency 'thor'
25
- spec.add_dependency 'tmuxinator'
24
+ spec.add_dependency "thor"
25
+ spec.add_dependency "tmuxinator"
26
26
 
27
- spec.add_development_dependency 'bundler'
28
- spec.add_development_dependency 'rake'
29
- spec.add_development_dependency 'rspec'
30
- spec.add_development_dependency 'rubocop'
27
+ spec.add_development_dependency "bundler"
28
+ spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "rspec"
30
+ spec.add_development_dependency "standard"
31
31
  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.10
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zubin Henner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-06 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rubocop
84
+ name: standard
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -104,7 +104,6 @@ extra_rdoc_files: []
104
104
  files:
105
105
  - ".gitignore"
106
106
  - ".rspec"
107
- - ".rubocop.yml"
108
107
  - ".travis.yml"
109
108
  - Gemfile
110
109
  - README.md
@@ -133,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
132
  requirements:
134
133
  - - ">="
135
134
  - !ruby/object:Gem::Version
136
- version: 2.7.0
135
+ version: 3.0.0
137
136
  required_rubygems_version: !ruby/object:Gem::Requirement
138
137
  requirements:
139
138
  - - ">="
data/.rubocop.yml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- Layout/SpaceInsideArrayLiteralBrackets:
3
- EnforcedStyle: no_space
4
- Layout/SpaceInsideHashLiteralBraces:
5
- EnforcedStyle: no_space
6
- Style/Documentation:
7
- Enabled: false
8
- Style/StringLiterals:
9
- Enabled: false
10
- Style/TrailingCommaInArguments:
11
- EnforcedStyleForMultiline: comma
12
- Style/TrailingCommaInArrayLiteral:
13
- EnforcedStyleForMultiline: comma
14
- Style/TrailingCommaInHashLiteral:
15
- EnforcedStyleForMultiline: comma