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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38bc3490243e16ad199e9d54e7f471d8e4f51e17bef81878eff61cb7aa241c7c
4
- data.tar.gz: '019d7c918361afaf1f59a9f8c3c95d1142e3b109a9a2fffb5bda6c9f01fc93d7'
3
+ metadata.gz: 3d5b31b42bc32df5888f8117652ffb17959857444a0a383bc79b88033c4665a1
4
+ data.tar.gz: dac8310f6779594279221d38990c0e2c9a89b22756691f78284644a94b5f6634
5
5
  SHA512:
6
- metadata.gz: 399aa31db6f9334f59c9ae5043b77aed312dff7885dd3468779576c800a99612c65c58525e65675b0041a06089988085771a5cd10db51586bbf00f2964444455
7
- data.tar.gz: 66fc2dfdd32f49c29a6a625bb46e0b9d509c6216f4e24e173bff875fd2fb8db30950d852246d6f9dad958648cc367918023a88848bb36b81751c27553514bf11
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.0.gem into the pkg directory" fullCommand="build" id="build" />
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 if junction-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="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.0.gem into system gems" fullCommand="install" id="install" />
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.0.gem into system gems without network access" fullCommand="install:local" id="local" />
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.0 and build and push junction-0.1.0.gem to TODO: Set to your gem server 'https://example.com'" fullCommand="release[remote]" id="release[remote]" />
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
@@ -1,9 +1,9 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.6
2
+ TargetRubyVersion: 3.2
3
3
 
4
4
  Style/StringLiterals:
5
5
  Enabled: true
6
- EnforcedStyle: double_quotes
6
+ EnforcedStyle: single_quotes
7
7
 
8
8
  Style/StringLiteralsInInterpolation:
9
9
  Enabled: true
data/Gemfile CHANGED
@@ -1,12 +1,12 @@
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 junction.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
8
+ gem 'rake', '~> 13.0'
9
9
 
10
- gem "rspec", "~> 3.0"
10
+ gem 'rspec', '~> 3.0'
11
11
 
12
- gem "rubocop", "~> 1.21"
12
+ gem 'rubocop', '~> 1.21'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- junction (0.1.0)
4
+ junction (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -60,4 +60,4 @@ DEPENDENCIES
60
60
  rubocop (~> 1.21)
61
61
 
62
62
  BUNDLED WITH
63
- 2.4.10
63
+ 2.5.23
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 "lib/junction/version"
3
+ require_relative 'lib/junction/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "junction"
6
+ spec.name = 'junction'
7
7
  spec.version = Junction::VERSION
8
- spec.authors = ["keegankb93"]
9
- spec.email = ["keegankb@gmail.com"]
8
+ spec.authors = ['keegankb93']
9
+ spec.email = ['keegankb@gmail.com']
10
+ spec.executables = ['junction']
10
11
 
11
- spec.summary = "Placeholder"
12
- spec.description = "Placeholder"
13
- spec.homepage = "https://github.com/keegankb93/junction"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
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["allowed_push_host"] = "https://rubygems.org"
18
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
19
 
19
- spec.metadata["homepage_uri"] = spec.homepage
20
- spec.metadata["source_code_uri"] = "https://github.com/keegankb93/junction"
21
- spec.metadata["changelog_uri"] = "https://github.com/keegankb93/junction"
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 = "exe"
31
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
- spec.require_paths = ["lib"]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Junction
4
- VERSION = "0.1.0"
4
+ VERSION = '0.1.2'
5
5
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :junction do
4
+ desc 'Run junction'
5
+ task :start do
6
+ exec 'junction'
7
+ end
8
+ end
data/sig/session.rbs ADDED
@@ -0,0 +1,7 @@
1
+ module Junction
2
+ class Session
3
+ @command: string
4
+ @name: string
5
+
6
+ end
7
+ end
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.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - keegankb93
8
8
  autorequire:
9
- bindir: exe
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.6.0
59
+ version: 3.2.0
54
60
  required_rubygems_version: !ruby/object:Gem::Requirement
55
61
  requirements:
56
62
  - - ">="