junction 0.1.5 → 0.1.7

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
2
  SHA256:
3
- metadata.gz: d748323010afcccefd3808b3cf754542ca766638b48d4ade2210f11366f3442b
4
- data.tar.gz: b0df4805d0ee5dffd3509b7a2eac0004eabcc3dcb8067f25445c74a46bf6b0d9
3
+ metadata.gz: 13d8ee6b5809768320ba9f2139be11d09c13ffd32534b9dedcab251ac4c59bf9
4
+ data.tar.gz: ce2dfeaa01d58d081d49d807c91a1beaf5c11410662aaeef82da39208dd266ea
5
5
  SHA512:
6
- metadata.gz: 9c9860c72a22663852ad31913c5cc70213e63e9015eea852efcf3999f103820dcd3d067bda549e01e45c4c3b395816feaa22786f08a55c34e528d755dcab0fd0
7
- data.tar.gz: b90d7cb2085a7db0b26bb83b4b6263254f0bafcdeb0f8866ab089f5b6f6f6b0eb737431f50f403b61cfc2efeefcdfca7ec4e4b3ebf485c1bae382736fdb9f68e
6
+ metadata.gz: 2fa03e19b187c6b88cd4df306abd5628ab2cd3a093417bbf2ca40ada52ceefb58bb0d1ec364c741e50a31b45240ff7b26e46c6bedc6e79fe6ddecb4c5d1d7068
7
+ data.tar.gz: 240c9f759fd8bb45d740f7b48be334c01d2f9d725bd513814a4fca88fc59916e61283b73261e37448b448414a35ace70ac52225e2c6211964fda3a708a1e6bb9
data/.idea/junction.iml CHANGED
@@ -11,29 +11,10 @@
11
11
  </content>
12
12
  <orderEntry type="jdk" jdkName="rbenv: 3.2.2" jdkType="RUBY_SDK" />
13
13
  <orderEntry type="sourceFolder" forTests="false" />
14
- <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, rbenv: 3.2.2) [gem]" level="application" />
15
14
  <orderEntry type="library" scope="PROVIDED" name="bundler (v2.5.23, rbenv: 3.2.2) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.1, rbenv: 3.2.2) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="json (v2.7.2, rbenv: 3.2.2) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.3, rbenv: 3.2.2) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="parallel (v1.26.3, rbenv: 3.2.2) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="parser (v3.3.4.2, rbenv: 3.2.2) [gem]" level="application" />
21
15
  <orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, rbenv: 3.2.2) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 3.2.2) [gem]" level="application" />
23
16
  <orderEntry type="library" scope="PROVIDED" name="rake (v13.2.1, rbenv: 3.2.2) [gem]" level="application" />
24
17
  <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.9.2, rbenv: 3.2.2) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="rexml (v3.3.6, rbenv: 3.2.2) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.13.0, rbenv: 3.2.2) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.13.0, rbenv: 3.2.2) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.13.2, rbenv: 3.2.2) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.13.1, rbenv: 3.2.2) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.13.1, rbenv: 3.2.2) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.65.1, rbenv: 3.2.2) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.32.1, rbenv: 3.2.2) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, rbenv: 3.2.2) [gem]" level="application" />
34
- <orderEntry type="library" scope="PROVIDED" name="stringio (v3.1.2, rbenv: 3.2.2) [gem]" level="application" />
35
- <orderEntry type="library" scope="PROVIDED" name="strscan (v3.1.0, rbenv: 3.2.2) [gem]" level="application" />
36
- <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.5.0, rbenv: 3.2.2) [gem]" level="application" />
37
18
  </component>
38
19
  <component name="RakeTasksCache-v2">
39
20
  <option name="myRootTask">
data/Gemfile CHANGED
@@ -10,3 +10,5 @@ gem 'rake', '~> 13.0'
10
10
  gem 'rspec', '~> 3.0'
11
11
 
12
12
  gem 'rubocop', '~> 1.21'
13
+
14
+ gem "tty", "~> 0.5.0"
data/Gemfile.lock CHANGED
@@ -1,20 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- junction (0.1.5)
5
- stringio (>= 3.0.0)
4
+ junction (0.1.6)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
9
  ast (2.4.2)
11
10
  diff-lcs (1.5.1)
11
+ equatable (0.5.0)
12
12
  json (2.7.2)
13
13
  language_server-protocol (3.17.0.3)
14
+ necromancer (0.3.0)
14
15
  parallel (1.26.3)
15
16
  parser (3.3.4.2)
16
17
  ast (~> 2.4.1)
17
18
  racc
19
+ pastel (0.6.1)
20
+ equatable (~> 0.5.0)
21
+ tty-color (~> 0.3.0)
18
22
  racc (1.8.1)
19
23
  rainbow (3.1.1)
20
24
  rake (13.2.1)
@@ -48,9 +52,53 @@ GEM
48
52
  rubocop-ast (1.32.1)
49
53
  parser (>= 3.3.1.0)
50
54
  ruby-progressbar (1.13.0)
51
- stringio (3.1.2)
52
55
  strscan (3.1.0)
