tap-server 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/History CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.1.1 / 2009-02-23
2
+
3
+ Update executable to use Tap-0.12.2.
4
+
1
5
  == 0.1.0 / 2009-02-17
2
6
 
3
7
  As of the 0.12.0 release, Tap is distributed as several independent modules.
@@ -44,7 +44,7 @@ class AppController < Tap::Controller
44
44
  # Currently tail is hard-coded to tail the server log only.
45
45
  def tail(id=nil)
46
46
  begin
47
- path = app.subpath(:log, 'server.log')
47
+ path = root.subpath(:log, 'server.log')
48
48
  raise unless File.exists?(path)
49
49
  rescue
50
50
  raise Tap::ServerError.new("invalid path", 404)
@@ -204,7 +204,7 @@ class SchemaController < Tap::Controller
204
204
  end
205
205
 
206
206
  def initialize_schema
207
- current = app.glob(:schema, "*").collect {|path| File.basename(path).chomp(".yml") }
207
+ current = root.glob(:schema, "*").collect {|path| File.basename(path).chomp(".yml") }
208
208
 
209
209
  id = random_key(current.length)
210
210
  while current.include?(id)
@@ -216,7 +216,7 @@ class SchemaController < Tap::Controller
216
216
  end
217
217
 
218
218
  def load_schema(id)
219
- unless path = app.filepath(:schema, "#{id}.yml")
219
+ unless path = root.filepath(:schema, "#{id}.yml")
220
220
  raise ServerError, "no schema for id: #{id}"
221
221
  end
222
222
  schema = Tap::Support::Schema.load_file(path)
@@ -231,8 +231,8 @@ class SchemaController < Tap::Controller
231
231
  end
232
232
 
233
233
  def dump_schema(id, schema=nil)
234
- app.prepare(:schema, "#{id}.yml") do |file|
235
- file << schema.dump.to_yaml if schema
234
+ root.prepare(:schema, "#{id}.yml") do |file|
235
+ file << YAML.dump(schema.dump) if schema
236
236
  end
237
237
  end
238
238
 
@@ -223,6 +223,11 @@ module Tap
223
223
  server.app(session[:id] ||= server.initialize_session)
224
224
  end
225
225
 
226
+ # Returns the root for the current session.
227
+ def root
228
+ server.root(session[:id] ||= server.initialize_session)
229
+ end
230
+
226
231
  # Generates an empty binding to self without any locals assigned.
227
232
  def empty_binding # :nodoc:
228
233
  binding
@@ -94,7 +94,7 @@ module Tap
94
94
  def initialize_session
95
95
  id = 0
96
96
  session_app = app(id)
97
- log_path = session_app.prepare(:log, 'server.log')
97
+ log_path = env.root.prepare(:log, 'server.log')
98
98
  session_app.logger = Logger.new(log_path)
99
99
 
100
100
  session_app.on_complete do |_result|
@@ -112,7 +112,7 @@ module Tap
112
112
 
113
113
  if template
114
114
  extname = File.extname(template)
115
- session_app.prepare(:results, id.to_s, "#{class_name}#{extname}") do |file|
115
+ env.root.prepare(:results, id.to_s, "#{class_name}#{extname}") do |file|
116
116
  file << Support::Templater.new(File.read(template)).build(:_result => _result)
117
117
  end
118
118
  end
@@ -128,6 +128,13 @@ module Tap
128
128
  @app
129
129
  end
130
130
 
131
+ # Returns the env.root provided during initialization. In the future this
132
+ # method may be extended to provide a session-specific Root, hence it
133
+ # has been stubbed with an id input.
134
+ def root(id=nil)
135
+ @env.root
136
+ end
137
+
131
138
  # Returns true if environment is :development.
132
139
  def development?
133
140
  environment == :development
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tap-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Chiang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-17 00:00:00 -07:00
12
+ date: 2009-02-23 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.12.0
23
+ version: 0.12.2
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rack