irb_remote 0.1.0 → 0.2.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: 74b85fbb95a993f04c1786fa2ad69a21aad60c17baa43d99d4d111924e514dcd
4
- data.tar.gz: 0cb0510249e561c5d1f1b3baa73c951870e3d1903177fd60dd695e088e75858f
3
+ metadata.gz: 55d2d53c9e5aa7683d84de815f0da378b8818c7b4a49aa76358be5a648a2d5e1
4
+ data.tar.gz: ec96290c6aa9ba9d1efa394a83bd5a893415ef73cb87f48b100ef2efe6089c66
5
5
  SHA512:
6
- metadata.gz: 61e558563b21486c662296c3b632de9a4e3dbbd4cf5b9f2fb6b81fdf5aa5cb9b6c96c28865cb03d4e313015c5b10bc75f776318a1547ca19c31b58e1179aebca
7
- data.tar.gz: 2b724854a4c94df726d3e241ff201c43fc25d70ac9536e59724f8b959482326432c8b25c673e154bb5075c3af68b976c8a99805ee5dff64b2e0468d88d73b1a4
6
+ metadata.gz: 51b75fa4921b9b7e5869201ce1e257b9592e1ab00c692514b6b1912d131de8339ddbad7bda4e9d1eb2586a48b83d1630fcaea5b7459e5e50e6ba37376c2eaaa4
7
+ data.tar.gz: 1d1b6e27b8cb3089d0af28cda5b42c8bddc59f492526cbb1f5b774eb1fffb0bbf25bfc6ce7a8565f53ca2c3e4477f92365ef1ef77359f0caed54dbadcbe147b7
data/.gitignore CHANGED
@@ -11,3 +11,5 @@
11
11
  .rspec_status
12
12
 
13
13
  .ruby-version
14
+
15
+ Gemfile.lock
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'irb_remote'
4
+ IRBRemote::CLI.start(ARGV)
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
+ spec.add_dependency 'thor'
25
26
  spec.add_development_dependency "bundler", "~> 1.16"
26
27
  spec.add_development_dependency "rake", "~> 10.0"
27
28
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -1,6 +1,9 @@
1
+ require "irb_remote/cli"
2
+ require "irb_remote/client"
1
3
  require "irb_remote/configuration"
2
- require "irb_remote/version"
3
4
  require "irb_remote/core_ext/binding"
5
+ require "irb_remote/server"
6
+ require "irb_remote/version"
4
7
 
5
8
  module IRBRemote
6
9
  class << self
@@ -0,0 +1,18 @@
1
+ require 'thor'
2
+
3
+ module IRBRemote
4
+ class CLI < Thor
5
+ default_task :connect
6
+
7
+ desc "connect", "Connect to remote irb server"
8
+ def connect(*)
9
+ IRBRemote::Client.new.start
10
+ end
11
+
12
+ map %w[-v --version] => :version
13
+ desc "-v or --version", "Print the version"
14
+ def version
15
+ puts IRBRemote::Version
16
+ end
17
+ end
18
+ end
@@ -1,4 +1,3 @@
1
- require 'irb'
2
1
  require 'drb/drb'
3
2
 
4
3
  module IRBRemote
@@ -1,8 +1,6 @@
1
- require "readline"
2
-
3
1
  module IRBRemote
4
2
  class InputMethod < IRB::InputMethod
5
- # Creates a new input method object using Readline
3
+ # Creates a new input method object
6
4
  def initialize(input, output)
7
5
  super()
8
6
 
@@ -10,12 +10,14 @@ module IRBRemote
10
10
  end
11
11
 
12
12
  def start
13
- IRB.setup(@binding.eval('__FILE__'), argv: [])
13
+ IRB.setup(@binding.eval('__FILE__'))
14
14
  DRb.start_service("druby://#{IRBRemote.config.host}:#{IRBRemote.config.port}", self, safe_level: 1)
15
15
  DRb.thread.join
16
16
  end
17
17
 
18
18
  def connected(input, output)
19
+ # irb uses Kernel#puts for output
20
+ original_stdout = $stdout.dup
19
21
  $stdout = output
20
22
  workspace = IRB::WorkSpace.new(@binding)
21
23
  output.print(workspace.code_around_binding)
@@ -23,6 +25,7 @@ module IRBRemote
23
25
  irb.run(IRB.conf)
24
26
  rescue DRb::DRbConnError
25
27
  ensure
28
+ $stdout = original_stdout
26
29
  DRb.stop_service
27
30
  end
28
31
  end
@@ -1,3 +1,3 @@
1
1
  module IRBRemote
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irb_remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Iguchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-31 00:00:00.000000000 Z
11
+ date: 2018-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -63,14 +77,15 @@ files:
63
77
  - ".rspec"
64
78
  - ".travis.yml"
65
79
  - Gemfile
66
- - Gemfile.lock
67
80
  - LICENSE.txt
68
81
  - README.md
69
82
  - Rakefile
70
83
  - bin/console
84
+ - bin/irb_remote
71
85
  - bin/setup
72
86
  - irb_remote.gemspec
73
87
  - lib/irb_remote.rb
88
+ - lib/irb_remote/cli.rb
74
89
  - lib/irb_remote/client.rb
75
90
  - lib/irb_remote/configuration.rb
76
91
  - lib/irb_remote/core_ext/binding.rb
@@ -1,35 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- irb_remote (0.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- diff-lcs (1.3)
10
- rake (10.5.0)
11
- rspec (3.7.0)
12
- rspec-core (~> 3.7.0)
13
- rspec-expectations (~> 3.7.0)
14
- rspec-mocks (~> 3.7.0)
15
- rspec-core (3.7.1)
16
- rspec-support (~> 3.7.0)
17
- rspec-expectations (3.7.0)
18
- diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.7.0)
20
- rspec-mocks (3.7.0)
21
- diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.7.0)
23
- rspec-support (3.7.1)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- bundler (~> 1.16)
30
- irb_remote!
31
- rake (~> 10.0)
32
- rspec (~> 3.0)
33
-
34
- BUNDLED WITH
35
- 1.16.3