Class: Grntest::ExecutionContext
- Inherits:
-
Object
- Object
- Grntest::ExecutionContext
- Defined in:
- lib/grntest/execution-context.rb
Instance Attribute Summary collapse
-
#abort_tag ⇒ Object
Returns the value of attribute abort_tag.
-
#base_directory ⇒ Object
Returns the value of attribute base_directory.
-
#benchmarks ⇒ Object
Returns the value of attribute benchmarks.
-
#collect_query_log ⇒ Object
writeonly
Sets the attribute collect_query_log.
-
#db_path ⇒ Object
Returns the value of attribute db_path.
-
#debug ⇒ Object
writeonly
Sets the attribute debug.
-
#default_read_timeout ⇒ Object
Returns the value of attribute default_read_timeout.
-
#default_timeout ⇒ Object
Returns the value of attribute default_timeout.
-
#groonga_suggest_create_dataset ⇒ Object
Returns the value of attribute groonga_suggest_create_dataset.
-
#groonga_synonym_generate ⇒ Object
Returns the value of attribute groonga_synonym_generate.
-
#input_type ⇒ Object
Returns the value of attribute input_type.
-
#interface ⇒ Object
Returns the value of attribute interface.
-
#logging ⇒ Object
writeonly
Sets the attribute logging.
-
#on_error ⇒ Object
Returns the value of attribute on_error.
-
#output_type ⇒ Object
Returns the value of attribute output_type.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#plugin_extension ⇒ Object
Returns the value of attribute plugin_extension.
-
#plugins_directory ⇒ Object
Returns the value of attribute plugins_directory.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#result ⇒ Object
Returns the value of attribute result.
-
#shutdown_wait_timeout ⇒ Object
Returns the value of attribute shutdown_wait_timeout.
-
#suppress_backtrace ⇒ Object
writeonly
Sets the attribute suppress_backtrace.
-
#temporary_directory_path ⇒ Object
Returns the value of attribute temporary_directory_path.
-
#testee ⇒ Object
Returns the value of attribute testee.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#use_http_chunked ⇒ Object
writeonly
Sets the attribute use_http_chunked.
-
#use_http_post ⇒ Object
writeonly
Sets the attribute use_http_post.
Instance Method Summary collapse
- #abort ⇒ Object
- #close_logs ⇒ Object
- #collect_query_log? ⇒ Boolean
- #debug? ⇒ Boolean
- #error ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ ExecutionContext
constructor
A new instance of ExecutionContext.
- #libtool_directory ⇒ Object
- #log ⇒ Object
- #log_path ⇒ Object
- #logging? ⇒ Boolean
- #omit ⇒ Object
- #omitted? ⇒ Boolean
- #query_log ⇒ Object
- #query_log_path ⇒ Object
- #relative_db_path ⇒ Object
- #suppress_backtrace? ⇒ Boolean
- #top_level? ⇒ Boolean
- #use_http_chunked? ⇒ Boolean
- #use_http_post? ⇒ Boolean
Constructor Details
#initialize ⇒ ExecutionContext
Returns a new instance of ExecutionContext.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/grntest/execution-context.rb', line 43 def initialize @logging = true @base_directory = Pathname(".") @temporary_directory_path = Pathname("tmp") @db_path = Pathname("db") @plugins_directory = nil @plugin_extension = guess_plugin_extension @groonga_suggest_create_dataset = "groonga-suggest-create-dataset" @groonga_synonym_generate = "groonga-synonym-generate" @testee = "groonga" @interface = "stdio" @n_nested = 0 @result = [] @use_http_post = false @use_http_chunked = false @input_type = "json" @output_type = "json" @log = nil @query_log = nil @on_error = :default @abort_tag = nil @timeout = 0 @read_timeout = 5 @default_timeout = @timeout @default_read_timeout = @read_timeout @shutdown_wait_timeout = 5 @omitted = false @suppress_backtrace = true @collect_query_log = false @debug = false @platform = guess_platform @benchmarks = [] end |
Instance Attribute Details
#abort_tag ⇒ Object
Returns the value of attribute abort_tag.
32 33 34 |
# File 'lib/grntest/execution-context.rb', line 32 def abort_tag @abort_tag end |
#base_directory ⇒ Object
Returns the value of attribute base_directory.
19 20 21 |
# File 'lib/grntest/execution-context.rb', line 19 def base_directory @base_directory end |
#benchmarks ⇒ Object
Returns the value of attribute benchmarks.
42 43 44 |
# File 'lib/grntest/execution-context.rb', line 42 def benchmarks @benchmarks end |
#collect_query_log=(value) ⇒ Object (writeonly)
Sets the attribute collect_query_log
39 40 41 |
# File 'lib/grntest/execution-context.rb', line 39 def collect_query_log=(value) @collect_query_log = value end |
#db_path ⇒ Object
Returns the value of attribute db_path.
19 20 21 |
# File 'lib/grntest/execution-context.rb', line 19 def db_path @db_path end |
#debug=(value) ⇒ Object (writeonly)
Sets the attribute debug
40 41 42 |
# File 'lib/grntest/execution-context.rb', line 40 def debug=(value) @debug = value end |
#default_read_timeout ⇒ Object
Returns the value of attribute default_read_timeout.
36 37 38 |
# File 'lib/grntest/execution-context.rb', line 36 def default_read_timeout @default_read_timeout end |
#default_timeout ⇒ Object
Returns the value of attribute default_timeout.
35 36 37 |
# File 'lib/grntest/execution-context.rb', line 35 def default_timeout @default_timeout end |
#groonga_suggest_create_dataset ⇒ Object
Returns the value of attribute groonga_suggest_create_dataset.
22 23 24 |
# File 'lib/grntest/execution-context.rb', line 22 def groonga_suggest_create_dataset @groonga_suggest_create_dataset end |
#groonga_synonym_generate ⇒ Object
Returns the value of attribute groonga_synonym_generate.
23 24 25 |
# File 'lib/grntest/execution-context.rb', line 23 def groonga_synonym_generate @groonga_synonym_generate end |
#input_type ⇒ Object
Returns the value of attribute input_type.
29 30 31 |
# File 'lib/grntest/execution-context.rb', line 29 def input_type @input_type end |
#interface ⇒ Object
Returns the value of attribute interface.
25 26 27 |
# File 'lib/grntest/execution-context.rb', line 25 def interface @interface end |
#logging=(value) ⇒ Object (writeonly)
Sets the attribute logging
18 19 20 |
# File 'lib/grntest/execution-context.rb', line 18 def logging=(value) @logging = value end |
#on_error ⇒ Object
Returns the value of attribute on_error.
31 32 33 |
# File 'lib/grntest/execution-context.rb', line 31 def on_error @on_error end |
#output_type ⇒ Object
Returns the value of attribute output_type.
30 31 32 |
# File 'lib/grntest/execution-context.rb', line 30 def output_type @output_type end |
#platform ⇒ Object
Returns the value of attribute platform.
41 42 43 |
# File 'lib/grntest/execution-context.rb', line 41 def platform @platform end |
#plugin_extension ⇒ Object
Returns the value of attribute plugin_extension.
21 22 23 |
# File 'lib/grntest/execution-context.rb', line 21 def plugin_extension @plugin_extension end |
#plugins_directory ⇒ Object
Returns the value of attribute plugins_directory.
20 21 22 |
# File 'lib/grntest/execution-context.rb', line 20 def plugins_directory @plugins_directory end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
34 35 36 |
# File 'lib/grntest/execution-context.rb', line 34 def read_timeout @read_timeout end |
#result ⇒ Object
Returns the value of attribute result.
26 27 28 |
# File 'lib/grntest/execution-context.rb', line 26 def result @result end |
#shutdown_wait_timeout ⇒ Object
Returns the value of attribute shutdown_wait_timeout.
37 38 39 |
# File 'lib/grntest/execution-context.rb', line 37 def shutdown_wait_timeout @shutdown_wait_timeout end |
#suppress_backtrace=(value) ⇒ Object (writeonly)
Sets the attribute suppress_backtrace
38 39 40 |
# File 'lib/grntest/execution-context.rb', line 38 def suppress_backtrace=(value) @suppress_backtrace = value end |
#temporary_directory_path ⇒ Object
Returns the value of attribute temporary_directory_path.
19 20 21 |
# File 'lib/grntest/execution-context.rb', line 19 def temporary_directory_path @temporary_directory_path end |
#testee ⇒ Object
Returns the value of attribute testee.
24 25 26 |
# File 'lib/grntest/execution-context.rb', line 24 def testee @testee end |
#timeout ⇒ Object
Returns the value of attribute timeout.
33 34 35 |
# File 'lib/grntest/execution-context.rb', line 33 def timeout @timeout end |
#use_http_chunked=(value) ⇒ Object (writeonly)
Sets the attribute use_http_chunked
28 29 30 |
# File 'lib/grntest/execution-context.rb', line 28 def use_http_chunked=(value) @use_http_chunked = value end |
#use_http_post=(value) ⇒ Object (writeonly)
Sets the attribute use_http_post
27 28 29 |
# File 'lib/grntest/execution-context.rb', line 27 def use_http_post=(value) @use_http_post = value end |
Instance Method Details
#abort ⇒ Object
157 158 159 |
# File 'lib/grntest/execution-context.rb', line 157 def abort throw @abort_tag end |
#close_logs ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/grntest/execution-context.rb', line 161 def close_logs if @log @log.close @log = nil end if @query_log @query_log.close @query_log = nil end end |
#collect_query_log? ⇒ Boolean
93 94 95 |
# File 'lib/grntest/execution-context.rb', line 93 def collect_query_log? @collect_query_log end |
#debug? ⇒ Boolean
97 98 99 |
# File 'lib/grntest/execution-context.rb', line 97 def debug? @debug end |
#error ⇒ Object
145 146 147 148 149 150 |
# File 'lib/grntest/execution-context.rb', line 145 def error case @on_error when :omit omit end end |
#execute ⇒ Object
101 102 103 104 105 106 |
# File 'lib/grntest/execution-context.rb', line 101 def execute @n_nested += 1 yield ensure @n_nested -= 1 end |
#libtool_directory ⇒ Object
132 133 134 135 136 137 138 139 |
# File 'lib/grntest/execution-context.rb', line 132 def libtool_directory @plugins_directory.find do |sub_path| if sub_path.directory? and sub_path.basename.to_s == ".libs" return ".libs/" end end "" end |
#log ⇒ Object
116 117 118 |
# File 'lib/grntest/execution-context.rb', line 116 def log @log ||= File.open(log_path.to_s, "a+") end |
#log_path ⇒ Object
112 113 114 |
# File 'lib/grntest/execution-context.rb', line 112 def log_path @temporary_directory_path + "groonga.log" end |
#logging? ⇒ Boolean
77 78 79 |
# File 'lib/grntest/execution-context.rb', line 77 def logging? @logging end |
#omit ⇒ Object
152 153 154 155 |
# File 'lib/grntest/execution-context.rb', line 152 def omit @omitted = true abort end |
#omitted? ⇒ Boolean
141 142 143 |
# File 'lib/grntest/execution-context.rb', line 141 def omitted? @omitted end |
#query_log ⇒ Object
124 125 126 |
# File 'lib/grntest/execution-context.rb', line 124 def query_log @query_log ||= File.open(query_log_path.to_s, "a+") end |
#query_log_path ⇒ Object
120 121 122 |
# File 'lib/grntest/execution-context.rb', line 120 def query_log_path @temporary_directory_path + "groonga.query.log" end |
#relative_db_path ⇒ Object
128 129 130 |
# File 'lib/grntest/execution-context.rb', line 128 def relative_db_path @db_path.relative_path_from(@temporary_directory_path) end |
#suppress_backtrace? ⇒ Boolean
89 90 91 |
# File 'lib/grntest/execution-context.rb', line 89 def suppress_backtrace? @suppress_backtrace or debug? end |
#top_level? ⇒ Boolean
108 109 110 |
# File 'lib/grntest/execution-context.rb', line 108 def top_level? @n_nested == 1 end |
#use_http_chunked? ⇒ Boolean
85 86 87 |
# File 'lib/grntest/execution-context.rb', line 85 def use_http_chunked? @use_http_chunked end |
#use_http_post? ⇒ Boolean
81 82 83 |
# File 'lib/grntest/execution-context.rb', line 81 def use_http_post? @use_http_post end |