michelle 0.0.2 → 0.0.4

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.
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ require 'drb'
4
+
5
+ module Michelle
6
+ @container = nil
7
+
8
+ def self.start_client
9
+ DRb.start_service
10
+ @container = DRbObject.new nil, 'druby://127.0.0.1:13579'
11
+ end
12
+
13
+ def self.call_eval code
14
+ @container.to_eval code
15
+ end
16
+ end
17
+
18
+
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ require 'drb'
4
+ require 'stringio'
5
+
6
+ module Michelle
7
+ class Server
8
+ @last_return = nil
9
+
10
+ def redirect
11
+ orig_stdout = $stdout
12
+ orig_stderr = $stderr
13
+ $stdout = StringIO.new
14
+ $stderr = StringIO.new
15
+ yield
16
+ $stdout.string + $stderr.string
17
+ ensure
18
+ $stdout = orig_stdout
19
+ $stderr = orig_stderr
20
+ end
21
+
22
+ def to_eval code
23
+ redirect do
24
+ begin
25
+ @last_return = eval code
26
+ rescue SyntaxError => error_message
27
+ puts error_message
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ def self.start_server
34
+ $:.unshift '.'
35
+ DRb.start_service 'druby://127.0.0.1:13579', Server.new
36
+ puts DRb.uri
37
+ DRb.thread.join
38
+ end
39
+
40
+ end
@@ -1,3 +1,3 @@
1
1
  module Michelle
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/michelle.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require "michelle/version"
2
2
 
3
3
  module Michelle
4
- def self.testing
5
- "testing testing"
4
+ def self.hello
5
+ "Hello World! Hello World!!!"
6
6
  end
7
7
  end
data/michelle.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- # -*- encoding: utf-8 -*-
1
+ # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
  require "michelle/version"
4
4
 
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ require 'michelle/client'
4
+
5
+ def testing
6
+ #$:.unshift '.'
7
+ #require "test_code.rb"
8
+
9
+ #print Michelle.evaluate "$:.unshift "
10
+ #print Michelle.call_eval "puts $:"
11
+
12
+ #print Michelle.call_eval "require 'rdiscount'"
13
+ #print Michelle.call_eval "puts RDiscount.new('**Hello RubyInstaller**').to_html"
14
+
15
+ print Michelle.call_eval "load 'test_load.rb'"
16
+ print Michelle.call_eval "testload"
17
+
18
+ print Michelle.call_eval "unless @x; @x = 0; end;"
19
+ print Michelle.call_eval "@x = @x + 1"
20
+ print Michelle.call_eval "puts @x"
21
+
22
+ print Michelle.call_eval "def abc;"
23
+
24
+ print Michelle.call_eval "unless respond_to?('abc'); def abc; puts 'abc hello abc'; end; end;"
25
+ print Michelle.call_eval "abc"
26
+
27
+ print Michelle.call_eval "puts 'hello'"
28
+
29
+ print Michelle.call_eval "1+1"
30
+ print Michelle.call_eval "puts @last_return"
31
+ print Michelle.call_eval "'return'"
32
+ print Michelle.call_eval "puts @last_return"
33
+
34
+ print Michelle.call_eval "unless @y; @y = 0; end;"
35
+ print Michelle.call_eval "unless @z; @z = 0; end;"
36
+
37
+ print Michelle.call_eval "puts instance_variables"
38
+
39
+ gets
40
+ end
41
+
42
+ Michelle.start_client
43
+
44
+ testing
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ require 'michelle/server'
4
+
5
+ Michelle.start_server
data/test/test_load.rb ADDED
@@ -0,0 +1,3 @@
1
+ def testload
2
+ puts "testload success"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: michelle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-10 00:00:00.000000000 Z
12
+ date: 2012-03-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This is gem for the windows application "michelle". This gem is not supposed
15
15
  to be installed to any ruby other than the one shipped with the Windows application
@@ -24,10 +24,15 @@ files:
24
24
  - Gemfile
25
25
  - Rakefile
26
26
  - lib/michelle.rb
27
+ - lib/michelle/client.rb
28
+ - lib/michelle/server.rb
27
29
  - lib/michelle/version.rb
28
30
  - michelle.gemspec
29
31
  - michelle.sublime-project
30
32
  - michelle.sublime-workspace
33
+ - test/client_call.rb
34
+ - test/server_start.rb
35
+ - test/test_load.rb
31
36
  homepage: ''
32
37
  licenses: []
33
38
  post_install_message: