composite_primary_keys 0.7.0 → 0.7.1
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/Rakefile +1 -1
- data/lib/composite_primary_keys/base.rb +4 -4
- data/lib/composite_primary_keys/version.rb +1 -1
- data/scripts/http-access2-2.0.6.gem +0 -0
- data/scripts/rubyforge +217 -0
- data/scripts/rubyforge-orig +217 -0
- data/scripts/txt2html +65 -0
- data/scripts/txt2js +58 -0
- data/website/index.html +201 -0
- data/website/index.txt +123 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +96 -0
- data/website/template.js +3 -0
- data/website/template.rhtml +53 -0
- data/website/version-raw.js +3 -0
- data/website/version-raw.txt +2 -0
- data/website/version.js +4 -0
- data/website/version.txt +3 -0
- metadata +19 -2
data/Rakefile
CHANGED
@@ -135,12 +135,11 @@ module CompositePrimaryKeys
|
|
135
135
|
raise CompositeKeyError, "Composite keys do not generated ids from sequences, you must provide id values"
|
136
136
|
end
|
137
137
|
|
138
|
-
|
138
|
+
connection.insert(
|
139
139
|
"INSERT INTO #{self.class.table_name} " +
|
140
140
|
"(#{quoted_column_names.join(', ')}) " +
|
141
141
|
"VALUES(#{attributes_with_quotes.values.join(', ')})",
|
142
|
-
"#{self.class.name} Create"
|
143
|
-
self.class.primary_key, self.id
|
142
|
+
"#{self.class.name} Create"
|
144
143
|
)
|
145
144
|
@new_record = false
|
146
145
|
return true
|
@@ -148,10 +147,11 @@ module CompositePrimaryKeys
|
|
148
147
|
|
149
148
|
# Updates the associated record with values matching those of the instance attributes.
|
150
149
|
def update_without_callbacks
|
150
|
+
where_class = [self.class.primary_key, quoted_id].transpose.each {|key,id| "(#{key} = #{id})"}.join(" AND ")
|
151
151
|
connection.update(
|
152
152
|
"UPDATE #{self.class.table_name} " +
|
153
153
|
"SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false))} " +
|
154
|
-
"WHERE
|
154
|
+
"WHERE #{where_class}",
|
155
155
|
"#{self.class.name} Update"
|
156
156
|
)
|
157
157
|
return true
|
Binary file
|
data/scripts/rubyforge
ADDED
@@ -0,0 +1,217 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# RENAME THIS to rubyorge, and change username/password below to your rubyforge details.
|
4
|
+
# Set rubyforge file to Ignore on Subversion.
|
5
|
+
# libs
|
6
|
+
#
|
7
|
+
$VERBOSE = nil
|
8
|
+
require "getoptlong"
|
9
|
+
require "enumerator"
|
10
|
+
require "http-access2"
|
11
|
+
#
|
12
|
+
# config
|
13
|
+
#
|
14
|
+
config = {
|
15
|
+
"username" => "nicwilliams", # this must be your username
|
16
|
+
"password" => "UHUst0ck", # this must be your password
|
17
|
+
|
18
|
+
"group_id" => 1953, # see source of http://rubyforge.org/frs/admin/qrs.php?package=&group_id=1953
|
19
|
+
|
20
|
+
"package_ids" => { # configure shortcuts for your packages here
|
21
|
+
"compositekeys" => 2327,
|
22
|
+
},
|
23
|
+
|
24
|
+
"uri" => "http://rubyforge.org",
|
25
|
+
"cookie_jar" => File::join(File::expand_path("~"), ".rubyforge.cookie_jar"),
|
26
|
+
}
|
27
|
+
|
28
|
+
opts =
|
29
|
+
GetoptLong::new(
|
30
|
+
[ "--username" , "-u" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
31
|
+
[ "--password" , "-p" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
32
|
+
[ "--cookie_jar" , "-c" , GetoptLong::REQUIRED_ARGUMENT ]
|
33
|
+
).enum_for.inject({}){|h,kv| h.update Hash[*kv]}
|
34
|
+
|
35
|
+
username = opts['username'] || config['username']
|
36
|
+
password = opts['password'] || config['password']
|
37
|
+
cookie_jar = opts["cookie_jar"] || config['cookie_jar']
|
38
|
+
#
|
39
|
+
# setup
|
40
|
+
#
|
41
|
+
mode = ARGV.shift
|
42
|
+
abort "#{ $0 } [login|create_package (package_name)|add_package (package_id release_name release.ext)]" unless mode
|
43
|
+
|
44
|
+
page, form, method = nil
|
45
|
+
extheader = {}
|
46
|
+
|
47
|
+
case mode
|
48
|
+
|
49
|
+
when %r/login/
|
50
|
+
page = "/account/login.php"
|
51
|
+
method = "post_content"
|
52
|
+
|
53
|
+
form = {
|
54
|
+
"return_to" => "",
|
55
|
+
"form_loginname" => username,
|
56
|
+
"form_pw" => password,
|
57
|
+
"login" => "Login"
|
58
|
+
}
|
59
|
+
|
60
|
+
when %r/create_package/
|
61
|
+
page = "/frs/admin/index.php"
|
62
|
+
method = "post_content"
|
63
|
+
|
64
|
+
opts =
|
65
|
+
GetoptLong::new(
|
66
|
+
[ "--group_id" , "-g" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
67
|
+
[ "--is_private" , "-P" , GetoptLong::REQUIRED_ARGUMENT ]
|
68
|
+
).enum_for.inject({}){|h,kv| h.update Hash[*kv]}
|
69
|
+
|
70
|
+
package_name = ARGV.shift
|
71
|
+
abort "#{ $0 } package_name" unless package_name
|
72
|
+
|
73
|
+
group_id = opts["group_id"] || config["group_id"]
|
74
|
+
is_public = opts["is_private"] ? 0 : 1
|
75
|
+
|
76
|
+
form = {
|
77
|
+
"group_id" => group_id,
|
78
|
+
"package_name" => package_name,
|
79
|
+
"func" => "add_package",
|
80
|
+
"is_public" => is_public,
|
81
|
+
"submit" => "Create This Package",
|
82
|
+
}
|
83
|
+
|
84
|
+
when %r/add_release/
|
85
|
+
page = "/frs/admin/qrs.php"
|
86
|
+
method = "post_content"
|
87
|
+
|
88
|
+
opts =
|
89
|
+
GetoptLong::new(
|
90
|
+
[ "--group_id" , "-g" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
91
|
+
[ "--release_date" , "-r" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
92
|
+
[ "--type_id" , "-t" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
93
|
+
[ "--processor_id" , "-P" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
94
|
+
[ "--release_nots" , "-n" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
95
|
+
[ "--release_changes" , "-a" , GetoptLong::REQUIRED_ARGUMENT ]
|
96
|
+
).enum_for.inject({}){|h,kv| h.update Hash[*kv]}
|
97
|
+
|
98
|
+
package_id, release_name, userfile, ignored = ARGV
|
99
|
+
abort "#{ $0 } package_name" unless
|
100
|
+
package_id and release_name and userfile
|
101
|
+
|
102
|
+
package_id = config["package_ids"][package_id] unless
|
103
|
+
package_id =~ %r/^\d+$/
|
104
|
+
|
105
|
+
group_id = opts["group_id"] || config["group_id"]
|
106
|
+
release_date = opts["release_date"] || Time::now.strftime('%Y-%m-%d %H:%M')
|
107
|
+
|
108
|
+
type_id = opts['type_id'] || userfile[%r|\.[^\./]+$|]
|
109
|
+
type_id = {
|
110
|
+
".deb" => 1000,
|
111
|
+
".rpm" => 2000,
|
112
|
+
".zip" => 3000,
|
113
|
+
".bz2" => 3100,
|
114
|
+
".gz" => 3110,
|
115
|
+
".src.zip" => 5000,
|
116
|
+
".src.bz2" => 5010,
|
117
|
+
".src.gz" => 5020,
|
118
|
+
".src.rpm" => 5100,
|
119
|
+
".src" => 5900,
|
120
|
+
".jpg" => 8000,
|
121
|
+
".txt" => 8100,
|
122
|
+
".text" => 8100,
|
123
|
+
".htm" => 8200,
|
124
|
+
".html" => 8200,
|
125
|
+
".pdf" => 8300,
|
126
|
+
".oth" => 9999,
|
127
|
+
".ebuild" => 1300,
|
128
|
+
".exe" => 1100,
|
129
|
+
".dmg" => 1200,
|
130
|
+
".tar.gz" => 5000,
|
131
|
+
".tgz" => 5000,
|
132
|
+
".gem" => 1400,
|
133
|
+
".pgp" => 8150,
|
134
|
+
".sig" => 8150,
|
135
|
+
}[type_id]
|
136
|
+
|
137
|
+
processor_id = opts['processor_id'] || 'Any'
|
138
|
+
processor_id = {
|
139
|
+
"i386" => 1000,
|
140
|
+
"IA64" => 6000,
|
141
|
+
"Alpha" => 7000,
|
142
|
+
"Any" => 8000,
|
143
|
+
"PPC" => 2000,
|
144
|
+
"MIPS" => 3000,
|
145
|
+
"Sparc" => 4000,
|
146
|
+
"UltraSparc" => 5000,
|
147
|
+
"Other" => 9999,
|
148
|
+
}[processor_id]
|
149
|
+
|
150
|
+
release_notes = opts['release_notes'] || nil
|
151
|
+
release_notes = open(release_notes) if release_notes
|
152
|
+
|
153
|
+
release_changes = opts['release_changes'] || nil
|
154
|
+
release_changes = open(release_changes) if release_changes
|
155
|
+
|
156
|
+
userfile = open(userfile)
|
157
|
+
|
158
|
+
preformatted = '1'
|
159
|
+
|
160
|
+
form = {
|
161
|
+
"group_id" => group_id,
|
162
|
+
"package_id" => package_id,
|
163
|
+
"release_name" => release_name,
|
164
|
+
"release_date" => release_date,
|
165
|
+
"type_id" => type_id,
|
166
|
+
"processor_id" => processor_id,
|
167
|
+
"preformatted" => preformatted,
|
168
|
+
"userfile" => userfile,
|
169
|
+
"submit" => "Release File"
|
170
|
+
}
|
171
|
+
|
172
|
+
boundary = Array::new(8){ "%2.2d" % rand(42) }.join('__')
|
173
|
+
extheader['content-type'] = "multipart/form-data; boundary=___#{ boundary }___"
|
174
|
+
|
175
|
+
else
|
176
|
+
abort "#{ $0 } login create_package add_release"
|
177
|
+
|
178
|
+
end
|
179
|
+
#
|
180
|
+
# http transaction
|
181
|
+
#
|
182
|
+
client = HTTPAccess2::Client::new ENV['HTTP_PROXY']
|
183
|
+
client.debug_dev = STDERR if ENV['DEBUG']
|
184
|
+
|
185
|
+
client.set_cookie_store cookie_jar
|
186
|
+
|
187
|
+
# fixes http-access2 bug
|
188
|
+
client.redirect_uri_callback = lambda do |res|
|
189
|
+
page = res.header['location'].first
|
190
|
+
page = page =~ %r/http/ ? page : "#{ config['uri'] }/#{ page }"
|
191
|
+
page
|
192
|
+
end
|
193
|
+
|
194
|
+
response = client.send "#{ method }", "#{ config['uri'] }/#{ page }", form, extheader
|
195
|
+
|
196
|
+
client.save_cookie_store
|
197
|
+
|
198
|
+
# fixes http-access2 bug
|
199
|
+
BEGIN {
|
200
|
+
require "http-access2"
|
201
|
+
module WebAgent::CookieUtils
|
202
|
+
def domain_match(host, domain)
|
203
|
+
case domain
|
204
|
+
when /\d+\.\d+\.\d+\.\d+/
|
205
|
+
return (host == domain)
|
206
|
+
when '.'
|
207
|
+
return true
|
208
|
+
when /^\./
|
209
|
+
#return tail_match?(domain, host)
|
210
|
+
return tail_match?(host, domain)
|
211
|
+
else
|
212
|
+
return (host == domain)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
}
|
@@ -0,0 +1,217 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# RENAME THIS to rubyorge, and change username/password below to your rubyforge details.
|
4
|
+
# Set rubyforge file to Ignore on Subversion.
|
5
|
+
# libs
|
6
|
+
#
|
7
|
+
$VERBOSE = nil
|
8
|
+
require "getoptlong"
|
9
|
+
require "enumerator"
|
10
|
+
require "http-access2"
|
11
|
+
#
|
12
|
+
# config
|
13
|
+
#
|
14
|
+
config = {
|
15
|
+
"username" => "username", # this must be your username
|
16
|
+
"password" => "password", # this must be your password
|
17
|
+
|
18
|
+
"group_id" => 1953, # see source of http://rubyforge.org/frs/admin/qrs.php?package=&group_id=1953
|
19
|
+
|
20
|
+
"package_ids" => { # configure shortcuts for your packages here
|
21
|
+
"compositekeys" => 2327,
|
22
|
+
},
|
23
|
+
|
24
|
+
"uri" => "http://rubyforge.org",
|
25
|
+
"cookie_jar" => File::join(File::expand_path("~"), ".rubyforge.cookie_jar"),
|
26
|
+
}
|
27
|
+
|
28
|
+
opts =
|
29
|
+
GetoptLong::new(
|
30
|
+
[ "--username" , "-u" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
31
|
+
[ "--password" , "-p" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
32
|
+
[ "--cookie_jar" , "-c" , GetoptLong::REQUIRED_ARGUMENT ]
|
33
|
+
).enum_for.inject({}){|h,kv| h.update Hash[*kv]}
|
34
|
+
|
35
|
+
username = opts['username'] || config['username']
|
36
|
+
password = opts['password'] || config['password']
|
37
|
+
cookie_jar = opts["cookie_jar"] || config['cookie_jar']
|
38
|
+
#
|
39
|
+
# setup
|
40
|
+
#
|
41
|
+
mode = ARGV.shift
|
42
|
+
abort "#{ $0 } [login|create_package (package_name)|add_package (package_id release_name release.ext)]" unless mode
|
43
|
+
|
44
|
+
page, form, method = nil
|
45
|
+
extheader = {}
|
46
|
+
|
47
|
+
case mode
|
48
|
+
|
49
|
+
when %r/login/
|
50
|
+
page = "/account/login.php"
|
51
|
+
method = "post_content"
|
52
|
+
|
53
|
+
form = {
|
54
|
+
"return_to" => "",
|
55
|
+
"form_loginname" => username,
|
56
|
+
"form_pw" => password,
|
57
|
+
"login" => "Login"
|
58
|
+
}
|
59
|
+
|
60
|
+
when %r/create_package/
|
61
|
+
page = "/frs/admin/index.php"
|
62
|
+
method = "post_content"
|
63
|
+
|
64
|
+
opts =
|
65
|
+
GetoptLong::new(
|
66
|
+
[ "--group_id" , "-g" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
67
|
+
[ "--is_private" , "-P" , GetoptLong::REQUIRED_ARGUMENT ]
|
68
|
+
).enum_for.inject({}){|h,kv| h.update Hash[*kv]}
|
69
|
+
|
70
|
+
package_name = ARGV.shift
|
71
|
+
abort "#{ $0 } package_name" unless package_name
|
72
|
+
|
73
|
+
group_id = opts["group_id"] || config["group_id"]
|
74
|
+
is_public = opts["is_private"] ? 0 : 1
|
75
|
+
|
76
|
+
form = {
|
77
|
+
"group_id" => group_id,
|
78
|
+
"package_name" => package_name,
|
79
|
+
"func" => "add_package",
|
80
|
+
"is_public" => is_public,
|
81
|
+
"submit" => "Create This Package",
|
82
|
+
}
|
83
|
+
|
84
|
+
when %r/add_release/
|
85
|
+
page = "/frs/admin/qrs.php"
|
86
|
+
method = "post_content"
|
87
|
+
|
88
|
+
opts =
|
89
|
+
GetoptLong::new(
|
90
|
+
[ "--group_id" , "-g" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
91
|
+
[ "--release_date" , "-r" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
92
|
+
[ "--type_id" , "-t" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
93
|
+
[ "--processor_id" , "-P" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
94
|
+
[ "--release_nots" , "-n" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
95
|
+
[ "--release_changes" , "-a" , GetoptLong::REQUIRED_ARGUMENT ]
|
96
|
+
).enum_for.inject({}){|h,kv| h.update Hash[*kv]}
|
97
|
+
|
98
|
+
package_id, release_name, userfile, ignored = ARGV
|
99
|
+
abort "#{ $0 } package_name" unless
|
100
|
+
package_id and release_name and userfile
|
101
|
+
|
102
|
+
package_id = config["package_ids"][package_id] unless
|
103
|
+
package_id =~ %r/^\d+$/
|
104
|
+
|
105
|
+
group_id = opts["group_id"] || config["group_id"]
|
106
|
+
release_date = opts["release_date"] || Time::now.strftime('%Y-%m-%d %H:%M')
|
107
|
+
|
108
|
+
type_id = opts['type_id'] || userfile[%r|\.[^\./]+$|]
|
109
|
+
type_id = {
|
110
|
+
".deb" => 1000,
|
111
|
+
".rpm" => 2000,
|
112
|
+
".zip" => 3000,
|
113
|
+
".bz2" => 3100,
|
114
|
+
".gz" => 3110,
|
115
|
+
".src.zip" => 5000,
|
116
|
+
".src.bz2" => 5010,
|
117
|
+
".src.gz" => 5020,
|
118
|
+
".src.rpm" => 5100,
|
119
|
+
".src" => 5900,
|
120
|
+
".jpg" => 8000,
|
121
|
+
".txt" => 8100,
|
122
|
+
".text" => 8100,
|
123
|
+
".htm" => 8200,
|
124
|
+
".html" => 8200,
|
125
|
+
".pdf" => 8300,
|
126
|
+
".oth" => 9999,
|
127
|
+
".ebuild" => 1300,
|
128
|
+
".exe" => 1100,
|
129
|
+
".dmg" => 1200,
|
130
|
+
".tar.gz" => 5000,
|
131
|
+
".tgz" => 5000,
|
132
|
+
".gem" => 1400,
|
133
|
+
".pgp" => 8150,
|
134
|
+
".sig" => 8150,
|
135
|
+
}[type_id]
|
136
|
+
|
137
|
+
processor_id = opts['processor_id'] || 'Any'
|
138
|
+
processor_id = {
|
139
|
+
"i386" => 1000,
|
140
|
+
"IA64" => 6000,
|
141
|
+
"Alpha" => 7000,
|
142
|
+
"Any" => 8000,
|
143
|
+
"PPC" => 2000,
|
144
|
+
"MIPS" => 3000,
|
145
|
+
"Sparc" => 4000,
|
146
|
+
"UltraSparc" => 5000,
|
147
|
+
"Other" => 9999,
|
148
|
+
}[processor_id]
|
149
|
+
|
150
|
+
release_notes = opts['release_notes'] || nil
|
151
|
+
release_notes = open(release_notes) if release_notes
|
152
|
+
|
153
|
+
release_changes = opts['release_changes'] || nil
|
154
|
+
release_changes = open(release_changes) if release_changes
|
155
|
+
|
156
|
+
userfile = open(userfile)
|
157
|
+
|
158
|
+
preformatted = '1'
|
159
|
+
|
160
|
+
form = {
|
161
|
+
"group_id" => group_id,
|
162
|
+
"package_id" => package_id,
|
163
|
+
"release_name" => release_name,
|
164
|
+
"release_date" => release_date,
|
165
|
+
"type_id" => type_id,
|
166
|
+
"processor_id" => processor_id,
|
167
|
+
"preformatted" => preformatted,
|
168
|
+
"userfile" => userfile,
|
169
|
+
"submit" => "Release File"
|
170
|
+
}
|
171
|
+
|
172
|
+
boundary = Array::new(8){ "%2.2d" % rand(42) }.join('__')
|
173
|
+
extheader['content-type'] = "multipart/form-data; boundary=___#{ boundary }___"
|
174
|
+
|
175
|
+
else
|
176
|
+
abort "#{ $0 } login create_package add_release"
|
177
|
+
|
178
|
+
end
|
179
|
+
#
|
180
|
+
# http transaction
|
181
|
+
#
|
182
|
+
client = HTTPAccess2::Client::new ENV['HTTP_PROXY']
|
183
|
+
client.debug_dev = STDERR if ENV['DEBUG']
|
184
|
+
|
185
|
+
client.set_cookie_store cookie_jar
|
186
|
+
|
187
|
+
# fixes http-access2 bug
|
188
|
+
client.redirect_uri_callback = lambda do |res|
|
189
|
+
page = res.header['location'].first
|
190
|
+
page = page =~ %r/http/ ? page : "#{ config['uri'] }/#{ page }"
|
191
|
+
page
|
192
|
+
end
|
193
|
+
|
194
|
+
response = client.send "#{ method }", "#{ config['uri'] }/#{ page }", form, extheader
|
195
|
+
|
196
|
+
client.save_cookie_store
|
197
|
+
|
198
|
+
# fixes http-access2 bug
|
199
|
+
BEGIN {
|
200
|
+
require "http-access2"
|
201
|
+
module WebAgent::CookieUtils
|
202
|
+
def domain_match(host, domain)
|
203
|
+
case domain
|
204
|
+
when /\d+\.\d+\.\d+\.\d+/
|
205
|
+
return (host == domain)
|
206
|
+
when '.'
|
207
|
+
return true
|
208
|
+
when /^\./
|
209
|
+
#return tail_match?(domain, host)
|
210
|
+
return tail_match?(host, domain)
|
211
|
+
else
|
212
|
+
return (host == domain)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
}
|