Module: Filezor::Server::ClassMethods
- Included in:
- Filezor::Server
- Defined in:
- lib/filezor/server.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
Returns the value of attribute root.
Instance Method Summary collapse
- #authenticate(user, pwd) ⇒ Object
- #caching ⇒ Object
- #caching=(caching) ⇒ Object
- #password ⇒ Object
- #password=(pwd) ⇒ Object
- #password_file ⇒ Object
-
#start_embedded!(root, password) ⇒ Object
Helpful for testing clients.
Instance Attribute Details
#root ⇒ Object
Returns the value of attribute root.
149 150 151 |
# File 'lib/filezor/server.rb', line 149 def root @root end |
Instance Method Details
#authenticate(user, pwd) ⇒ Object
163 164 165 166 |
# File 'lib/filezor/server.rb', line 163 def authenticate(user, pwd) # puts "#{pwd} == #{password}" pwd == password end |
#caching ⇒ Object
151 152 153 |
# File 'lib/filezor/server.rb', line 151 def caching !!@caching end |
#caching=(caching) ⇒ Object
159 160 161 |
# File 'lib/filezor/server.rb', line 159 def caching=(caching) @caching = caching end |
#password ⇒ Object
168 169 170 171 172 173 174 175 |
# File 'lib/filezor/server.rb', line 168 def password @password ||= begin tmp = File.exists?(password_file) ? File.read(password_file) : "default" tmp end end |
#password=(pwd) ⇒ Object
177 178 179 180 |
# File 'lib/filezor/server.rb', line 177 def password=(pwd) File.open(password_file, "w") {|f| f.print(pwd) } @password = pwd end |
#password_file ⇒ Object
182 183 184 |
# File 'lib/filezor/server.rb', line 182 def password_file File.join(root, ".password") end |
#start_embedded!(root, password) ⇒ Object
Helpful for testing clients
187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/filezor/server.rb', line 187 def (root, password) ppid = Process.pid Filezor::Server.root = root Filezor::Server.password = password fork do harikari(ppid) STDOUT.reopen("/dev/null") Filezor::Server.run! end sleep 1 end |