remote_ruby 0.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +2 -4
- data/.rubocop.yml +2 -1
- data/Gemfile +2 -1
- data/LICENSE.txt +1 -1
- data/README.md +3 -1
- data/lib/remote_ruby/code_templates/compiler/main.rb.erb +3 -0
- data/lib/remote_ruby/connection_adapter/local_stdin_adapter.rb +8 -3
- data/lib/remote_ruby/connection_adapter/ssh_stdin_adapter.rb +9 -3
- data/lib/remote_ruby/version.rb +1 -1
- data/remote_ruby.gemspec +5 -4
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37bace854f64fcf07a95e1a8168cef708988610894764afdfadc08c8fb46674d
|
4
|
+
data.tar.gz: 0324ae7519ada602236715247b2dd55b228e33019f5d262024fc3acbbe2fa823
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed7df90f0a19153b1cc868b21aded8630eb40eaa6c52925c7ffad99fcac69d58733bec402ea3d4eff9fe5eb511d39281539ed292b56f350ecb02f2c68f9662d
|
7
|
+
data.tar.gz: 9ed44ea3c1abee071e574f1a5fb69979464b47d8dd22ad1c7349f118bf5020e1ee6241ed5b8dbecb6a5e99d9906de051ccef11ff1b767c2d732e2a26702d6002
|
data/.github/workflows/main.yml
CHANGED
@@ -14,7 +14,7 @@ jobs:
|
|
14
14
|
strategy:
|
15
15
|
matrix:
|
16
16
|
os: [ubuntu-latest, macos-latest]
|
17
|
-
ruby: [2.6, 2.7,
|
17
|
+
ruby: [2.6, 2.7, 3.2, head]
|
18
18
|
runs-on: ${{ matrix.os }}
|
19
19
|
steps:
|
20
20
|
- uses: actions/checkout@v2
|
@@ -23,6 +23,4 @@ jobs:
|
|
23
23
|
ruby-version: ${{ matrix.ruby }}
|
24
24
|
bundler-cache: true
|
25
25
|
- run: bundle exec rspec
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
- uses: coverallsapp/github-action@v2
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# remote_ruby
|
2
|
-
![Lint & Test](https://github.com/
|
2
|
+
[![Lint & Test](https://github.com/Nu-hin/remote_ruby/actions/workflows/main.yml/badge.svg)](https://github.com/Nu-hin/remote_ruby/actions/workflows/main.yml)
|
3
3
|
[![Coverage Status](https://coveralls.io/repos/github/Nu-hin/remote_ruby/badge.svg?branch=master)](https://coveralls.io/github/Nu-hin/remote_ruby?branch=master)
|
4
4
|
[![Maintainability](https://api.codeclimate.com/v1/badges/e57430aa6f626aeca41d/maintainability)](https://codeclimate.com/github/Nu-hin/remote_ruby/maintainability)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/remote_ruby.svg)](https://badge.fury.io/rb/remote_ruby)
|
@@ -328,6 +328,7 @@ This adapter uses SSH console client to connect to the remote machine, launches
|
|
328
328
|
| working_dir | String | no | ~ | Path to the directory on the remote server where the script should be executed |
|
329
329
|
| user | String | no | - | User on the remote host to connect as |
|
330
330
|
| key_file| String | no | - | Path to the private SSH key |
|
331
|
+
| bundler | Boolean | no | false | Specifies, whether the code should be executed with `bundle exec` on the remote server |
|
331
332
|
|
332
333
|
|
333
334
|
#### Local STDIN adapter
|
@@ -338,6 +339,7 @@ This adapter changes to the specified directory on the **local** machine, launch
|
|
338
339
|
| Parameter | Type | Required | Default value | Description |
|
339
340
|
| --------- | ---- | ---------| ------------- | ----------- |
|
340
341
|
| working_dir | String | no | . | Path to the directory on the local machine where the script should be executed |
|
342
|
+
| bundler | Boolean | no | false | Specifies, whether the code should be executed with `bundle exec` |
|
341
343
|
|
342
344
|
|
343
345
|
#### Evaluating adapter
|
@@ -4,11 +4,12 @@ module RemoteRuby
|
|
4
4
|
# An adapter to expecute Ruby code on the local macine
|
5
5
|
# inside a specified directory
|
6
6
|
class LocalStdinAdapter < ::RemoteRuby::StdinProcessAdapter
|
7
|
-
attr_reader :working_dir
|
7
|
+
attr_reader :working_dir, :bundler
|
8
8
|
|
9
|
-
def initialize(working_dir: '.')
|
9
|
+
def initialize(working_dir: '.', bundler: false)
|
10
10
|
super
|
11
11
|
@working_dir = working_dir
|
12
|
+
@bundler = bundler
|
12
13
|
end
|
13
14
|
|
14
15
|
def connection_name
|
@@ -18,7 +19,11 @@ module RemoteRuby
|
|
18
19
|
private
|
19
20
|
|
20
21
|
def command
|
21
|
-
|
22
|
+
if bundler
|
23
|
+
"cd \"#{working_dir}\" && bundle exec ruby"
|
24
|
+
else
|
25
|
+
"cd \"#{working_dir}\" && ruby"
|
26
|
+
end
|
22
27
|
end
|
23
28
|
end
|
24
29
|
end
|
@@ -3,14 +3,15 @@
|
|
3
3
|
module RemoteRuby
|
4
4
|
# An adapter to execute Ruby code on the remote server via SSH
|
5
5
|
class SSHStdinAdapter < StdinProcessAdapter
|
6
|
-
attr_reader :server, :working_dir, :user, :key_file
|
6
|
+
attr_reader :server, :working_dir, :user, :key_file, :bundler
|
7
7
|
|
8
|
-
def initialize(server:, working_dir: '~', user: nil, key_file: nil)
|
8
|
+
def initialize(server:, working_dir: '~', user: nil, key_file: nil, bundler: false)
|
9
9
|
super
|
10
10
|
@working_dir = working_dir
|
11
11
|
@server = user.nil? ? server : "#{user}@#{server}"
|
12
12
|
@user = user
|
13
13
|
@key_file = key_file
|
14
|
+
@bundler = bundler
|
14
15
|
end
|
15
16
|
|
16
17
|
def connection_name
|
@@ -22,7 +23,12 @@ module RemoteRuby
|
|
22
23
|
def command
|
23
24
|
command = 'ssh'
|
24
25
|
command = "#{command} -i #{key_file}" if key_file
|
25
|
-
|
26
|
+
|
27
|
+
if bundler
|
28
|
+
"#{command} #{server} \"cd #{working_dir} && bundle exec ruby\""
|
29
|
+
else
|
30
|
+
"#{command} #{server} \"cd #{working_dir} && ruby\""
|
31
|
+
end
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
data/lib/remote_ruby/version.rb
CHANGED
data/remote_ruby.gemspec
CHANGED
@@ -28,8 +28,9 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.require_paths = ['lib']
|
30
30
|
|
31
|
-
spec.
|
32
|
-
spec.
|
33
|
-
spec.
|
34
|
-
spec.
|
31
|
+
spec.add_dependency 'base64', '~> 0.2'
|
32
|
+
spec.add_dependency 'colorize', '~> 0.8'
|
33
|
+
spec.add_dependency 'method_source', '~> 1.0'
|
34
|
+
spec.add_dependency 'parser', '~> 3.0'
|
35
|
+
spec.add_dependency 'unparser', '~> 0.6'
|
35
36
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remote_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikita Chernukhin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: base64
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.2'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: colorize
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
134
|
- !ruby/object:Gem::Version
|
121
135
|
version: '0'
|
122
136
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
137
|
+
rubygems_version: 3.5.16
|
124
138
|
signing_key:
|
125
139
|
specification_version: 4
|
126
140
|
summary: Execute Ruby code on the remote servers.
|