remote_ruby 0.3.0 → 1.0.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 +64 -0
  5. data/LICENSE.txt +1 -1
  6. data/README.md +348 -81
  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 +128 -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: 4723cad8943a76df4ab284d278ca6ffa49f8a10ac869dabf68d8d172f30baf63
4
+ data.tar.gz: f80c91b1081e85f463b3b60fbcf58c97c5ad3c2ba93ea81492a08a114ac65cc6
5
5
  SHA512:
6
- metadata.gz: 1ed7df90f0a19153b1cc868b21aded8630eb40eaa6c52925c7ffad99fcac69d58733bec402ea3d4eff9fe5eb511d39281539ed292b56f350ecb02f2c68f9662d
7
- data.tar.gz: 9ed44ea3c1abee071e574f1a5fb69979464b47d8dd22ad1c7349f118bf5020e1ee6241ed5b8dbecb6a5e99d9906de051ccef11ff1b767c2d732e2a26702d6002
6
+ metadata.gz: e437b61ff5fb4cfe05bf172e3cac77de4fc7147852bc8938bc3a0116a5613610c9460671da4807eb3beb0df3aa694c09b1879003727d0c2721d119307e738bda
7
+ data.tar.gz: 5ba9e01b990eb6f5f2a2ff4f50c9f49a5005b99c03cc5fd3ecbc0127cdbe2ae75fa70aa2b378994e7c5c665e0e1537c013e74899b6fdeb3732ef6be0654c5fab
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,64 @@
1
+ # Changelog
2
+
3
+ ## [1.0](https://github.com/Nu-hin/remote_ruby/releases/tag/v1.0)
4
+
5
+ ### Major changes
6
+
7
+ * 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.
8
+ * 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.
9
+ * Added [support for STDIN](README.md#input) redirection. It is now possible to make remote scripts interactive, or stream data from local host.
10
+ * 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.
11
+ * 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.
12
+ * Added support for dumping compiled code for easier debugging (see [Parameters](README.md#parameters))
13
+ * Added proper [error handling](README.md#error-handling). Printing remote stack trace and code context on error for easier debugging.
14
+ * Added advanced, customizable [text mode](README.md#text-mode).
15
+ * Flavours are renamed to plugins. It is now possible to [add custom plugins in configuration](README.md#plugins).
16
+ * Added a possibility to ignore specified types globally. Variables of the ignored types won't be attempted for serialization.
17
+
18
+ ### Minor changes
19
+
20
+ * Minimum supported Ruby version is now 2.7
21
+ * `.remotely` is not included to the global scope by default, and needs to be included [explicitly](README.md#basic-usage).
22
+ * Connection adapter is now automatically selected based on the presence of the `host` argument.
23
+ * Only two adapters are now available: SSH adapter, and local temp file adapter. All other adapters are deprecated.
24
+ * Cache directory is now a [global configuration option](README.md#configuration), rather than an argument to the ExecutionContext.
25
+ * The default cache location is now in the .remote_ruby/cache, relative to the working directory.
26
+ * Added a possibility to suppress [Parser warnings](https://github.com/whitequark/parser#compatibility-with-ruby-mri).
27
+ * Added [changelog](#CHANGELOG.md)
28
+
29
+ ### Migration from v0.3
30
+
31
+ 1. To have `.remotely` method in global scope, include the `RemoteRuby::Extensions` module
32
+ 2. Rename `server` parameter to `host`.
33
+ 3. Remove `adapter` parameter.
34
+ 4. Remove `cache_dir` parameter and configure it globally instead.
35
+ 5. Remove `bundler` parameter.
36
+ 6. If you want stdout and stderr to be prefixed, enable Text Mode and configure it.
37
+ 7. Change `key_file` parameter to `keys` and make it an array with one filename instead of single string.
38
+ 8. Optionally remove `STDOUT.flush` from your scripts.
39
+
40
+ Here's an example configuration which should resemble the default behaviour of v0.3:
41
+
42
+ ```ruby
43
+ RemoteRuby.configure do |c|
44
+ c.cache_dir = File.join(Dir.pwd, 'cache')
45
+ end
46
+
47
+ include RemoteRuby::Extensions
48
+
49
+ ec = RemoteRuby::ExecutionContext.new(
50
+ host: 'my_ssh_host',
51
+ text_mode: true
52
+ )
53
+
54
+ ec.execute do
55
+ # your code
56
+ end
57
+
58
+ # OR
59
+
60
+ remotely(host: 'my_ssh_host', text_mode: true) do
61
+ # your code
62
+ end
63
+
64
+ ```
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