bougyman-autumn 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +11 -0
- data/CHANGELOG +511 -0
- data/MANIFEST +109 -0
- data/README +1141 -0
- data/README.textile +1175 -0
- data/Rakefile +75 -0
- data/autumn.gemspec +43 -0
- data/bin/autumn +11 -0
- data/lib/autumn/authentication.rb +238 -0
- data/lib/autumn/channel_leaf.rb +107 -0
- data/lib/autumn/coder.rb +166 -0
- data/lib/autumn/console_boot.rb +10 -0
- data/lib/autumn/ctcp.rb +250 -0
- data/lib/autumn/daemon.rb +207 -0
- data/lib/autumn/datamapper_hacks.rb +290 -0
- data/lib/autumn/foliater.rb +231 -0
- data/lib/autumn/formatting.rb +236 -0
- data/lib/autumn/generator.rb +231 -0
- data/lib/autumn/genesis.rb +190 -0
- data/lib/autumn/inheritable_attributes.rb +162 -0
- data/lib/autumn/leaf.rb +738 -0
- data/lib/autumn/log_facade.rb +49 -0
- data/lib/autumn/misc.rb +87 -0
- data/lib/autumn/resources/daemons/Anothernet.yml +3 -0
- data/lib/autumn/resources/daemons/AustHex.yml +29 -0
- data/lib/autumn/resources/daemons/Bahamut.yml +67 -0
- data/lib/autumn/resources/daemons/Dancer.yml +3 -0
- data/lib/autumn/resources/daemons/GameSurge.yml +3 -0
- data/lib/autumn/resources/daemons/IRCnet.yml +3 -0
- data/lib/autumn/resources/daemons/Ithildin.yml +7 -0
- data/lib/autumn/resources/daemons/KineIRCd.yml +56 -0
- data/lib/autumn/resources/daemons/PTlink.yml +6 -0
- data/lib/autumn/resources/daemons/QuakeNet.yml +20 -0
- data/lib/autumn/resources/daemons/RFC1459.yml +158 -0
- data/lib/autumn/resources/daemons/RFC2811.yml +16 -0
- data/lib/autumn/resources/daemons/RFC2812.yml +36 -0
- data/lib/autumn/resources/daemons/RatBox.yml +25 -0
- data/lib/autumn/resources/daemons/Ultimate.yml +24 -0
- data/lib/autumn/resources/daemons/Undernet.yml +6 -0
- data/lib/autumn/resources/daemons/Unreal.yml +110 -0
- data/lib/autumn/resources/daemons/_Other.yml +7 -0
- data/lib/autumn/resources/daemons/aircd.yml +33 -0
- data/lib/autumn/resources/daemons/bdq-ircd.yml +3 -0
- data/lib/autumn/resources/daemons/hybrid.yml +38 -0
- data/lib/autumn/resources/daemons/ircu.yml +67 -0
- data/lib/autumn/resources/daemons/tr-ircd.yml +8 -0
- data/lib/autumn/script.rb +74 -0
- data/lib/autumn/speciator.rb +165 -0
- data/lib/autumn/stem.rb +919 -0
- data/lib/autumn/stem_facade.rb +176 -0
- data/lib/autumn/tool/bin.rb +302 -0
- data/lib/autumn/tool/create.rb +48 -0
- data/lib/autumn/tool/project_creator.rb +110 -0
- data/lib/autumn/version.rb +3 -0
- data/lib/autumn.rb +6 -0
- data/lib/skel/Rakefile +135 -0
- data/lib/skel/config/global.yml +2 -0
- data/lib/skel/config/seasons/testing/database.yml +4 -0
- data/lib/skel/config/seasons/testing/leaves.yml +9 -0
- data/lib/skel/config/seasons/testing/season.yml +2 -0
- data/lib/skel/config/seasons/testing/stems.yml +10 -0
- data/lib/skel/leaves/administrator/README +20 -0
- data/lib/skel/leaves/administrator/controller.rb +67 -0
- data/lib/skel/leaves/administrator/views/autumn.txt.erb +1 -0
- data/lib/skel/leaves/administrator/views/reload.txt.erb +11 -0
- data/lib/skel/leaves/insulter/README +17 -0
- data/lib/skel/leaves/insulter/controller.rb +65 -0
- data/lib/skel/leaves/insulter/views/about.txt.erb +1 -0
- data/lib/skel/leaves/insulter/views/help.txt.erb +1 -0
- data/lib/skel/leaves/insulter/views/insult.txt.erb +1 -0
- data/lib/skel/leaves/scorekeeper/README +34 -0
- data/lib/skel/leaves/scorekeeper/config.yml +2 -0
- data/lib/skel/leaves/scorekeeper/controller.rb +104 -0
- data/lib/skel/leaves/scorekeeper/helpers/general.rb +64 -0
- data/lib/skel/leaves/scorekeeper/models/channel.rb +12 -0
- data/lib/skel/leaves/scorekeeper/models/person.rb +14 -0
- data/lib/skel/leaves/scorekeeper/models/pseudonym.rb +11 -0
- data/lib/skel/leaves/scorekeeper/models/score.rb +14 -0
- data/lib/skel/leaves/scorekeeper/tasks/stats.rake +17 -0
- data/lib/skel/leaves/scorekeeper/views/about.txt.erb +1 -0
- data/lib/skel/leaves/scorekeeper/views/change.txt.erb +5 -0
- data/lib/skel/leaves/scorekeeper/views/history.txt.erb +11 -0
- data/lib/skel/leaves/scorekeeper/views/points.txt.erb +5 -0
- data/lib/skel/leaves/scorekeeper/views/usage.txt.erb +1 -0
- data/lib/skel/log/README +1 -0
- data/lib/skel/script/console +28 -0
- data/lib/skel/script/destroy +48 -0
- data/lib/skel/script/generate +48 -0
- data/lib/skel/shared/README +1 -0
- data/lib/skel/tmp/README +1 -0
- data/spec/authentication_spec.rb +328 -0
- data/spec/channel_leaf_spec.rb +141 -0
- data/spec/coder_spec.rb +146 -0
- data/spec/ctcp_spec.rb +222 -0
- data/spec/daemon_spec.rb +202 -0
- data/spec/datamapper_hacks_spec.rb +164 -0
- data/tasks/authors.rake +30 -0
- data/tasks/bacon.rake +66 -0
- data/tasks/changelog.rake +18 -0
- data/tasks/copyright.rake +21 -0
- data/tasks/gem.rake +23 -0
- data/tasks/gem_installer.rake +76 -0
- data/tasks/install_dependencies.rake +6 -0
- data/tasks/manifest.rake +4 -0
- data/tasks/rcov.rake +23 -0
- data/tasks/release.rake +52 -0
- data/tasks/reversion.rake +8 -0
- data/tasks/setup.rake +24 -0
- data/tasks/yard.rake +4 -0
- metadata +187 -0
@@ -0,0 +1,162 @@
|
|
1
|
+
# This source file, originating from Ruby on Rails, extends the +Class+ class to
|
2
|
+
# allows attributes to be shared within an inheritance hierarchy, but where each
|
3
|
+
# descendant gets a copy of their parents' attributes, instead of just a pointer
|
4
|
+
# to the same. This means that the child can add elements to, for example, an
|
5
|
+
# array without those additions being shared with either their parent, siblings,
|
6
|
+
# or children, which is unlike the regular class-level attributes that are
|
7
|
+
# shared across the entire hierarchy.
|
8
|
+
#
|
9
|
+
# This functionality is used by Leaf's filter features; if not for this
|
10
|
+
# extension, then when a subclass changed its filter chain, all of its
|
11
|
+
# superclasses' filter chains would change as well. This class allows a subclass
|
12
|
+
# to inherit a _copy_ of the superclass's filter chain, but independently change
|
13
|
+
# that copy without affecting the superclass's filter chain.
|
14
|
+
#
|
15
|
+
# Copyright (c)2004 David Heinemeier Hansson
|
16
|
+
#
|
17
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
18
|
+
# a copy of this software and associated documentation files (the
|
19
|
+
# "Software"), to deal in the Software without restriction, including
|
20
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
21
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
22
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
23
|
+
# the following conditions:
|
24
|
+
# The above copyright notice and this permission notice shall be
|
25
|
+
# included in all copies or substantial portions of the Software.
|
26
|
+
|
27
|
+
# Allows attributes to be shared within an inheritance hierarchy, but where each descendant gets a copy of
|
28
|
+
# their parents' attributes, instead of just a pointer to the same. This means that the child can add elements
|
29
|
+
# to, for example, an array without those additions being shared with either their parent, siblings, or
|
30
|
+
# children, which is unlike the regular class-level attributes that are shared across the entire hierarchy.
|
31
|
+
class Class # :nodoc:
|
32
|
+
def class_inheritable_reader(*syms)
|
33
|
+
syms.each do |sym|
|
34
|
+
next if sym.is_a?(Hash)
|
35
|
+
class_eval <<-EOS
|
36
|
+
def self.#{sym}
|
37
|
+
read_inheritable_attribute(:#{sym})
|
38
|
+
end
|
39
|
+
|
40
|
+
def #{sym}
|
41
|
+
self.class.#{sym}
|
42
|
+
end
|
43
|
+
EOS
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def class_inheritable_writer(*syms)
|
48
|
+
options = syms.last.is_a?(Hash) ? syms.pop : {}
|
49
|
+
syms.each do |sym|
|
50
|
+
class_eval <<-EOS
|
51
|
+
def self.#{sym}=(obj)
|
52
|
+
write_inheritable_attribute(:#{sym}, obj)
|
53
|
+
end
|
54
|
+
|
55
|
+
#{"
|
56
|
+
def #{sym}=(obj)
|
57
|
+
self.class.#{sym} = obj
|
58
|
+
end
|
59
|
+
" unless options[:instance_writer] == false }
|
60
|
+
EOS
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def class_inheritable_array_writer(*syms)
|
65
|
+
options = syms.last.is_a?(Hash) ? syms.pop : {}
|
66
|
+
syms.each do |sym|
|
67
|
+
class_eval <<-EOS
|
68
|
+
def self.#{sym}=(obj)
|
69
|
+
write_inheritable_array(:#{sym}, obj)
|
70
|
+
end
|
71
|
+
|
72
|
+
#{"
|
73
|
+
def #{sym}=(obj)
|
74
|
+
self.class.#{sym} = obj
|
75
|
+
end
|
76
|
+
" unless options[:instance_writer] == false }
|
77
|
+
EOS
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def class_inheritable_hash_writer(*syms)
|
82
|
+
options = syms.last.is_a?(Hash) ? syms.pop : {}
|
83
|
+
syms.each do |sym|
|
84
|
+
class_eval <<-EOS
|
85
|
+
def self.#{sym}=(obj)
|
86
|
+
write_inheritable_hash(:#{sym}, obj)
|
87
|
+
end
|
88
|
+
|
89
|
+
#{"
|
90
|
+
def #{sym}=(obj)
|
91
|
+
self.class.#{sym} = obj
|
92
|
+
end
|
93
|
+
" unless options[:instance_writer] == false }
|
94
|
+
EOS
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def class_inheritable_accessor(*syms)
|
99
|
+
class_inheritable_reader(*syms)
|
100
|
+
class_inheritable_writer(*syms)
|
101
|
+
end
|
102
|
+
|
103
|
+
def class_inheritable_array(*syms)
|
104
|
+
class_inheritable_reader(*syms)
|
105
|
+
class_inheritable_array_writer(*syms)
|
106
|
+
end
|
107
|
+
|
108
|
+
def class_inheritable_hash(*syms)
|
109
|
+
class_inheritable_reader(*syms)
|
110
|
+
class_inheritable_hash_writer(*syms)
|
111
|
+
end
|
112
|
+
|
113
|
+
def inheritable_attributes
|
114
|
+
@inheritable_attributes ||= EMPTY_INHERITABLE_ATTRIBUTES
|
115
|
+
end
|
116
|
+
|
117
|
+
def write_inheritable_attribute(key, value)
|
118
|
+
if inheritable_attributes.equal?(EMPTY_INHERITABLE_ATTRIBUTES)
|
119
|
+
@inheritable_attributes = {}
|
120
|
+
end
|
121
|
+
inheritable_attributes[key] = value
|
122
|
+
end
|
123
|
+
|
124
|
+
def write_inheritable_array(key, elements)
|
125
|
+
write_inheritable_attribute(key, []) if read_inheritable_attribute(key).nil?
|
126
|
+
write_inheritable_attribute(key, read_inheritable_attribute(key) + elements)
|
127
|
+
end
|
128
|
+
|
129
|
+
def write_inheritable_hash(key, hash)
|
130
|
+
write_inheritable_attribute(key, {}) if read_inheritable_attribute(key).nil?
|
131
|
+
write_inheritable_attribute(key, read_inheritable_attribute(key).merge(hash))
|
132
|
+
end
|
133
|
+
|
134
|
+
def read_inheritable_attribute(key)
|
135
|
+
inheritable_attributes[key]
|
136
|
+
end
|
137
|
+
|
138
|
+
def reset_inheritable_attributes
|
139
|
+
@inheritable_attributes = EMPTY_INHERITABLE_ATTRIBUTES
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
# Prevent this constant from being created multiple times
|
144
|
+
EMPTY_INHERITABLE_ATTRIBUTES = {}.freeze unless const_defined?(:EMPTY_INHERITABLE_ATTRIBUTES)
|
145
|
+
|
146
|
+
def inherited_with_inheritable_attributes(child)
|
147
|
+
inherited_without_inheritable_attributes(child) if respond_to?(:inherited_without_inheritable_attributes)
|
148
|
+
|
149
|
+
if inheritable_attributes.equal?(EMPTY_INHERITABLE_ATTRIBUTES)
|
150
|
+
new_inheritable_attributes = EMPTY_INHERITABLE_ATTRIBUTES
|
151
|
+
else
|
152
|
+
new_inheritable_attributes = inheritable_attributes.inject({}) do |memo, (key, value)|
|
153
|
+
memo.update(key => (value.dup rescue value))
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
child.instance_variable_set('@inheritable_attributes', new_inheritable_attributes)
|
158
|
+
end
|
159
|
+
|
160
|
+
alias inherited_without_inheritable_attributes inherited
|
161
|
+
alias inherited inherited_with_inheritable_attributes
|
162
|
+
end
|