Class: Wiki2Go::Configuration
- Inherits:
-
Object
- Object
- Wiki2Go::Configuration
- Defined in:
- lib/Wiki2Go/Install/make_site.rb
Instance Attribute Summary collapse
-
#cgi_options ⇒ Object
readonly
Returns the value of attribute cgi_options.
-
#default_wiki ⇒ Object
Returns the value of attribute default_wiki.
-
#directory ⇒ Object
Returns the value of attribute directory.
-
#port ⇒ Object
Returns the value of attribute port.
-
#server ⇒ Object
Returns the value of attribute server.
-
#source_dir ⇒ Object
readonly
Returns the value of attribute source_dir.
-
#subsite ⇒ Object
Returns the value of attribute subsite.
-
#type ⇒ Object
Returns the value of attribute type.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #dotted_port ⇒ Object
-
#existing_configuration ⇒ Object
Return a Wiki2GoConfig object, if there is a CgiOptions.rb file Returns nil if no configuration could be read.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #read_existing_configuration ⇒ Object
- #server_at(url) ⇒ Object
- #server_url ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 45 def initialize @user = WebUser.new(nil,nil) @server = 'localhost' @port = '80' @default_wiki = '' @directory = Dir.getwd @type = nil @source_dir = File.(File.dirname(__FILE__)) @subsite = '' end |
Instance Attribute Details
#cgi_options ⇒ Object (readonly)
Returns the value of attribute cgi_options.
43 44 45 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 43 def @cgi_options end |
#default_wiki ⇒ Object
Returns the value of attribute default_wiki.
38 39 40 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 38 def default_wiki @default_wiki end |
#directory ⇒ Object
Returns the value of attribute directory.
39 40 41 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 39 def directory @directory end |
#port ⇒ Object
Returns the value of attribute port.
37 38 39 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 37 def port @port end |
#server ⇒ Object
Returns the value of attribute server.
36 37 38 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 36 def server @server end |
#source_dir ⇒ Object (readonly)
Returns the value of attribute source_dir.
41 42 43 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 41 def source_dir @source_dir end |
#subsite ⇒ Object
Returns the value of attribute subsite.
42 43 44 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 42 def subsite @subsite end |
#type ⇒ Object
Returns the value of attribute type.
40 41 42 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 40 def type @type end |
#user ⇒ Object
Returns the value of attribute user.
35 36 37 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 35 def user @user end |
Instance Method Details
#dotted_port ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 86 def dotted_port if @port.nil? || @port.empty? then ':80' else ':' + @port end end |
#existing_configuration ⇒ Object
Return a Wiki2GoConfig object, if there is a CgiOptions.rb file Returns nil if no configuration could be read
58 59 60 61 62 63 64 65 66 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 58 def existing_configuration configfile = File.join(@directory,'site','scripts','CgiOptions.rb') if File.exists?(configfile) then load configfile @cgi_options = CgiOptions.new return @cgi_options end return nil end |
#read_existing_configuration ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 68 def read_existing_configuration config = existing_configuration unless config.nil? then if @type.nil? then @type = Configuration.type_of(config) end if @user.user.nil? then @user.user = config.user if config.respond_to?(:user) end if @user.group.nil? || @user.group.empty? then @user.group = (config.respond_to?(:group) ? config.group : nil) end end end |
#server_at(url) ⇒ Object
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 102 def server_at(url) uri = URI::parse(url) if uri.scheme.nil? then @server = url else @server = uri.host @subsite = uri.path @port = uri.port.to_s end end |
#server_url ⇒ Object
94 95 96 97 98 99 100 |
# File 'lib/Wiki2Go/Install/make_site.rb', line 94 def server_url if @port.nil? || @port.empty? || @port == '80' then server else server + dotted_port end end |