remote_ruby 0.3.0 → 1.1.0

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -2
  3. data/.rubocop.yml +37 -6
  4. data/CHANGELOG.md +69 -0
  5. data/LICENSE.txt +1 -1
  6. data/README.md +358 -90
  7. data/lib/remote_ruby/adapter_builder.rb +75 -0
  8. data/lib/remote_ruby/cache_adapter.rb +41 -0
  9. data/lib/remote_ruby/{connection_adapter/caching_adapter.rb → caching_adapter.rb} +23 -13
  10. data/lib/remote_ruby/code_templates/compiler/main.rb.erb +17 -29
  11. data/lib/remote_ruby/compat_io_reader.rb +36 -0
  12. data/lib/remote_ruby/compat_io_writer.rb +38 -0
  13. data/lib/remote_ruby/compiler.rb +8 -8
  14. data/lib/remote_ruby/connection_adapter.rb +16 -16
  15. data/lib/remote_ruby/execution_context.rb +56 -74
  16. data/lib/remote_ruby/extensions.rb +14 -0
  17. data/lib/remote_ruby/parser_factory.rb +29 -0
  18. data/lib/remote_ruby/plugin.rb +25 -0
  19. data/lib/remote_ruby/{flavour/rails_flavour.rb → rails_plugin.rb} +7 -5
  20. data/lib/remote_ruby/remote_context.rb +52 -0
  21. data/lib/remote_ruby/remote_error.rb +55 -0
  22. data/lib/remote_ruby/source_extractor.rb +2 -12
  23. data/lib/remote_ruby/ssh_adapter.rb +129 -0
  24. data/lib/remote_ruby/stream_prefixer.rb +25 -0
  25. data/lib/remote_ruby/tee_writer.rb +16 -0
  26. data/lib/remote_ruby/text_mode_adapter.rb +63 -0
  27. data/lib/remote_ruby/text_mode_builder.rb +44 -0
  28. data/lib/remote_ruby/tmp_file_adapter.rb +62 -0
  29. data/lib/remote_ruby/version.rb +1 -1
  30. data/lib/remote_ruby.rb +57 -15
  31. metadata +72 -28
  32. data/.github/workflows/main.yml +0 -26
  33. data/.gitignore +0 -17
  34. data/Gemfile +0 -23
  35. data/lib/remote_ruby/connection_adapter/cache_adapter.rb +0 -41
  36. data/lib/remote_ruby/connection_adapter/eval_adapter.rb +0 -96
  37. data/lib/remote_ruby/connection_adapter/local_stdin_adapter.rb +0 -29
  38. data/lib/remote_ruby/connection_adapter/ssh_stdin_adapter.rb +0 -34
  39. data/lib/remote_ruby/connection_adapter/stdin_process_adapter.rb +0 -35
  40. data/lib/remote_ruby/flavour.rb +0 -27
  41. data/lib/remote_ruby/runner.rb +0 -55
  42. data/lib/remote_ruby/stream_cacher.rb +0 -36
  43. data/lib/remote_ruby/unmarshaler.rb +0 -59
  44. data/remote_ruby.gemspec +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37bace854f64fcf07a95e1a8168cef708988610894764afdfadc08c8fb46674d
4
- data.tar.gz: 0324ae7519ada602236715247b2dd55b228e33019f5d262024fc3acbbe2fa823
3
+ metadata.gz: acba2fd4c7364a6be5101be3505de18aeb6b566e061bb9eafdc1dbff82347209
4
+ data.tar.gz: 3ce29f9130c169b18b7c9b372e8249ea399229a4f78b28aaed615cdfb98b9c2f
5
5
  SHA512:
6
- metadata.gz: 1ed7df90f0a19153b1cc868b21aded8630eb40eaa6c52925c7ffad99fcac69d58733bec402ea3d4eff9fe5eb511d39281539ed292b56f350ecb02f2c68f9662d
7
- data.tar.gz: 9ed44ea3c1abee071e574f1a5fb69979464b47d8dd22ad1c7349f118bf5020e1ee6241ed5b8dbecb6a5e99d9906de051ccef11ff1b767c2d732e2a26702d6002
6
+ metadata.gz: e390a2c17b1738f9aef2776fe0eaec313a2d6aa3bbc83b1be07741fad2c0d2fdeb62471f3bcf38feb3a783dfd8230c24d176ce738d7b31f49e62486c11b567c4
7
+ data.tar.gz: 538d0d9b0b8713b93624e92664075eaffcc06202107e3860ba96d506b3590c645bcaf0b522eda8cfa9f48e212de5e0e25725b8cba658c0a8bd5e9b396276cdda
data/.rspec CHANGED
@@ -1,4 +1,3 @@
1
1
  --require 'spec_helper'
2
- --format documentation
3
2
  --color
4
- --tag ~type:integration
3
+ --tag ~type:ssh
data/.rubocop.yml CHANGED
@@ -1,13 +1,44 @@
1
+ plugins:
2
+ - rubocop-rspec
3
+
1
4
  AllCops:
2
5
  NewCops: enable
