tmuxinator 0.6.7 → 0.6.8

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
  SHA1:
3
- metadata.gz: d5de7720390215b793f31f51f77dbe10c522378c
4
- data.tar.gz: 1c2c93aad4563f698c2eeb06bcf5be2ebb1b7cd1
3
+ metadata.gz: 28b230df62265cc9e7487c362882d6724503c430
4
+ data.tar.gz: 2e4aa507c3a1e5d0918244b0147c54d0b8dcca3e
5
5
  SHA512:
6
- metadata.gz: 3ecbcccfdc487684a71e64824f6249f8a36faf0bd52543e1cb6a28a1c58f01632212d427ea0de70c273c845f886a41c0257cb9b76b68cdc0dfaafa2175d852b2
7
- data.tar.gz: 1c90f9b5e57663e9afb95f726c8d2fcc684061f3b8bb5c3f43296acf9dde912a77b54b06b290905586743f866775b2a4afdad9e133e71bfbd72d9fc0522821fe
6
+ metadata.gz: e397db0f981a7524b9106c4b47f2616aa5aff1486079c023ae8feacb936e8ee37b5617c60af5bebdfb03f354fd13063ccf6ca4cda9fd033dacacb01d5184f46f
7
+ data.tar.gz: 0540b6d4bf2a5c1ab271368ad4d64393a469e380bdab750fefe8957fd3a14764c8cad5fa71be59ad61a9c7a15576453cffa1762a3a221729353fe7d32bda4585
data/.travis.yml CHANGED
@@ -2,6 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - "1.9.3"
4
4
  - "2.0.0"
5
+ - "2.1.2"
5
6
  env:
6
7
  - TMUX_VERSION=master
7
8
  - TMUX_VERSION=1.9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.6.8
2
+ - Remove some duplication #212
3
+ - Add wemux support #88 - Thanks to Andrew Thal (@athal7)
4
+ - Fix typos in readme #217, #216
5
+ - Fix encoding bug #229
6
+ - Fix specs not running due to changes in thor
7
+
1
8
  ## 0.6.7
2
9
  - Remove use of grep for base-index #171
3
10
  - Fix bugs in `Tmuxinator::Config.default?` #169
data/README.md CHANGED
@@ -115,7 +115,7 @@ windows:
115
115
 
116
116
  ## Windows
117
117
 
118
- The windows option allows the specfication of any number of tmux windows. Each window is denoted by a YAML array entry, followed by a name
118
+ The windows option allows the specification of any number of tmux windows. Each window is denoted by a YAML array entry, followed by a name
119
119
  and command to be run.
120
120
 
121
121
  ```
@@ -125,8 +125,8 @@ windows:
125
125
 
126
126
  ## Panes
127
127
 
128
- **_Note that if you wish to use panes, make sure that you do not have `.` in your project name. tmux uses `.` to delimit between window and pane indicies,
129
- and tmuxinator uses the project name in combination with these indicies to target the correct pane or window._**
128
+ **_Note that if you wish to use panes, make sure that you do not have `.` in your project name. tmux uses `.` to delimit between window and pane indices,
129
+ and tmuxinator uses the project name in combination with these indices to target the correct pane or window._**
130
130
 
131
131
  Panes are optional and are children of window entries, but unlike windows, they do not need a name. In the following example, the `editor` window has 2 panes, one running vim, the other guard.
132
132
 
@@ -188,7 +188,7 @@ tmuxinator start [project]
188
188
 
189
189
  ## Shorthand
190
190
 
191
- An shorthand alias for tmuxinator can also be used.
191
+ A shorthand alias for tmuxinator can also be used.
192
192
 
193
193
  ```
194
194
  mux [command]
data/lib/tmuxinator.rb CHANGED
@@ -5,6 +5,7 @@ require "thor"
5
5
 
6
6
  require "tmuxinator/util"
7
7
  require "tmuxinator/deprecations"
8
+ require "tmuxinator/wemux_support"
8
9
  require "tmuxinator/cli"
9
10
  require "tmuxinator/config"
10
11
  require "tmuxinator/pane"
@@ -0,0 +1,54 @@
1
+ #!<%= ENV["SHELL"] || "/bin/bash" %>
2
+ wemux ls 2>/dev/null
3
+
4
+ if [ "$?" -eq 127 ]; then
5
+ cd <%= root || "." %>
6
+
7
+ # Run pre command.
8
+ <%= pre %>
9
+
10
+ # Create the session and the first window.
11
+ TMUX= <%= tmux %> new-session -d -s <%= name %> -n <%= windows.first.name %>
12
+
13
+ # Set the default path.
14
+ <%= tmux %> set-option -t <%= name %> default-path <%= root.shellescape -%> 1>/dev/null
15
+
16
+ # Create other windows.
17
+ <%- windows.drop(1).each do |window| -%>
18
+ <%= window.tmux_new_window_command %>
19
+ <%- end -%>
20
+
21
+ <%- windows.each do |window| -%>
22
+
23
+ # Window "<%= window.name %>"
24
+ <%- unless window.panes? -%>
25
+ <%= window.tmux_pre_window_command %>
26
+ <%- window.commands.each do |command| -%>
27
+ <%= command %>
28
+ <%- end -%>
29
+ <%- else -%>
30
+ <%- window.panes.each do |pane| -%>
31
+ <%= pane.tmux_pre_window_command %>
32
+ <%= pane.tmux_pre_command %>
33
+ <%- if pane.multiple_commands? %>
34
+ <%- pane.commands.each do |command| -%>
35
+ <%= pane.tmux_main_command(command) %>
36
+ <%- end -%>
37
+ <%- else -%>
38
+ <%= pane.tmux_main_command(commands.first) %>
39
+ <%- end -%>
40
+
41
+ <%- unless pane.last? -%>
42
+ <%= pane.tmux_split_command %>
43
+ <%- end -%>
44
+ <%= window.tmux_layout_command %>
45
+ <%- end -%>
46
+
47
+ <%= window.tmux_select_first_pane %>
48
+ <%- end -%>
49
+ <%- end -%>
50
+
51
+ <%= tmux %> select-window -t <%= base_index %>
52
+ fi
53
+
54
+ wemux attach
@@ -121,11 +121,7 @@ module Tmuxinator
121
121
  def list
122
122
  say "tmuxinator projects:"
123
123
 
124
- configs = Dir["#{Tmuxinator::Config.root}/*.yml"].sort.map do |path|
125
- path.gsub("#{Tmuxinator::Config.root}/", "").gsub(".yml", "")
126
- end
127
-
128
- print_in_columns configs
124
+ print_in_columns Tmuxinator::Config.configs
129
125
  end
130
126
 
131
127
  desc "version", "Display installed tmuxinator version"
@@ -52,9 +52,13 @@ module Tmuxinator
52
52
  "#{File.dirname(__FILE__)}/assets/template.erb"
53
53
  end
54
54
 
55
+ def wemux_template
56
+ "#{File.dirname(__FILE__)}/assets/wemux_template.erb"
57
+ end
58
+
55
59
  def configs
56
60
  Dir["#{Tmuxinator::Config.root}/*.yml"].sort.map do |path|
57
- path.gsub("#{Tmuxinator::Config.root}/", "").gsub(".yml", "")
61
+ File.basename(path, ".yml")
58
62
  end
59
63
  end
60
64
 
@@ -2,11 +2,13 @@ module Tmuxinator
2
2
  class Project
3
3
  include Tmuxinator::Util
4
4
  include Tmuxinator::Deprecations
5
+ include Tmuxinator::WemuxSupport
5
6
 
6
7
  attr_reader :yaml
7
8
 
8
9
  def initialize(yaml)
9
10
  @yaml = yaml
11
+ load_wemux_overrides if wemux?
10
12
  end
11
13
 
12
14
  def render
@@ -157,7 +159,7 @@ module Tmuxinator
157
159
  options_hash = {}
158
160
 
159
161
  options_string = `#{show_tmux_options}`
160
-
162
+ options_string.encode!("UTF-8", :invalid => :replace)
161
163
  options_string.split("\n").map do |entry|
162
164
  key, value = entry.split("\s")
163
165
  options_hash[key] = value
@@ -1,3 +1,3 @@
1
1
  module Tmuxinator
2
- VERSION = "0.6.7"
2
+ VERSION = "0.6.8"
3
3
  end
@@ -0,0 +1,24 @@
1
+ module Tmuxinator
2
+ module WemuxSupport
3
+ def wemux?
4
+ yaml["tmux_command"] == "wemux"
5
+ end
6
+
7
+ def load_wemux_overrides
8
+ self.instance_eval do
9
+ def render
10
+ template = File.read(Tmuxinator::Config.wemux_template)
11
+ Erubis::Eruby.new(template).result(binding)
12
+ end
13
+
14
+ def name
15
+ "wemux"
16
+ end
17
+
18
+ def tmux
19
+ "wemux"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -14,4 +14,12 @@ FactoryGirl.define do
14
14
 
15
15
  initialize_with { Tmuxinator::Project.new(file) }
16
16
  end
17
+
18
+ factory :wemux_project, :class => Tmuxinator::Project do
19
+ ignore do
20
+ file { YAML.load(File.read("#{File.expand_path("spec/fixtures/sample_wemux.yml")}")) }
21
+ end
22
+
23
+ initialize_with { Tmuxinator::Project.new(file) }
24
+ end
17
25
  end
