Class: ClWiki::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/cl_wiki/configuration.rb

Constant Summary collapse

USE_INDEX_NO =
0
USE_INDEX_DRB =
1
USE_INDEX_LOCAL =
2

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ Configuration

Returns a new instance of Configuration.



120
121
122
123
124
# File 'lib/cl_wiki/configuration.rb', line 120

def initialize(hash={})
  default_hash.merge(hash).each do |k, v|
    instance_variable_set(:"@#{k.to_s}", v)
  end
end

Instance Attribute Details

#cgifnObject

Returns the value of attribute cgifn.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def cgifn
  @cgifn
end

#cgifn_from_rssObject

Returns the value of attribute cgifn_from_rss.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def cgifn_from_rss
  @cgifn_from_rss
end

#cssHrefObject

Returns the value of attribute cssHref.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def cssHref
  @cssHref
end

#custom_formatter_load_pathObject (readonly)

Returns the value of attribute custom_formatter_load_path.



16
17
18
# File 'lib/cl_wiki/configuration.rb', line 16

def custom_formatter_load_path
  @custom_formatter_load_path
end

#global_editsObject

Returns the value of attribute global_edits.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def global_edits
  @global_edits
end

#index_log_fnObject

Returns the value of attribute index_log_fn.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def index_log_fn
  @index_log_fn
end

#indexPortObject

Returns the value of attribute indexPort.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def indexPort
  @indexPort
end

#page_update_formatObject

Returns the value of attribute page_update_format.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def page_update_format
  @page_update_format
end

#publishTagObject

Returns the value of attribute publishTag.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def publishTag
  @publishTag
end

#stats_nameObject

Returns the value of attribute stats_name.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def stats_name
  @stats_name
end

#templateObject

Returns the value of attribute template.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def template
  @template
end

#url_prefixObject

Returns the value of attribute url_prefix.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def url_prefix
  @url_prefix
end

#useGmtObject

Returns the value of attribute useGmt.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def useGmt
  @useGmt
end

#wiki_pathObject

Returns the value of attribute wiki_path.



13
14
15
# File 'lib/cl_wiki/configuration.rb', line 13

def wiki_path
  @wiki_path
end

Class Method Details

.load(filename = $defaultConfFile) ⇒ Object



114
115
116
117
118
# File 'lib/cl_wiki/configuration.rb', line 114

def self.load(filename=$defaultConfFile)
  $wiki_conf = self.new(YAML::load(::File.open(filename)))
  $wiki_path = $wiki_conf.wiki_path
  $wiki_conf
end

Instance Method Details

#access_log_indexObject



69
70
71
# File 'lib/cl_wiki/configuration.rb', line 69

def access_log_index
  @access_log_index
end

#access_log_index=(value) ⇒ Object



73
74
75
76
77
78
79
# File 'lib/cl_wiki/configuration.rb', line 73

def access_log_index=(value)
  if value.class == String
    @access_log_index = (value =~ /true/i)
  else
    @access_log_index = value
  end
end

#default_hashObject



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/cl_wiki/configuration.rb', line 126

def default_hash
  {
      :url_prefix => '/',
      :indexPort => ClWiki::Indexer.defaultPort,
      :cgifn => 'clwikicgi.rb',
      :default_recent_changes_name => "Recent Changes",
      :recent_changes_name => "Recent Changes",
      :stats_name => "Hit Counts",
      :useGmt => false,
      :publishTag => nil,
      :useIndexForPageExists => false,
      :showSourceLink => false,
      :cgifn_from_rss => 'blogki.rb',
      :edit_rows => 25,
      :edit_cols => 80,
      :access_log_index => false,
      :index_log_fn => nil,
      :custom_formatter_load_path => []
  }
end

#default_recent_changes_nameObject



154
155
156
# File 'lib/cl_wiki/configuration.rb', line 154

def default_recent_changes_name
  @default_recent_changes_name
end

#default_recent_changes_name=(value) ⇒ Object



147
148
149
150
151
152
# File 'lib/cl_wiki/configuration.rb', line 147

def default_recent_changes_name=(value)
  if @recent_changes_name == @default_recent_changes_name
    @recent_changes_name = value
  end
  @default_recent_changes_name = default_recent_changes_name
end

#edit_colsObject



49
50
51
# File 'lib/cl_wiki/configuration.rb', line 49

def edit_cols
  @edit_cols
end

#edit_cols=(value) ⇒ Object



53
54
55
# File 'lib/cl_wiki/configuration.rb', line 53

def edit_cols=(value)
  @edit_cols = value.to_i
end

#edit_rowsObject



41
42
43
# File 'lib/cl_wiki/configuration.rb', line 41

def edit_rows
  @edit_rows
end

#edit_rows=(value) ⇒ Object



45
46
47
# File 'lib/cl_wiki/configuration.rb', line 45

def edit_rows=(value)
  @edit_rows = value.to_i
end

#editableObject



90
91
92
# File 'lib/cl_wiki/configuration.rb', line 90

def editable
  @editable
end

#editable=(value) ⇒ Object



94
95
96
97
98
99
100
# File 'lib/cl_wiki/configuration.rb', line 94

def editable=(value)
  if value.class == String
    @editable = (value =~ /true/i)
  else
    @editable = value
  end
end

#override_access_log_indexObject



81
82
83
84
# File 'lib/cl_wiki/configuration.rb', line 81

def override_access_log_index
  @orig_access_log_index_value = @access_log_index
  @access_log_index = false
end

#recentChangesNameObject Also known as: recent_changes_name



165
166
167
# File 'lib/cl_wiki/configuration.rb', line 165

def recentChangesName
  @recent_changes_name
end

#recentChangesName=(value) ⇒ Object Also known as: recent_changes_name=



158
159
160
161
# File 'lib/cl_wiki/configuration.rb', line 158

def recentChangesName=(value)
  @recent_changes_name = value
  @recent_changes_name = @default_recent_changes_name if @recent_changes_name.empty?
end

#restore_access_log_indexObject



86
87
88
# File 'lib/cl_wiki/configuration.rb', line 86

def restore_access_log_index
  @access_log_index = @orig_access_log_index_value if @orig_access_log_index_value
end


102
103
104
# File 'lib/cl_wiki/configuration.rb', line 102

def showSourceLink
  @showSourceLink
end

#showSourceLink=(value) ⇒ Object



106
107
108
109
110
111
112
# File 'lib/cl_wiki/configuration.rb', line 106

def showSourceLink=(value)
  if value.class == String
    @showSourceLink = (value =~ /true/i)
  else
    @showSourceLink = value
  end
end

#useIndexObject



33
34
35
# File 'lib/cl_wiki/configuration.rb', line 33

def useIndex
  @useIndex
end

#useIndex=(value) ⇒ Object



37
38
39
# File 'lib/cl_wiki/configuration.rb', line 37

def useIndex=(value)
  @useIndex = value.to_i
end

#useIndexForPageExistsObject



57
58
59
# File 'lib/cl_wiki/configuration.rb', line 57

def useIndexForPageExists
  @useIndexForPageExists
end

#useIndexForPageExists=(value) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/cl_wiki/configuration.rb', line 61

def useIndexForPageExists=(value)
  if value.class == String
    @useIndexForPageExists = (value =~ /true/i)
  else
    @useIndexForPageExists = value
  end
end

#wait_on_thread(thread) ⇒ Object



28
29
30
31
# File 'lib/cl_wiki/configuration.rb', line 28

def wait_on_thread(thread)
  @threads = [] if !@threads
  @threads << thread
end

#wait_on_threadsObject



18
19
20
21
22
23
24
25
26
# File 'lib/cl_wiki/configuration.rb', line 18

def wait_on_threads
  # Ruby kills any threads as soon as the main process is done. Any
  # threads created should be registered here. The last
  # line of the CGI script should call out to wait_on_threads to make
  # sure nothing running async in the background is terminated too early
  @threads.each do |thread|
    thread.join
  end if !@threads.nil?
end