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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cedd66138541336a6fbb5518c94c1b8bae4baa005f8326bb08958c5e87f669e
4
- data.tar.gz: d93ac29bf86d2cb44c94fb6c9dcea8cfb82fa5d7a24bcfa2d831077a8b26f6f9
3
+ metadata.gz: 37bace854f64fcf07a95e1a8168cef708988610894764afdfadc08c8fb46674d
4
+ data.tar.gz: 0324ae7519ada602236715247b2dd55b228e33019f5d262024fc3acbbe2fa823
5
5
  SHA512:
6
- metadata.gz: d7ad4224cfcb7e1659c72b4022be4f2b50b08be8e2e7339bef855a46c04d9b5a40fd9ff929a2576c4bea69026b51e375ede8155a8816fd96f30e0fa9bcf0cd5f
7
- data.tar.gz: 99177a9d0e62197a65f986be84154f26bb7be6b32a9538af515614ffe3f1575770ad7b836cd0fdd0b19f9c3e6383e34fe4b53c10c4adc0c4ca073d405ec74db9
6
+ metadata.gz: 1ed7df90f0a19153b1cc868b21aded8630eb40eaa6c52925c7ffad99fcac69d58733bec402ea3d4eff9fe5eb511d39281539ed292b56f350ecb02f2c68f9662d
7
+ data.tar.gz: 9ed44ea3c1abee071e574f1a5fb69979464b47d8dd22ad1c7349f118bf5020e1ee6241ed5b8dbecb6a5e99d9906de051ccef11ff1b767c2d732e2a26702d6002
@@ -14,7 +14,7 @@ jobs:
14
14
  strategy:
15
15
  matrix:
16
16
  os: [ubuntu-latest, macos-latest]
17
- ruby: [2.6, 2.7, '3.0', head]
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
@@ -1,8 +1,9 @@
1
1
  AllCops:
2
2
  NewCops: enable
3
+ TargetRubyVersion: 2.6
3
4
 
4
5
  Metrics/BlockLength:
5
- IgnoredMethods: ['describe', 'context', 'shared_context']
6
+ AllowedMethods: ['describe', 'context', 'shared_context']
6
7
 
7
8
  Style/GlobalStdStream:
8
9
  Exclude:
data/Gemfile CHANGED
@@ -18,5 +18,6 @@ group :development, :test do
18
18
  end
19
19
 
20
20
  group :test do
21
- gem 'coveralls', '~> 0.8', require: false
21
+ gem 'simplecov', '~> 0.22'
22
+ gem 'simplecov-lcov', '~> 0.8'
22
23
  end
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Nikita Chernukhin
3
+ Copyright (c) 2024 Nikita Chernukhin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # remote_ruby
2
- ![Lint & Test](https://github.com/nu-hin/remote_ruby/actions/workflows/main.yml/badge.svg)
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
@@ -1,3 +1,6 @@
1
+ # Set up Bundler if Gemfile is present
2
+ require 'bundler/setup' if File.exist?('Gemfile')
3
+
1
4
  require 'base64'
2
5
 
3
6
  __marshalled_locals_names__ = []
@@ -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
- "cd \"#{working_dir}\" && ruby"
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
- "#{command} #{server} \"cd #{working_dir} && ruby\""
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RemoteRuby
4
- VERSION = '0.2'
4
+ VERSION = '0.3.0'
5
5
  end
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.add_runtime_dependency 'colorize', '~> 0.8'
32
- spec.add_runtime_dependency 'method_source', '~> 1.0'
33
- spec.add_runtime_dependency 'parser', '~> 3.0'
34
- spec.add_runtime_dependency 'unparser', '~> 0.6'
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: '0.2'
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: 2021-11-15 00:00:00.000000000 Z
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.2.22
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.