@@ -0,0 +1,37 @@
1
+ # ~/.tmuxinator/sample_wemux.yml
2
+ # you can make as many tabs as you wish...
3
+
4
+ name: sample
5
+ root: ~/test
6
+ pre: sudo /etc/rc.d/mysqld start # Runs before everything
7
+ pre_window: rbenv shell 2.0.0-p247 # Runs in each tab and pane
8
+ tmux_options: -f ~/.tmux.mac.conf # Pass arguments to tmux
9
+ tmux_command: wemux
10
+ windows:
11
+ - editor:
12
+ pre:
13
+ - echo "I get run in each pane, before each pane command!"
14
+ -
15
+ layout: main-vertical
16
+ panes:
17
+ - vim
18
+ - #empty, will just run plain bash
19
+ - top
20
+ - shell:
21
+ - git pull
22
+ - git merge
23
+ - guard:
24
+ layout: tiled
25
+ pre:
26
+ - echo "I get run in each pane."
27
+ - echo "Before each pane command!"
28
+ panes:
29
+ -
30
+ - #empty, will just run plain bash
31
+ -
32
+ - database: bundle exec rails db
33
+ - server: bundle exec rails s
34
+ - logs: tail -f log/development.log
35
+ - console: bundle exec rails c
36
+ - capistrano:
37
+ - server: ssh user@example.com
@@ -110,7 +110,7 @@ describe Tmuxinator::Cli do
110
110
 
111
111
  context "new project already exists" do
112
112
  before do
113
- $stdin.stub(:gets => "y")
113
+ Thor::LineEditor.stub(:readline => "y")
114
114
  end
115
115
 
116
116
  it "prompts user to confirm overwrite" do
@@ -152,7 +152,7 @@ describe Tmuxinator::Cli do
152
152
  describe "#delete" do
153
153
  before do
154
154
  ARGV.replace(["delete", "foo"])
155
- $stdin.stub(:gets => "y")
155
+ Thor::LineEditor.stub(:readline => "y")
156
156
  end
157
157
 
158
158
  context "project exists" do
@@ -160,10 +160,6 @@ describe Tmuxinator::Cli do
160
160
  Tmuxinator::Config.stub(:exists?) { true }
161
161
  end
162
162
 
163
- it "confirms deletion" do
164
- capture_io { cli.start }
165
- end
166
-
167
163
  it "deletes the project" do
168
164
  expect(FileUtils).to receive(:rm)
169
165
  capture_io { cli.start }
@@ -172,7 +168,7 @@ describe Tmuxinator::Cli do
172
168
 
173
169
  context "project doesn't exist" do
174
170
  before do
175
- $stdin.stub(:gets => "y")
171
+ Thor::LineEditor.stub(:readline => "y")
176
172
  end
177
173
 
178
174
  it "exits with error message" do
@@ -184,11 +180,11 @@ describe Tmuxinator::Cli do
184
180
  describe "#implode" do
185
181
  before do
186
182
  ARGV.replace(["implode"])
187
- $stdin.stub(:gets => "y")
183
+ Thor::LineEditor.stub(:readline => "y")
188
184
  end
189
185
 
190
186
  it "confirms deletion of all projects" do
191
- expect($stdin).to receive(:gets).and_return("y")
187
+ expect(Thor::LineEditor).to receive(:readline).and_return("y")
192
188
  capture_io { cli.start }
193
189
  end
194
190
 
@@ -3,6 +3,7 @@ require "spec_helper"
3
3
  describe Tmuxinator::Project do
4
4
  let(:project) { FactoryGirl.build(:project) }
5
5
  let(:project_with_deprecations) { FactoryGirl.build(:project_with_deprecations) }
6
+ let(:wemux_project) { FactoryGirl.build(:wemux_project) }
6
7
 
7
8
  describe "#initialize" do
8
9
  context "valid yaml" do
@@ -16,6 +17,12 @@ describe Tmuxinator::Project do
16
17
  it "renders the tmux config" do
17
18
  expect(project.render).to_not be_empty
18
19
  end
20
+
21
+ context "wemux" do
22
+ it "renders the wemux config" do
23
+ expect(wemux_project.render).to_not be_empty
24
+ end
25
+ end
19
26
  end
20
27
 
21
28
  describe "#windows" do
@@ -58,6 +65,12 @@ describe Tmuxinator::Project do
58
65
  expect(project_with_deprecations.name).to eq "sample"
59
66
  end
60
67
  end
68
+
69
+ context "wemux" do
70
+ it "is wemux" do
71
+ expect(wemux_project.name).to eq "wemux"
72
+ end
73
+ end
61
74
  end
62
75
 
63
76
  describe "#pre_window" do
data/spec/spec_helper.rb CHANGED
@@ -13,6 +13,7 @@ end
13
13
  require "tmuxinator"
14
14
  require "factory_girl"
15
15
 
16
+
16
17
  FactoryGirl.find_definitions
17
18
 
18
19
  RSpec.configure do |config|
@@ -21,18 +22,21 @@ end
21
22
 
22
23
  # Copied from minitest.
23
24
  def capture_io
24
- require 'stringio'
25
+ begin
26
+ require 'stringio'
27
+
28
+ captured_stdout, captured_stderr = StringIO.new, StringIO.new
25
29
 
26
- orig_stdout, orig_stderr = $stdout, $stderr
27
- captured_stdout, captured_stderr = StringIO.new, StringIO.new
28
- $stdout, $stderr = captured_stdout, captured_stderr
30
+ orig_stdout, orig_stderr = $stdout, $stderr
31
+ $stdout, $stderr = captured_stdout, captured_stderr
29
32
 
30
- yield
33
+ yield
31
34
 
32
- return captured_stdout.string, captured_stderr.string
33
- ensure
34
- $stdout = orig_stdout
35
- $stderr = orig_stderr
35
+ return captured_stdout.string, captured_stderr.string
36
+ ensure
37
+ $stdout = orig_stdout
38
+ $stderr = orig_stderr
39
+ end
36
40
  end
37
41
 
38
42
  def tmux_config(options = {})
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmuxinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allen Bargi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.18.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.18.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: erubis
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
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
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.14.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
68
  version: 2.14.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
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
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: coveralls
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: awesome_print
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry-nav
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: factory_girl
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  description: Create and manage complex tmux sessions easily.
@@ -159,9 +159,9 @@ executables:
159
159
  extensions: []
160
160
  extra_rdoc_files: []
161
161
  files:
162
- - .gitignore
163
- - .rspec
164
- - .travis.yml
162
+ - ".gitignore"
163
+ - ".rspec"
164
+ - ".travis.yml"
165
165
  - CHANGELOG.md
166
166
  - CONTRIBUTING.md
167
167
  - Gemfile
@@ -176,6 +176,7 @@ files:
176
176
  - lib/tmuxinator.rb
177
177
  - lib/tmuxinator/assets/sample.yml
178
178
  - lib/tmuxinator/assets/template.erb
179
+ - lib/tmuxinator/assets/wemux_template.erb
179
180
  - lib/tmuxinator/cli.rb
180
181
  - lib/tmuxinator/config.rb
181
182
  - lib/tmuxinator/deprecations.rb
@@ -183,10 +184,12 @@ files:
183
184
  - lib/tmuxinator/project.rb
184
185
  - lib/tmuxinator/util.rb
185
186
  - lib/tmuxinator/version.rb
187
+ - lib/tmuxinator/wemux_support.rb
186
188
  - lib/tmuxinator/window.rb
187
189
  - spec/factories/projects.rb
188
190
  - spec/fixtures/sample.deprecations.yml
189
191
  - spec/fixtures/sample.yml
192
+ - spec/fixtures/sample_wemux.yml
190
193
  - spec/lib/tmuxinator/cli_spec.rb
191
194
  - spec/lib/tmuxinator/config_spec.rb
192
195
  - spec/lib/tmuxinator/pane_spec.rb
@@ -210,17 +213,17 @@ require_paths:
210
213
  - lib
211
214
  required_ruby_version: !ruby/object:Gem::Requirement
212
215
  requirements:
213
- - - '>='
216
+ - - ">="
214
217
  - !ruby/object:Gem::Version
215
218
  version: '0'
216
219
  required_rubygems_version: !ruby/object:Gem::Requirement
217
220
  requirements:
218
- - - '>='
221
+ - - ">="
219
222
  - !ruby/object:Gem::Version
220
223
  version: 1.8.23
221
224
  requirements: []
222
225
  rubyforge_project:
223
- rubygems_version: 2.2.0
226
+ rubygems_version: 2.2.2
224
227
  signing_key:
225
228
  specification_version: 4
226
229
  summary: Create and manage complex tmux sessions easily.
@@ -228,6 +231,7 @@ test_files:
228
231
  - spec/factories/projects.rb
229
232
  - spec/fixtures/sample.deprecations.yml
230
233
  - spec/fixtures/sample.yml
234
+ - spec/fixtures/sample_wemux.yml
231
235
  - spec/lib/tmuxinator/cli_spec.rb
232
236
  - spec/lib/tmuxinator/config_spec.rb
233
237
  - spec/lib/tmuxinator/pane_spec.rb