56
+ tty (0.5.0)
57
+ equatable (~> 0.5.0)
58
+ pastel (~> 0.6.0)
59
+ tty-color (~> 0.3.0)
60
+ tty-command (~> 0.1.0)
61
+ tty-cursor (~> 0.3.0)
62
+ tty-pager (~> 0.4.0)
63
+ tty-platform (~> 0.1.0)
64
+ tty-progressbar (~> 0.9.0)
65
+ tty-prompt (~> 0.6.0)
66
+ tty-screen (~> 0.5.0)
67
+ tty-spinner (~> 0.2.0)
68
+ tty-table (~> 0.5.0)
69
+ tty-which (~> 0.1.0)
70
+ tty-color (0.3.0)
71
+ tty-command (0.1.0)
72
+ pastel (~> 0.6.0)
73
+ tty-cursor (0.3.0)
74
+ tty-pager (0.4.0)
75
+ tty-screen (~> 0.5.0)
76
+ tty-which (~> 0.1.0)
77
+ verse (~> 0.4.0)
78
+ tty-platform (0.1.0)
79
+ tty-progressbar (0.9.0)
80
+ tty-screen (~> 0.5.0)
81
+ tty-prompt (0.6.0)
82
+ necromancer (~> 0.3.0)
83
+ pastel (~> 0.6.0)
84
+ tty-cursor (~> 0.3.0)
85
+ tty-platform (~> 0.1.0)
86
+ wisper (~> 1.6.1)
87
+ tty-screen (0.5.1)
88
+ tty-spinner (0.2.0)
89
+ tty-table (0.5.0)
90
+ equatable (~> 0.5.0)
91
+ necromancer (~> 0.3.0)
92
+ pastel (~> 0.6.0)
93
+ tty-screen (~> 0.5.0)
94
+ unicode_utils (~> 1.4.0)
95
+ verse (~> 0.4.0)
96
+ tty-which (0.1.0)
53
97
  unicode-display_width (2.5.0)
98
+ unicode_utils (1.4.0)
99
+ verse (0.4.0)
100
+ unicode_utils (~> 1.4.0)
101
+ wisper (1.6.1)
54
102
 
55
103
  PLATFORMS
56
104
  arm64-darwin-23
@@ -60,6 +108,7 @@ DEPENDENCIES
60
108
  rake (~> 13.0)
61
109
  rspec (~> 3.0)
62
110
  rubocop (~> 1.21)
111
+ tty (~> 0.5.0)
63
112
 
64
113
  BUNDLED WITH
65
114
  2.5.23
data/bin/junction:start CHANGED
@@ -3,44 +3,4 @@
3
3
 
4
4
  require 'junction'
5
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
6
+ Junction::ScreenManager.new.start
data/junction.gemspec CHANGED
@@ -34,7 +34,8 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  # Uncomment to register a new dependency of your gem
36
36
  # spec.add_dependency "example-gem", "~> 1.0"
37
- spec.add_dependency 'stringio', '>= 3.0.0'
37
+ # spec.add_dependency 'stringio', '>= 3.0.0'
38
+ spec.add_dependency 'tty', '~> 0.5.0'
38
39
  # For more information and examples about making a new gem, check out our
39
40
  # guide at: https://bundler.io/guides/creating_gem.html
40
41
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tty-cursor'
4
+
5
+ module Junction
6
+ module Components
7
+ class Cursor; end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Junction
4
+ class ScreenManager
5
+ def initialize
6
+ @screen = Junction::Screens::Main.new
7
+ end
8
+
9
+ def start
10
+ loop do
11
+ @screen.render
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tty-screen'
4
+
5
+ module Junction
6
+ module Screens
7
+ class Main
8
+ def render
9
+ puts 'Welcome to Junction!'
10
+ puts "Screen size: #{TTY::Screen.width}x#{TTY::Screen.height}"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Junction
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.7'
5
5
  end
data/lib/junction.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'junction/version'
4
- require_relative 'junction/pane_manager'
5
- require_relative 'junction/session'
4
+ require_relative 'junction/screen_manager'
5
+ require_relative 'junction/components/cursor'
6
+ require_relative 'junction/screens/main'
6
7
 
7
8
  module Junction
8
9
  class Error < StandardError; end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: junction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - keegankb93
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-19 00:00:00.000000000 Z
11
+ date: 2024-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: stringio
14
+ name: tty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
19
+ version: 0.5.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
- version: 3.0.0
26
+ version: 0.5.0
27
27
  description: Placeholder
28
28
  email:
29
29
  - keegankb@gmail.com
@@ -48,8 +48,9 @@ files:
48
48
  - bin/junction:start
49
49
  - junction.gemspec
50
50
  - lib/junction.rb
51
- - lib/junction/pane_manager.rb
52
- - lib/junction/session.rb
51
+ - lib/junction/components/cursor.rb
52
+ - lib/junction/screen_manager.rb
53
+ - lib/junction/screens/main.rb
53
54
  - lib/junction/version.rb
54
55
  - lib/tasks/junction.rake
55
56
  - sig/junction.rbs
@@ -1,29 +0,0 @@
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
@@ -1,31 +0,0 @@
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