cfrederick-titanium 0.5.2 → 0.5.3
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.
- data/README.rdoc +6 -2
- data/lib/server.rb +1 -1
- data/lib/sqlite_adapter.rb +5 -2
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -61,10 +61,14 @@ Create an <tt>index.html</tt> file in the <tt>myapp/public</tt> folder.
|
|
61
61
|
|
62
62
|
Create a rackup file at <tt>myapp/config.ru</tt> with the following contents. This file is used to tell
|
63
63
|
the titanium server where the web application resides. <em>Make sure to use the full path to the
|
64
|
-
<tt>myapp/public</tt> folder.</em>
|
64
|
+
<tt>myapp/public</tt> folder, and make sure to always use forward slashes.</em>
|
65
65
|
require 'titanium'
|
66
66
|
run Titanium::Server.new("/var/www/myapp/public")
|
67
|
-
|
67
|
+
|
68
|
+
Or, for Windows
|
69
|
+
require 'titanium'
|
70
|
+
run Titanium::Server.new("c:/www/myapp/public")
|
71
|
+
|
68
72
|
Download and install Ruby[http://www.ruby-lang.org] at http://www.ruby-lang.org/en/downloads.
|
69
73
|
|
70
74
|
Download and install SQLite3[http://sqlite.org] for Ruby. Typically this involves downloading
|
data/lib/server.rb
CHANGED
@@ -111,7 +111,7 @@ module Titanium
|
|
111
111
|
|
112
112
|
# Forms a static file path from the request's path information.
|
113
113
|
def get_static_path_from_request
|
114
|
-
"#{@app_root}#{@request.path_info}"
|
114
|
+
File.expand_path("#{@app_root}#{@request.path_info}")
|
115
115
|
end
|
116
116
|
|
117
117
|
# Serves a 400 status code.
|
data/lib/sqlite_adapter.rb
CHANGED
@@ -20,6 +20,7 @@
|
|
20
20
|
|
21
21
|
require 'rubygems'
|
22
22
|
require 'time'
|
23
|
+
require 'ftools'
|
23
24
|
require 'sqlite3'
|
24
25
|
|
25
26
|
include SQLite3
|
@@ -30,14 +31,16 @@ module Titanium
|
|
30
31
|
attr_reader :db_file
|
31
32
|
|
32
33
|
def initialize
|
33
|
-
@
|
34
|
+
@data_dir = File.expand_path("~/.titanium/data")
|
35
|
+
@db_file = File.expand_path(File.join(@data_dir, "#{environment}.db"))
|
34
36
|
end
|
35
37
|
|
36
38
|
def erase_db
|
37
|
-
File.delete(
|
39
|
+
File.delete(@db_file)
|
38
40
|
end
|
39
41
|
|
40
42
|
def connect
|
43
|
+
File.makedirs(@data_dir)
|
41
44
|
@db = Database.new(@db_file)
|
42
45
|
@db.results_as_hash = true
|
43
46
|
end
|