sesh 0.4.1 → 0.4.2

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: 4929cebd5f39bea69099a5f370be728e11b857ec
4
- data.tar.gz: 729f4674d93f0ed4696363df5fdad0ccd8cb2d9e
3
+ metadata.gz: 606d7765a67aab4f949da18b6892991d91c64340
4
+ data.tar.gz: 6a3bdfce44d732a03276dbc76026795dc5611465
5
5
  SHA512:
6
- metadata.gz: a92d024cf5ca5a118c39da928ccbcfa2ab8d9dc3ce6d038c0825c8ba5e939ce0d4dd963c35fac9b81780d66fb20cd2bc55422c9f3e1e18035f011d5a6f3383a3
7
- data.tar.gz: ff7be128d9111086872cb9751d9b328a5c83516575f2256c3434f8851a93800bcdd47eb173465e57aa786a3f96cec31a62d3e9aef5151ff3a06002181026e566
6
+ metadata.gz: d9b2a52b1404207b5888ec94183bc35161a630136590a99eb061b58b01c6012756e15a3279fd752dac83daab2f72d8d696e5e7dfe94ffa0c6e2504580a77b1bc
7
+ data.tar.gz: 81fe0e9c936be0d1195d20a0c592f409e5d125d0a16f68d7116531d935644310514f3c17ae24940b707130f714ca9b01b5e5cdab39ea756ea2a495c1420c979c
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sesh (0.4.0)
4
+ sesh (0.4.2)
5
5
  awesome_print (~> 1.6)
6
6
  colorize (~> 0.7.7)
7
7
  deep_merge (~> 1.0)
8
+ open4 (~> 1.3.4)
8
9
  tmuxinator (~> 0.6.9)
9
10
 
10
11
  GEM
@@ -15,6 +16,7 @@ GEM
15
16
  deep_merge (1.0.1)
16
17
  diff-lcs (1.2.5)
17
18
  erubis (2.7.0)
19
+ open4 (1.3.4)
18
20
  rake (10.4.2)
19
21
  rspec (3.3.0)
20
22
  rspec-core (~> 3.3.0)
data/exe/return_to_sesh CHANGED
File without changes
@@ -1,4 +1,5 @@
1
1
  require 'sesh'
2
+ require 'open4'
2
3
  # require 'tmuxinator'
3
4
  # require 'yaml'
4
5
 
@@ -190,17 +191,33 @@ module Sesh
190
191
  # puts "Inferred location: #{inferred_location}"
191
192
  if options[:pane].nil?
192
193
  # puts inferred_location.inspect
193
- if inferred_location[:project] == @project then system options[:command]
194
- else interrupt_and_send_command_to_project! options[:command] end
194
+ if inferred_location[:project] != @project
195
+ interrupt_and_send_command_to_project! options[:command]
196
+ return 0
197
+ else do_shell_operation_here! options[:command] end
195
198
  else
196
- if inferred_location == { project: @project, pane: options[:pane] }
197
- system options[:command]
198
- return $?.exitstatus
199
- else
199
+ if inferred_location != { project: @project, pane: options[:pane] }
200
200
  interrupt_and_send_command_to_pane! options[:pane], options[:command]
201
201
  return 0
202
- end
202
+ else do_shell_operation_here! options[:command] end
203
+ end
204
+ end
205
+ def do_shell_operation_here!(cmd)
206
+ # system cmd
207
+ # STDOUT.sync = true
208
+ # stdin, stdout, stderr, wait_thr = Open3.popen3(*cmd.split(' '))
209
+ # stdin.close
210
+ # stdout.close
211
+ output = ''
212
+ status = Open4::popen4(cmd) do |pid, stdin, stdout, stderr|
213
+ stdin.close
214
+ puts o = stdout.read.strip; output << o
215
+ puts o = stderr.read.strip; output << o
203
216
  end
217
+ puts "Full output: #{output}"
218
+ puts "Status: #{status.inspect}"
219
+ status.exitstatus
220
+ # $?.exitstatus
204
221
  end
205
222
 
206
223
  # Getter methods for passthru to SshControl class
data/lib/sesh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sesh
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
data/sesh.gemspec CHANGED
@@ -29,4 +29,5 @@ Gem::Specification.new do |s|
29
29
  s.add_dependency 'deep_merge', '~> 1.0'
30
30
  s.add_dependency 'awesome_print', '~> 1.6'
31
31
  s.add_dependency 'colorize', '~> 0.7.7'
32
+ s.add_dependency 'open4', '~> 1.3.4'
32
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sesh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.7.7
111
+ - !ruby/object:Gem::Dependency
112
+ name: open4
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.3.4
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.3.4
111
125
  description: Remote background sessions powered by tmux and tmuxinator.
112
126
  email: smithmackinley@gmail.com
113
127
  executables: