tengine_core 0.5.39 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/Gemfile +1 -37
  2. data/Gemfile.lock +59 -61
  3. data/README.md +8 -6
  4. data/bin/create_indexes_for_tengine_core +18 -0
  5. data/bin/tengined +3 -3
  6. data/examples/list.txt +36 -0
  7. data/examples/uc08_if_both_a_and_b_occurs.rb +7 -1
  8. data/examples/uc20_fire_with_properties.rb +19 -0
  9. data/examples/uc21_fire_with_same_key.rb +23 -0
  10. data/examples/uc22_fire_with_source_name.rb +17 -0
  11. data/examples/uc23_fire_with_level.rb +19 -0
  12. data/examples/uc24_fire_with_level_key.rb +19 -0
  13. data/examples/uc30_local_variables.rb +28 -0
  14. data/examples/uc31_instance_variables.rb +35 -0
  15. data/examples/uc32_class_variables.rb +20 -0
  16. data/examples/uc33_statics.rb +20 -0
  17. data/examples2/uc30_local_variables.rb +55 -0
  18. data/examples2/uc31_instance_variables.rb +46 -0
  19. data/examples2/uc32_class_variables.rb +22 -0
  20. data/examples2/uc33_statics.rb +23 -0
  21. data/lib/tengine/core/bootstrap.rb +1 -1
  22. data/lib/tengine/core/config/atd.rb +0 -3
  23. data/lib/tengine/core/config/core.rb +21 -20
  24. data/lib/tengine/core/config/heartbeat_watcher.rb +0 -3
  25. data/lib/tengine/core/driveable.rb +34 -12
  26. data/lib/tengine/core/driver.rb +22 -9
  27. data/lib/tengine/core/dsl_evaluator.rb +2 -15
  28. data/lib/tengine/core/dsl_filter_def.rb +40 -0
  29. data/lib/tengine/core/dsl_loader.rb +1 -1
  30. data/lib/tengine/core/event.rb +44 -29
  31. data/lib/tengine/core/event/finder.rb +1 -1
  32. data/lib/tengine/core/event_exception_reportable.rb +7 -10
  33. data/lib/tengine/core/event_wrapper.rb +1 -1
  34. data/lib/tengine/core/find_by_name.rb +1 -1
  35. data/lib/tengine/core/handler.rb +14 -4
  36. data/lib/tengine/core/handler_path.rb +1 -1
  37. data/lib/tengine/core/heartbeat_watcher.rb +3 -2
  38. data/lib/tengine/core/kernel.rb +22 -6
  39. data/lib/tengine/core/mongoid_fix.rb +2 -1
  40. data/lib/tengine/core/mutex.rb +22 -8
  41. data/lib/tengine/core/optimistic_lock.rb +6 -6
  42. data/lib/tengine/core/safe_updatable.rb +24 -26
  43. data/lib/tengine/core/schedule.rb +2 -2
  44. data/lib/tengine/core/scheduler.rb +5 -4
  45. data/lib/tengine/core/session.rb +14 -0
  46. data/lib/tengine/core/session_wrapper.rb +20 -4
  47. data/lib/tengine/core/setting.rb +3 -3
  48. data/lib/tengine/rspec/extension.rb +6 -8
  49. metadata +156 -171
  50. data/.document +0 -5
  51. data/.rspec +0 -1
  52. data/Rakefile +0 -44
  53. data/VERSION +0 -1
  54. data/lib/tengine/core/connection_test/.gitignore +0 -1
  55. data/spec/factories/tengine_core_drivers.rb +0 -10
  56. data/spec/factories/tengine_core_events.rb +0 -14
  57. data/spec/factories/tengine_core_handler_paths.rb +0 -9
  58. data/spec/factories/tengine_core_handlers.rb +0 -9
  59. data/spec/factories/tengine_core_sessions.rb +0 -9
  60. data/spec/mongoid.yml +0 -35
  61. data/spec/spec_helper.rb +0 -48
  62. data/spec/support/mongo_index_key_log.rb +0 -91
  63. data/spec/tengine/core/bootstrap_spec.rb +0 -278
  64. data/spec/tengine/core/bugfix/bind_dsl_file_in_multi_byte_dir_spec.rb +0 -21
  65. data/spec/tengine/core/bugfix/enabled_on_activation_spec.rb +0 -112
  66. data/spec/tengine/core/bugfix/receive_event_spec.rb +0 -133
  67. data/spec/tengine/core/bugfix/use_dsl_version_method.rb +0 -12
  68. data/spec/tengine/core/bugfix/use_dsl_version_method_spec.rb +0 -28
  69. data/spec/tengine/core/bugfix/use_event_in_handler_dsl.rb +0 -11
  70. data/spec/tengine/core/bugfix//351/235/236ACSII/343/201/256/343/203/206/343/202/231/343/202/243/343/203/254/343/202/257/343/203/210/343/203/252/345/220/215/source_location_encoding.rb +0 -35
  71. data/spec/tengine/core/bugfix//351/235/236ACSII/343/201/256/343/203/206/343/202/231/343/202/243/343/203/254/343/202/257/343/203/210/343/203/252/345/220/215//351/235/236ASCII/343/201/256/343/203/225/343/202/241/343/202/244/343/203/253/345/220/215_dsl.rb +0 -38
  72. data/spec/tengine/core/bugfix//351/235/236ACSII/343/201/256/343/203/207/343/202/243/343/203/254/343/202/257/343/203/210/343/203/252/345/220/215/source_location_encoding.rb +0 -35
  73. data/spec/tengine/core/bugfix//351/235/236ACSII/343/201/256/343/203/207/343/202/243/343/203/254/343/202/257/343/203/210/343/203/252/345/220/215//351/235/236ASCII/343/201/256/343/203/225/343/202/241/343/202/244/343/203/253/345/220/215_dsl.rb +0 -38
  74. data/spec/tengine/core/config/atd_spec.rb +0 -62
  75. data/spec/tengine/core/config/core_spec.rb +0 -479
  76. data/spec/tengine/core/config/heartbeat_watcher_spec.rb +0 -62
  77. data/spec/tengine/core/config/syntax_error_in_erb.yml.erb +0 -13
  78. data/spec/tengine/core/config/wrong_category_name.yml.erb +0 -13
  79. data/spec/tengine/core/config/wrong_field_name.yml.erb +0 -12
  80. data/spec/tengine/core/config/wrong_yaml.yml.erb +0 -13
  81. data/spec/tengine/core/config_spec/another_port.yml +0 -54
  82. data/spec/tengine/core/config_spec/config_with_dir_absolute_load_path.yml +0 -16
  83. data/spec/tengine/core/config_spec/config_with_dir_relative_load_path.yml +0 -16
  84. data/spec/tengine/core/config_spec/config_with_file_absolute_load_path.yml +0 -16
  85. data/spec/tengine/core/config_spec/config_with_file_relative_load_path.yml +0 -16
  86. data/spec/tengine/core/config_spec/log_config_spec.rb +0 -245
  87. data/spec/tengine/core/driveable_spec.rb +0 -240
  88. data/spec/tengine/core/driver_spec.rb +0 -159
  89. data/spec/tengine/core/dsl_loader_spec.rb +0 -172
  90. data/spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb +0 -35
  91. data/spec/tengine/core/dsls/uc10_if_the_event_occurs_at_the_server_spec.rb +0 -58
  92. data/spec/tengine/core/dsls/uc50_commit_event_at_first_spec.rb +0 -29
  93. data/spec/tengine/core/dsls/uc52_commit_event_after_all_handler_submit_spec.rb +0 -33
  94. data/spec/tengine/core/dsls/uc52_never_commit_event_unless_all_handler_submit_spec.rb +0 -38
  95. data/spec/tengine/core/dsls/uc53_submit_outside_of_handler_spec.rb +0 -37
  96. data/spec/tengine/core/dsls/uc60_event_in_handler_spec.rb +0 -31
  97. data/spec/tengine/core/dsls/uc61_event_outside_of_handler_spec.rb +0 -37
  98. data/spec/tengine/core/dsls/uc62_session_in_driver_spec.rb +0 -36
  99. data/spec/tengine/core/dsls/uc63_session_outside_of_driver_spec.rb +0 -35
  100. data/spec/tengine/core/dsls/uc64_safety_countup_spec.rb +0 -134
  101. data/spec/tengine/core/dsls/uc70_driver_enabled_on_activation_spec.rb +0 -39
  102. data/spec/tengine/core/dsls/uc71_driver_disabled_on_activation_spec.rb +0 -36
  103. data/spec/tengine/core/dsls/uc72_setup_eventmachine_spec.rb +0 -39
  104. data/spec/tengine/core/dsls/uc80_raise_io_error_spec.rb +0 -53
  105. data/spec/tengine/core/dsls/uc81_raise_runtime_error_spec.rb +0 -49
  106. data/spec/tengine/core/event/finder_spec.rb +0 -136
  107. data/spec/tengine/core/event_exception_reportable_spec.rb +0 -33
  108. data/spec/tengine/core/event_spec.rb +0 -161
  109. data/spec/tengine/core/event_wrapper_spec.rb +0 -35
  110. data/spec/tengine/core/handler_path_spec.rb +0 -87
  111. data/spec/tengine/core/handler_spec.rb +0 -190
  112. data/spec/tengine/core/heartbeat_watcher_spec.rb +0 -131
  113. data/spec/tengine/core/io_to_logger_spec.rb +0 -30
  114. data/spec/tengine/core/kernel_spec.rb +0 -902
  115. data/spec/tengine/core/mongodb_spec.rb +0 -12
  116. data/spec/tengine/core/mongoid_fix_spec.rb +0 -52
  117. data/spec/tengine/core/mutex_spec.rb +0 -201
  118. data/spec/tengine/core/optimistic_lock_spec.rb +0 -55
  119. data/spec/tengine/core/scheculer_spec.rb +0 -121
  120. data/spec/tengine/core/selectable_attr_spec.rb +0 -30
  121. data/spec/tengine/core/session_spec.rb +0 -104
  122. data/spec/tengine/core/setting_spec.rb +0 -79
  123. data/spec/tengine/core_spec.rb +0 -13
  124. data/spec/tengine_spec.rb +0 -14
  125. data/tengine_core.gemspec +0 -251
  126. data/tmp/log/.gitignore +0 -1
  127. data/tmp/tengined_status/.gitignore +0 -1
@@ -1,21 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe "bind_dsl_file_in_multi_byte_dir" do
5
- before do
6
- Tengine::Core::Driver.delete_all
7
- Tengine::Core::Session.delete_all
8
- @config = Tengine::Core::Config::Core.new({
9
- :tengined => {
10
- :load_path => File.expand_path('非ACSIIのディレクトリ名/非ASCIIのファイル名_dsl.rb', File.dirname(__FILE__)),
11
- },
12
- })
13
- end
14
-
15
- it "aとbが両方起きたらハンドラが実行されます" do
16
- @bootstrap = Tengine::Core::Bootstrap.new(@config)
17
- @bootstrap.load_dsl
18
- @kernel = Tengine::Core::Kernel.new(@config)
19
- @kernel.bind
20
- end
21
- end
@@ -1,112 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
- require 'amqp'
4
-
5
- describe "load_dsl" do
6
-
7
- describe "driver" do
8
- before do
9
- Tengine::Core::Driver.delete_all
10
- Tengine::Core::HandlerPath.delete_all
11
- end
12
-
13
- context "enabled_on_activation" do
14
- it "defaultではイベントドライバが有効になる" do
15
- config = Tengine::Core::Config::Core.new({
16
- :tengined => {
17
- :load_path => File.expand_path('../../../../examples/uc01_execute_processing_for_event.rb', File.dirname(__FILE__)),
18
- }
19
- })
20
- kernel = Tengine::Core::Kernel.new(config)
21
- kernel.evaluate
22
- Tengine::Core::Driver.count.should == 1
23
- driver = Tengine::Core::Driver.first
24
- driver.should_not be_nil
25
- driver.name.should == "driver01"
26
- driver.version.should == "20110902213500"
27
- driver.enabled.should == true # オプション設定: 有効
28
- driver.enabled_on_activation.should == true # DSL設定: 有効
29
- driver.handlers.count.should == 1
30
- handler1 = driver.handlers.first
31
- handler1.event_type_names.should == ["event01"]
32
- Tengine::Core::HandlerPath.where(:driver_id => driver.id).count.should == 1
33
- Tengine::Core::HandlerPath.default_driver_version = "20110902213500"
34
- Tengine::Core::HandlerPath.find_handlers("event01").count.should == 1
35
- end
36
-
37
- it "マルチプロセス起動時のデフォルト時はイベントドライバが無効になる" do
38
- config = Tengine::Core::Config::Core.new({
39
- :tengined => {
40
- :load_path => File.expand_path('../../../../examples/uc01_execute_processing_for_event.rb', File.dirname(__FILE__)),
41
- :skip_enablement => true
42
- }
43
- })
44
- kernel = Tengine::Core::Kernel.new(config)
45
- kernel.evaluate
46
- Tengine::Core::Driver.count.should == 1
47
- driver = Tengine::Core::Driver.first
48
- driver.should_not be_nil
49
- driver.name.should == "driver01"
50
- driver.version.should == "20110902213500"
51
- driver.enabled.should == false # オプション設定: 無効
52
- driver.enabled_on_activation.should == true # DSL設定: 有効
53
- driver.handlers.count.should == 1
54
- handler1 = driver.handlers.first
55
- handler1.event_type_names.should == ["event01"]
56
- Tengine::Core::HandlerPath.where(:driver_id => driver.id).count.should == 1
57
- Tengine::Core::HandlerPath.default_driver_version = "20110902213500"
58
- # driver.enable == false なので取得できないため 0 件
59
- Tengine::Core::HandlerPath.find_handlers("event01").count.should == 0
60
- end
61
-
62
- it "DSL内の定義でイベントドライバが無効としている" do
63
- config = Tengine::Core::Config::Core.new({
64
- :tengined => {
65
- :load_path => File.expand_path('../../../../examples/uc71_driver_disabled_on_activation.rb', File.dirname(__FILE__)),
66
- }
67
- })
68
- kernel = Tengine::Core::Kernel.new(config)
69
- kernel.evaluate
70
- Tengine::Core::Driver.count.should == 1
71
- driver = Tengine::Core::Driver.first
72
- driver.should_not be_nil
73
- driver.name.should == "driver71"
74
- driver.version.should == "20110902213500"
75
- driver.enabled.should == true # オプション設定: 有効
76
- driver.enabled_on_activation.should == false # DSL設定: 無効
77
- driver.handlers.count.should == 1
78
- handler1 = driver.handlers.first
79
- handler1.event_type_names.should == ["event71"]
80
- Tengine::Core::HandlerPath.where(:driver_id => driver.id).count.should == 1
81
- Tengine::Core::HandlerPath.default_driver_version = "20110902213500"
82
- Tengine::Core::HandlerPath.find_handlers("event71").count.should == 1
83
- end
84
-
85
- it "DSL内の定義でイベントドライバが無効としている" do
86
- config = Tengine::Core::Config::Core.new({
87
- :tengined => {
88
- :load_path => File.expand_path('../../../../examples/uc71_driver_disabled_on_activation.rb', File.dirname(__FILE__)),
89
- :skip_enablement => true,
90
- }
91
- })
92
- kernel = Tengine::Core::Kernel.new(config)
93
- kernel.evaluate
94
- Tengine::Core::Driver.count.should == 1
95
- driver = Tengine::Core::Driver.first
96
- driver.should_not be_nil
97
- driver.name.should == "driver71"
98
- driver.version.should == "20110902213500"
99
- driver.enabled.should == false # オプション設定: 無効
100
- driver.enabled_on_activation.should == false # DSL設定: 無効
101
- driver.handlers.count.should == 1
102
- handler1 = driver.handlers.first
103
- handler1.event_type_names.should == ["event71"]
104
- Tengine::Core::HandlerPath.where(:driver_id => driver.id).count.should == 1
105
- Tengine::Core::HandlerPath.default_driver_version = "20110902213500"
106
- # driver.enable == false なので取得できないため 0 件
107
- Tengine::Core::HandlerPath.find_handlers("event71").count.should == 0
108
- end
109
- end
110
- end
111
-
112
- end
@@ -1,133 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
- require 'amqp'
4
-
5
- describe "receive_event" do
6
- before do
7
- Tengine::Core::Event.delete_all
8
- Tengine::Core::Driver.delete_all
9
- Tengine::Core::Session.delete_all
10
-
11
- # DSLのloadからbindまで
12
- @config = Tengine::Core::Config::Core.new({
13
- :tengined => {
14
- :load_path => File.expand_path('./use_event_in_handler_dsl.rb', File.dirname(__FILE__)),
15
- :wait_activation => false,
16
- :confirmation_threshold => 'info'
17
- },
18
- })
19
- @config.dsl_version.should_not be_blank
20
- @bootstrap = Tengine::Core::Bootstrap.new(@config)
21
- @bootstrap.load_dsl
22
- @kernel = Tengine::Core::Kernel.new(@config)
23
- @kernel.bind
24
-
25
- # キューの mock を生成
26
- @mock_mq = mock(:mq)
27
-
28
- @header = AMQP::Header.new(@mock_channel, nil, {
29
- :routing_key => "",
30
- :content_type => "application/octet-stream",
31
- :priority => 0,
32
- :headers => { },
33
- :timestamp => Time.now,
34
- :type => "",
35
- :delivery_tag => 1,
36
- :redelivered => false,
37
- :exchange => "tengine_event_exchange",
38
- })
39
- end
40
-
41
- it "イベントを登録できる" do
42
- # tengine_fire されるイベントオブジェクト
43
- @raw_event = Tengine::Event.new(
44
- :event_type_name => :event01,
45
- :key => "uuid1",
46
- 'source_name' => "server1",
47
- :occurred_at => Time.utc(2011,8,11,12,0),
48
- :level => "1",
49
- 'sender_name' => "server2",
50
- :properties => {:bar => "ABC", :baz => 999}
51
- )
52
-
53
- event = @kernel.parse_event(@raw_event.to_json)
54
- event.event_type_name.should == "event01"
55
- event.key.should == "uuid1"
56
- event.source_name.should == "server1"
57
- event.sender_name.should == "server2"
58
- event.level.should == "1"
59
- event.properties.should == {"bar" => "ABC", "baz" => 999}
60
-
61
- @raw_event.event_type_name.should == event.event_type_name
62
- @raw_event.key.should == event.key
63
- @raw_event.source_name.should == event.source_name
64
- @raw_event.sender_name.should == event.sender_name
65
- @raw_event.level.should == event.level
66
- @raw_event.properties.should == event.properties
67
-
68
- @kernel.save_event(event)
69
- end
70
-
71
- it "発火されたイベントを受信して登録できる" do
72
- # eventmachine と mq の mock を生成
73
- mock_sender = mock("sender")
74
- mock_sender.stub(:fire)
75
- @kernel.stub(:sender).and_return(mock_sender)
76
- @kernel.stub(:mq).and_return(@mock_mq)
77
-
78
- # subscribe 実施
79
- @raw_event = Tengine::Event.new(
80
- :event_type_name => :event01,
81
- :key => "uuid1",
82
- 'source_name' => "server1",
83
- :occurred_at => Time.utc(2011,8,11,12,0),
84
- :level => 2,
85
- 'sender_name' => "server2",
86
- :properties => {:bar => "ABC", :baz => 999}
87
- )
88
- @mock_mq.stub(:initiate_termination).and_yield
89
- @mock_mq.stub(:unsubscribe).and_yield
90
- @mock_mq.stub(:stop).and_yield
91
- @mock_mq.stub(:add_hook)
92
- @mock_mq.stub(:subscribe).with(:ack => true, :nowait => false, :confirm => an_instance_of(Proc)) do |h, b|
93
- h[:confirm].yield(mock("confirm-ok"))
94
- b.yield(@header, @raw_event.to_json)
95
- end
96
- @header.should_receive(:ack)
97
-
98
- count = lambda{ Tengine::Core::Event.where(:event_type_name => :event01, :confirmed => true).count }
99
- @kernel.should_receive(:setup_mq_connection)
100
- STDOUT.should_receive(:puts).with("uuid1:handler01")
101
- expect{ @kernel.start { @kernel.stop } }.should change(count, :call).by(1) # イベントが登録されていることを検証
102
- end
103
-
104
- it "イベントハンドラ内で取得できるイベントは発火されたイベントと同等になる", :bug => true do
105
- @header.should_receive(:ack).exactly(2)
106
-
107
- # subscribe 実施
108
- @raw_event1 = Tengine::Event.new(
109
- :event_type_name => :event01,
110
- 'source_name' => "server1",
111
- :occurred_at => Time.utc(2011,8,11,12,0),
112
- :level => 2,
113
- 'sender_name' => "server2",
114
- )
115
-
116
- # subscribe が発生した後の処理を実行
117
- STDOUT.should_receive(:puts).with("#{@raw_event1.key}:handler01")
118
- @kernel.process_message(@header, @raw_event1.to_json)
119
-
120
- @raw_event2 = Tengine::Event.new(
121
- :event_type_name => :event01,
122
- 'source_name' => "server1",
123
- :occurred_at => Time.utc(2011,8,11,12,0),
124
- :level => 2,
125
- 'sender_name' => "server2",
126
- )
127
-
128
- # subscribe が発生した後の処理を実行
129
- STDOUT.should_receive(:puts).with("#{@raw_event2.key}:handler01")
130
- @kernel.process_message(@header, @raw_event2.to_json)
131
- end
132
-
133
- end
@@ -1,12 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'tengine/core'
3
-
4
- dsl_version("0.9.7")
5
-
6
- driver :use_dsl_version_method do
7
-
8
- on:event01 do
9
- puts "using DSL version 0.9.7"
10
- end
11
-
12
- end
@@ -1,28 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
- require 'amqp'
4
-
5
- describe "receive_event" do
6
- before do
7
- Tengine::Core::Driver.delete_all
8
- Tengine::Core::HandlerPath.delete_all
9
- Tengine::Core::Session.delete_all
10
- end
11
-
12
- it "イベントを登録できる" do
13
- @config = Tengine::Core::Config::Core.new({
14
- :tengined => {
15
- :load_path => File.expand_path('./use_dsl_version_method.rb', File.dirname(__FILE__)),
16
- },
17
- })
18
- expect{
19
- @config.dsl_version.should_not be_blank
20
- @bootstrap = Tengine::Core::Bootstrap.new(@config)
21
- @kernel = @bootstrap.kernel
22
- @kernel.bind
23
- @bootstrap.load_dsl
24
- }.to change(Tengine::Core::Driver, :count).by(1)
25
- end
26
-
27
-
28
- end
@@ -1,11 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'tengine/core'
3
-
4
- driver :driver01 do
5
-
6
- # イベントに対応する処理の実行する
7
- on:event01 do
8
- puts "#{event.key}:handler01"
9
- end
10
-
11
- end
@@ -1,35 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- p1 = proc{ }
4
- filepath, lineno = *p1.source_location
5
- puts "Encoding.default_external:" << Encoding.default_external.inspect
6
- puts "Encoding.default_internal:" << Encoding.default_internal.inspect
7
-
8
- puts "__FILE__ : #{__FILE__}"
9
- puts "__FILE__.inspect : #{__FILE__.inspect}"
10
- puts "__FILE__.encoding: #{__FILE__.encoding.inspect}"
11
-
12
- puts "filepath : #{filepath}"
13
- puts "filepath.inspect : #{filepath.inspect}"
14
- puts "filepath.encoding: #{filepath.encoding.inspect}"
15
-
16
- begin
17
- encoded = filepath.encode(Encoding::UTF_8_MAC,Encoding::UTF_8)
18
- puts "encoded : #{encoded}"
19
- puts "encoded.inspect : #{encoded.inspect}"
20
- puts "encoded.encoding: #{encoded.encoding.inspect}"
21
- rescue Exception
22
- puts "#{$!.class} #{$!.message}"
23
- end
24
-
25
- f = "非ACSIIのディレクトリ名/非ASCIIのファイル名_dsl.rb"
26
- puts "f : #{f}"
27
- puts "f.inspect : #{f.inspect}"
28
- puts "f.encoding: #{f.encoding.inspect}"
29
-
30
- content = File.read(f)
31
- puts "content : #{content}"
32
- puts "content.inspect : #{content.inspect}"
33
- puts "content.encoding: #{content.encoding.inspect}"
34
-
35
- self.instance_eval(content, f)
@@ -1,38 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # puts "caller:\n " << caller.join("\n ")
4
-
5
- # p1 = proc{ }
6
- # filepath, lineno = *p1.source_location
7
- # puts "=" * 100
8
- # puts "Encoding.default_external:" << Encoding.default_external.inspect
9
- # puts "Encoding.default_internal:" << Encoding.default_internal.inspect
10
-
11
- # puts "__FILE__ : #{__FILE__}"
12
- # puts "__FILE__.inspect : #{__FILE__.inspect}"
13
- # puts "__FILE__.encoding: #{__FILE__.encoding.inspect}"
14
-
15
-
16
- # puts "filepath : #{filepath}"
17
- # puts "filepath.inspect : #{filepath.inspect}"
18
- # puts "filepath.encoding: #{filepath.encoding.inspect}"
19
-
20
- # begin
21
- # encoded = filepath.encode(Encoding::UTF_8_MAC,Encoding::UTF_8)
22
- # puts "encoded : #{encoded}"
23
- # puts "encoded.inspect : #{encoded.inspect}"
24
- # puts "encoded.encoding: #{encoded.encoding.inspect}"
25
- # rescue Exception
26
- # puts "#{$!.class} #{$!.message}"
27
- # end
28
-
29
- require 'tengine/core'
30
-
31
- driver :driver_in_multibyte_path_dir do
32
-
33
- # イベントに対して処理Aと処理Bを実行する
34
- on:event01 do
35
- puts "handler01"
36
- end
37
-
38
- end
@@ -1,35 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- p1 = proc{ }
4
- filepath, lineno = *p1.source_location
5
- puts "Encoding.default_external:" << Encoding.default_external.inspect
6
- puts "Encoding.default_internal:" << Encoding.default_internal.inspect
7
-
8
- puts "__FILE__ : #{__FILE__}"
9
- puts "__FILE__.inspect : #{__FILE__.inspect}"
10
- puts "__FILE__.encoding: #{__FILE__.encoding.inspect}"
11
-
12
- puts "filepath : #{filepath}"
13
- puts "filepath.inspect : #{filepath.inspect}"
14
- puts "filepath.encoding: #{filepath.encoding.inspect}"
15
-
16
- begin
17
- encoded = filepath.encode(Encoding::UTF_8_MAC,Encoding::UTF_8)
18
- puts "encoded : #{encoded}"
19
- puts "encoded.inspect : #{encoded.inspect}"
20
- puts "encoded.encoding: #{encoded.encoding.inspect}"
21
- rescue Exception
22
- puts "#{$!.class} #{$!.message}"
23
- end
24
-
25
- f = "非ACSIIのディレクトリ名/非ASCIIのファイル名_dsl.rb"
26
- puts "f : #{f}"
27
- puts "f.inspect : #{f.inspect}"
28
- puts "f.encoding: #{f.encoding.inspect}"
29
-
30
- content = File.read(f)
31
- puts "content : #{content}"
32
- puts "content.inspect : #{content.inspect}"
33
- puts "content.encoding: #{content.encoding.inspect}"
34
-
35
- self.instance_eval(content, f)
@@ -1,38 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # puts "caller:\n " << caller.join("\n ")
4
-
5
- # p1 = proc{ }
6
- # filepath, lineno = *p1.source_location
7
- # puts "=" * 100
8
- # puts "Encoding.default_external:" << Encoding.default_external.inspect
9
- # puts "Encoding.default_internal:" << Encoding.default_internal.inspect
10
-
11
- # puts "__FILE__ : #{__FILE__}"
12
- # puts "__FILE__.inspect : #{__FILE__.inspect}"
13
- # puts "__FILE__.encoding: #{__FILE__.encoding.inspect}"
14
-
15
-
16
- # puts "filepath : #{filepath}"
17
- # puts "filepath.inspect : #{filepath.inspect}"
18
- # puts "filepath.encoding: #{filepath.encoding.inspect}"
19
-
20
- # begin
21
- # encoded = filepath.encode(Encoding::UTF_8_MAC,Encoding::UTF_8)
22
- # puts "encoded : #{encoded}"
23
- # puts "encoded.inspect : #{encoded.inspect}"
24
- # puts "encoded.encoding: #{encoded.encoding.inspect}"
25
- # rescue Exception
26
- # puts "#{$!.class} #{$!.message}"
27
- # end
28
-
29
- require 'tengine/core'
30
-
31
- driver :driver_in_multibyte_path_dir do
32
-
33
- # イベントに対して処理Aと処理Bを実行する
34
- on:event01 do
35
- puts "handler01"
36
- end
37
-
38
- end