3
- TargetRubyVersion: 2.6
6
+ TargetRubyVersion: 2.7
7
+
8
+ Metrics/AbcSize:
9
+ Max: 22
10
+
11
+ Metrics/ClassLength:
12
+ Max: 100
13
+
14
+ Metrics/MethodLength:
15
+ Max: 24
16
+
17
+ RSpec/MultipleExpectations:
18
+ Enabled: false
19
+
20
+ RSpec/ExampleLength:
21
+ Max: 30
22
+
23
+ RSpec/MultipleMemoizedHelpers:
24
+ Max: 10
4
25
 
5
- Metrics/BlockLength:
6
- AllowedMethods: ['describe', 'context', 'shared_context']
26
+ RSpec/NestedGroups:
27
+ Max: 4
7
28
 
8
- Style/GlobalStdStream:
29
+ RSpec/DescribeClass:
9
30
  Exclude:
10
- - spec/remote_ruby/connection_adapter/eval_adapter_spec.rb
31
+ - 'spec/integration/**/*_spec.rb'
32
+
33
+
34
+ RSpec/ContextWording:
35
+ Prefixes:
36
+ - and
37
+ - with
38
+ - because
39
+ - when
40
+ - without
41
+ - shared
11
42
 
12
- Style/DocumentDynamicEvalDefinition:
43
+ RSpec/RepeatedExampleGroupBody:
13
44
  Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,69 @@
1
+ # Changelog
2
+
3
+ ## [1.1](https://github.com/Nu-hin/remote_ruby/releases/tag/v1.1)
4
+
5
+ * Added a new option `ruby_executable` to the `ExecutionContext`
6
+ * Fixed a bug when non-zero return code of SSH process was raising an incorrect excepion.
7
+
8
+ ## [1.0](https://github.com/Nu-hin/remote_ruby/releases/tag/v1.0)
9
+
10
+ ### Major changes
11
+
12
+ * Full [support of SSH features](README.md#ssh-parameters), including password authentication, private key passphrases, made possible by switching to [net-ssh](https://github.com/net-ssh/net-ssh) gem.
13
+ * Since RemoteRuby no longer uses system SSH client, use of MacOS Keychain (`UseKeychain` option in MacOS OpenSSH implementation, starting from MacOS Sierra) is no longer possible.
14
+ * Added [support for STDIN](README.md#input) redirection. It is now possible to make remote scripts interactive, or stream data from local host.
15
+ * The output and error streams are now automatically synchronized. There is no need to use `STDOUT.flush` in the remote script anymore to avoid delays.
16
+ * Output and Error streams now work in binary mode, instead of being read line-by-line. It is possible to stream binary data from the remote script.
17
+ * Added support for dumping compiled code for easier debugging (see [Parameters](README.md#parameters))
18
+ * Added proper [error handling](README.md#error-handling). Printing remote stack trace and code context on error for easier debugging.
19
+ * Added advanced, customizable [text mode](README.md#text-mode).
20
+ * Flavours are renamed to plugins. It is now possible to [add custom plugins in configuration](README.md#plugins).
21
+ * Added a possibility to ignore specified types globally. Variables of the ignored types won't be attempted for serialization.
22
+
23
+ ### Minor changes
24
+
25
+ * Minimum supported Ruby version is now 2.7
26
+ * `.remotely` is not included to the global scope by default, and needs to be included [explicitly](README.md#basic-usage).
27
+ * Connection adapter is now automatically selected based on the presence of the `host` argument.
28
+ * Only two adapters are now available: SSH adapter, and local temp file adapter. All other adapters are deprecated.
29
+ * Cache directory is now a [global configuration option](README.md#configuration), rather than an argument to the ExecutionContext.
30
+ * The default cache location is now in the .remote_ruby/cache, relative to the working directory.
31
+ * Added a possibility to suppress [Parser warnings](https://github.com/whitequark/parser#compatibility-with-ruby-mri).
32
+ * Added [changelog](#CHANGELOG.md)
33
+
34
+ ### Migration from v0.3
35
+
36
+ 1. To have `.remotely` method in global scope, include the `RemoteRuby::Extensions` module
37
+ 2. Rename `server` parameter to `host`.
38
+ 3. Remove `adapter` parameter.
39
+ 4. Remove `cache_dir` parameter and configure it globally instead.
40
+ 5. Remove `bundler` parameter.
41
+ 6. If you want stdout and stderr to be prefixed, enable Text Mode and configure it.
42
+ 7. Change `key_file` parameter to `keys` and make it an array with one filename instead of single string.
43
+ 8. Optionally remove `STDOUT.flush` from your scripts.
44
+
45
+ Here's an example configuration which should resemble the default behaviour of v0.3:
46
+
47
+ ```ruby
48
+ RemoteRuby.configure do |c|
49
+ c.cache_dir = File.join(Dir.pwd, 'cache')
50
+ end
51
+
52
+ include RemoteRuby::Extensions
53
+
54
+ ec = RemoteRuby::ExecutionContext.new(
55
+ host: 'my_ssh_host',
56
+ text_mode: true
57
+ )
58
+
59
+ ec.execute do
60
+ # your code
61
+ end
62
+
63
+ # OR
64
+
65
+ remotely(host: 'my_ssh_host', text_mode: true) do
66
+ # your code
67
+ end
68
+
69
+ ```
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2024 Nikita Chernukhin
3
+ Copyright (c) 2025 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