remote_sh 0.1.8 → 0.1.10

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: 67423d9a51157d17c0945130089f3a92504d3c3748fc9fcff1342fec5fe1c84e
4
- data.tar.gz: 65e267157add7333bc4cbb95404f0e68c2b0a423252223b315a292de7b1ce3a8
3
+ metadata.gz: 9e4d1cb4a5179f135f61ee072fb0220a1833e85e2fba88fc3fa8ccfd92eaafdf
4
+ data.tar.gz: 0103524a0b49c680326dfde32bacb05c6ae625f956be1cc289cfc1f438f6e564
5
5
  SHA512:
6
- metadata.gz: 4893611c20ccd6f49f65b97cdd6a68e02d20b2818df22e4b2204076d545061eb42feab92fb3536023adf5ef76576923cd3f0fec48a1e0772ae458e385f103523
7
- data.tar.gz: 3145547a5e731b1dd2d03128be41eadf9123c24622e4ff4020c9b8ffc8ae6898917129652ef569252c733f806fed3b27e692dd52b98ecb87f7469df15fc740ae
6
+ metadata.gz: 639fed61dff4fe7a7c28e5ebeb9c845a917fc0e65972cd72a9c071106e849ebbc0f0c730d73e29ec77434aafdef4bca02631a2446a10063e475f02436f9b812c
7
+ data.tar.gz: 42a7ab6970597508026d68bb854f8e79670acabb4b4a97414e281129c87fb1c3e5c028e83b1357e331d86f9d3ae927fe0b5ba71fedbe9dfb0f70931050aa18a9
data/lib/remote_sh/cli.rb CHANGED
@@ -57,15 +57,45 @@ module RemoteSh
57
57
 
58
58
  desc "exec", "executes given command within remote context"
59
59
  def exec(*argv)
60
+ hostname = WorkspaceConfiguration.host_config["name"]
61
+
62
+ FileUtils.mkdir_p("#{PID_FOLDER}/#{hostname}")
63
+
64
+ local_path = WorkspaceConfiguration::WOKRING_DIR
65
+ pid_filename = "#{PID_FOLDER}/#{hostname}/#{local_path.gsub("/", "__")}"
66
+
67
+ unless File.exist?(pid_filename)
68
+ File.open(pid_filename, "w") do |f|
69
+ @owns_sync = true
70
+ f.write("busy")
71
+ end
72
+ end
73
+
60
74
  host = WorkspaceConfiguration.host_config["host"]
61
75
  host_path = WorkspaceConfiguration.config["host_path"]
76
+
77
+ if @owns_sync
78
+ FileSyncer.start(host, host_path, WorkspaceConfiguration.config["ignore"] || [])
79
+ PortForwarder.start_or_skip(WorkspaceConfiguration.host_config)
80
+ end
81
+
62
82
  SshHelper.exec(host, host_path, argv)
83
+ ensure
84
+ File.delete(pid_filename) if @owns_sync
63
85
  end
64
- map 'e' => :exec
65
86
 
66
87
  desc "init", "inits"
67
88
  def init
68
89
  WorkspaceConfiguration.init!
69
90
  end
91
+
92
+ desc "port_forward", "ssh and port_forward"
93
+ def port_forward
94
+ host = WorkspaceConfiguration.host_config["host"]
95
+ host_path = WorkspaceConfiguration.config["host_path"]
96
+ PortForwarder.start_or_skip(WorkspaceConfiguration.host_config)
97
+ SshHelper.attach(host, host_path)
98
+ end
99
+ map 'pf' => :port_forward
70
100
  end
71
101
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RemoteSh
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.10"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_sh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Egorov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-11 00:00:00.000000000 Z
11
+ date: 2025-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filewatcher