junction 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/junction.iml +6 -5
- data/.rubocop.yml +2 -2
- data/Gemfile +4 -4
- data/Gemfile.lock +2 -2
- data/bin/junction +46 -0
- data/junction.gemspec +17 -16
- data/lib/junction/pane_manager.rb +29 -0
- data/lib/junction/session.rb +31 -0
- data/lib/junction/version.rb +1 -1
- data/lib/tasks/junction.rake +8 -0
- data/sig/session.rbs +7 -0
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d5b31b42bc32df5888f8117652ffb17959857444a0a383bc79b88033c4665a1
|
4
|
+
data.tar.gz: dac8310f6779594279221d38990c0e2c9a89b22756691f78284644a94b5f6634
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2648c113a59c0cf517da4c5c1138d3f381672f0d719ba181353981adc31e45c6322d9073999ea7c0170695e2a2357e67f5c4919c34856eccfb5ed5923cb30c9
|
7
|
+
data.tar.gz: 3fe323c0736398f2ed3c3d83365c1e66641a7b9481fb40918091aff79a97f5aae765d0cd0a5589bde6df2785fff0eee681bd46d5f74edfece662bdcdcaca9900
|
data/.idea/junction.iml
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
<orderEntry type="jdk" jdkName="rbenv: 3.2.2" jdkType="RUBY_SDK" />
|
13
13
|
<orderEntry type="sourceFolder" forTests="false" />
|
14
14
|
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, rbenv: 3.2.2) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.5.23, rbenv: 3.2.2) [gem]" level="application" />
|
15
16
|
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.1, rbenv: 3.2.2) [gem]" level="application" />
|
16
17
|
<orderEntry type="library" scope="PROVIDED" name="json (v2.7.2, rbenv: 3.2.2) [gem]" level="application" />
|
17
18
|
<orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.3, rbenv: 3.2.2) [gem]" level="application" />
|
@@ -37,21 +38,21 @@
|
|
37
38
|
<option name="myRootTask">
|
38
39
|
<RakeTaskImpl id="rake">
|
39
40
|
<subtasks>
|
40
|
-
<RakeTaskImpl description="Build junction-0.1.
|
41
|
+
<RakeTaskImpl description="Build junction-0.1.1.gem into the pkg directory" fullCommand="build" id="build" />
|
41
42
|
<RakeTaskImpl id="build">
|
42
43
|
<subtasks>
|
43
|
-
<RakeTaskImpl description="Generate SHA512 checksum
|
44
|
+
<RakeTaskImpl description="Generate SHA512 checksum of junction-0.1.1.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
44
45
|
</subtasks>
|
45
46
|
</RakeTaskImpl>
|
46
47
|
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
47
48
|
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
48
|
-
<RakeTaskImpl description="Build and install junction-0.1.
|
49
|
+
<RakeTaskImpl description="Build and install junction-0.1.1.gem into system gems" fullCommand="install" id="install" />
|
49
50
|
<RakeTaskImpl id="install">
|
50
51
|
<subtasks>
|
51
|
-
<RakeTaskImpl description="Build and install junction-0.1.
|
52
|
+
<RakeTaskImpl description="Build and install junction-0.1.1.gem into system gems without network access" fullCommand="install:local" id="local" />
|
52
53
|
</subtasks>
|
53
54
|
</RakeTaskImpl>
|
54
|
-
<RakeTaskImpl description="Create tag v0.1.
|
55
|
+
<RakeTaskImpl description="Create tag v0.1.1 and build and push junction-0.1.1.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
55
56
|
<RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
|
56
57
|
<RakeTaskImpl id="rubocop">
|
57
58
|
<subtasks>
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in junction.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem
|
8
|
+
gem 'rake', '~> 13.0'
|
9
9
|
|
10
|
-
gem
|
10
|
+
gem 'rspec', '~> 3.0'
|
11
11
|
|
12
|
-
gem
|
12
|
+
gem 'rubocop', '~> 1.21'
|
data/Gemfile.lock
CHANGED
data/bin/junction
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'junction'
|
5
|
+
|
6
|
+
# CLI Implementation
|
7
|
+
manager = Junction::PaneManager.new
|
8
|
+
|
9
|
+
puts 'Welcome to RailsTmux for Rails!'
|
10
|
+
loop do
|
11
|
+
puts "\n1. Create Pane\n2. List Panes\n3. Write to Pane\n4. Read from Pane\n5. Close Pane\n6. Exit"
|
12
|
+
print 'Select an option: '
|
13
|
+
choice = gets.chomp.to_i
|
14
|
+
|
15
|
+
case choice
|
16
|
+
when 1
|
17
|
+
print 'Enter pane name: '
|
18
|
+
name = gets.chomp
|
19
|
+
print 'Enter command (or press Enter for default bash): '
|
20
|
+
command = gets.chomp
|
21
|
+
manager.create_pane(name, command.empty? ? 'bash' : command)
|
22
|
+
puts "Pane #{name} created."
|
23
|
+
when 2
|
24
|
+
puts "Panes: #{manager.list_panes.join(", ")}"
|
25
|
+
when 3
|
26
|
+
print 'Enter pane name: '
|
27
|
+
name = gets.chomp
|
28
|
+
print 'Enter input: '
|
29
|
+
input = gets.chomp
|
30
|
+
manager.write_to_pane(name, input)
|
31
|
+
when 4
|
32
|
+
print 'Enter pane name: '
|
33
|
+
name = gets.chomp
|
34
|
+
puts "Output: #{manager.read_from_pane(name)}"
|
35
|
+
when 5
|
36
|
+
print 'Enter pane name: '
|
37
|
+
name = gets.chomp
|
38
|
+
manager.close_pane(name)
|
39
|
+
puts "Pane #{name} closed."
|
40
|
+
when 6
|
41
|
+
puts 'Exiting...'
|
42
|
+
break
|
43
|
+
else
|
44
|
+
puts 'Invalid option.'
|
45
|
+
end
|
46
|
+
end
|
data/junction.gemspec
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative 'lib/junction/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = 'junction'
|
7
7
|
spec.version = Junction::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
8
|
+
spec.authors = ['keegankb93']
|
9
|
+
spec.email = ['keegankb@gmail.com']
|
10
|
+
spec.executables = ['junction']
|
10
11
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
15
|
-
spec.required_ruby_version =
|
12
|
+
spec.summary = 'Placeholder'
|
13
|
+
spec.description = 'Placeholder'
|
14
|
+
spec.homepage = 'https://github.com/keegankb93/junction'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
spec.required_ruby_version = '>= 3.2.0'
|
16
17
|
|
17
|
-
spec.metadata[
|
18
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
19
|
|
19
|
-
spec.metadata[
|
20
|
-
spec.metadata[
|
21
|
-
spec.metadata[
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = 'https://github.com/keegankb93/junction'
|
22
|
+
spec.metadata['changelog_uri'] = 'https://github.com/keegankb93/junction'
|
22
23
|
|
23
24
|
# Specify which files should be added to the gem when it is released.
|
24
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -27,9 +28,9 @@ Gem::Specification.new do |spec|
|
|
27
28
|
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
|
28
29
|
end
|
29
30
|
end
|
30
|
-
spec.bindir =
|
31
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = [
|
31
|
+
#spec.bindir = 'exe'
|
32
|
+
#spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ['lib']
|
33
34
|
|
34
35
|
# Uncomment to register a new dependency of your gem
|
35
36
|
# spec.add_dependency "example-gem", "~> 1.0"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# lib/rails_tmux/pane_manager.rb
|
2
|
+
module Junction
|
3
|
+
class PaneManager
|
4
|
+
def initialize
|
5
|
+
@panes = {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_pane(name, command = "bash")
|
9
|
+
@panes[name] = Session.new(name, command)
|
10
|
+
end
|
11
|
+
|
12
|
+
def list_panes
|
13
|
+
@panes.keys
|
14
|
+
end
|
15
|
+
|
16
|
+
def write_to_pane(name, input)
|
17
|
+
@panes[name]&.write(input)
|
18
|
+
end
|
19
|
+
|
20
|
+
def read_from_pane(name)
|
21
|
+
@panes[name]&.read
|
22
|
+
end
|
23
|
+
|
24
|
+
def close_pane(name)
|
25
|
+
@panes[name]&.close
|
26
|
+
@panes.delete(name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pty'
|
4
|
+
|
5
|
+
module Junction
|
6
|
+
class Session
|
7
|
+
attr_reader :name, :pid, :output
|
8
|
+
|
9
|
+
def initialize(name, command = 'bash')
|
10
|
+
@name = name
|
11
|
+
@command = command
|
12
|
+
@output, @input, @pid = PTY.spawn(command)
|
13
|
+
end
|
14
|
+
|
15
|
+
def write(input)
|
16
|
+
@input.puts(input)
|
17
|
+
end
|
18
|
+
|
19
|
+
def read
|
20
|
+
@output.read_nonblock(1024)
|
21
|
+
rescue IO::WaitReadable
|
22
|
+
''
|
23
|
+
end
|
24
|
+
|
25
|
+
def close
|
26
|
+
Process.kill('KILL', @pid)
|
27
|
+
rescue Errno::ESRCH
|
28
|
+
# Process already exited
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/junction/version.rb
CHANGED
data/sig/session.rbs
ADDED
metadata
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: junction
|
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
|
- keegankb93
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Placeholder
|
14
14
|
email:
|
15
15
|
- keegankb@gmail.com
|
16
|
-
executables:
|
16
|
+
executables:
|
17
|
+
- junction
|
17
18
|
extensions: []
|
18
19
|
extra_rdoc_files: []
|
19
20
|
files:
|
@@ -30,10 +31,15 @@ files:
|
|
30
31
|
- LICENSE.txt
|
31
32
|
- README.md
|
32
33
|
- Rakefile
|
34
|
+
- bin/junction
|
33
35
|
- junction.gemspec
|
34
36
|
- lib/junction.rb
|
37
|
+
- lib/junction/pane_manager.rb
|
38
|
+
- lib/junction/session.rb
|
35
39
|
- lib/junction/version.rb
|
40
|
+
- lib/tasks/junction.rake
|
36
41
|
- sig/junction.rbs
|
42
|
+
- sig/session.rbs
|
37
43
|
homepage: https://github.com/keegankb93/junction
|
38
44
|
licenses:
|
39
45
|
- MIT
|
@@ -50,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
56
|
requirements:
|
51
57
|
- - ">="
|
52
58
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.
|
59
|
+
version: 3.2.0
|
54
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
61
|
requirements:
|
56
62
|
- - ">="
|