public
Description: ActiveRecord plugin for versioning your models.
Clone URL: git://github.com/technoweenie/acts_as_versioned.git
first rubyforge release

git-svn-id: http://svn.techno-weenie.net/projects/acts_as_versioned@94 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sun Sep 18 21:47:48 -0700 2005
commit  c6b797a35a20d188d496e2bd2d2f99654afd5709
tree    6199f0b4ca88a9c55cf746a7bcfd94d6068cdbdb
parent  be856e0761734a29937e47d54af3f798fcc328f8
...
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
0
@@ -1,3 +1,7 @@
0
+*0.1.3* (18 Sep 2005)
0
+
0
+* First RubyForge release
0
+
0
 *0.1.2*
0
 
0
 * check if module is already included when acts_as_versioned is called
0
...
2
3
4
5
 
6
7
8
9
 
10
11
 
12
13
 
14
15
16
 
 
 
17
18
19
20
...
2
3
4
 
5
6
7
8
 
9
10
 
11
12
 
13
14
 
 
15
16
17
18
19
20
21
0
@@ -2,18 +2,19 @@
0
 
0
 This library adds simple versioning to an ActiveRecord module. ActiveRecord is required.
0
 
0
-== Download
0
+== Install
0
 
0
 Gem installation:
0
 
0
- gem install acts_as_versioned --source=http://techno-weenie.net/code
0
+ gem install acts_as_versioned
0
   
0
-Get a gzipped tar at http://techno-weenie.net/code/pkg
0
+Download:
0
 
0
-== Usage
0
+ http://rubyforge.org/projects/ar-versioned/
0
 
0
-RDocs are online at http://techno-weenie.net/code/doc/acts_as_versioned/. Start with the
0
-ActiveRecord::Acts::Versioned module.
0
+== Documentation
0
+
0
+RDocs are online at http://ar-versioned.rubyforge.org
0
 
0
 Special thanks to Dreamer on ##rubyonrails for help in early testing. His ServerSideWiki (http://serversidewiki.com)
0
 was the first project to use acts_as_versioned <em>in the wild</em>.
0
\ No newline at end of file
...
8
9
10
11
12
13
14
 
 
 
 
 
 
15
16
17
...
63
64
65
 
66
67
68
69
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
...
8
9
10
 
 
 
 
11
12
13
14
15
16
17
18
19
...
65
66
67
68
69
70
71
 
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
0
@@ -8,10 +8,12 @@ require 'rake/gempackagetask'
0
 require 'rake/testtask'
0
 require 'rake/contrib/rubyforgepublisher'
0
 
0
-PKG_NAME = 'acts_as_versioned'
0
-PKG_VERSION = '0.1.2'
0
-PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
0
-PROD_HOST = "technoweenie@bidwell.textdrive.com"
0
+PKG_NAME = 'acts_as_versioned'
0
+PKG_VERSION = '0.1.3'
0
+PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
0
+PROD_HOST = "technoweenie@bidwell.textdrive.com"
0
+RUBY_FORGE_PROJECT = 'ar-versioned'
0
+RUBY_FORGE_USER = 'technoweenie'
0
 
0
 for adapter in %w( mysql postgresql sqlite sqlite3 sqlserver sqlserver_odbc db2 oci )
0
   Rake::TestTask.new("test_#{adapter}") do |t|
0
@@ -63,7 +65,123 @@ end
0
 desc "Publish the API documentation"
0
 task :pdoc => [:rdoc] do
0
   Rake::SshDirPublisher.new(PROD_HOST, "public_html/code/doc/#{PKG_NAME}", "doc").upload
0
+ Rake::RubyForgePublisher.new(RUBY_FORGE_PROJECT, RUBY_FORGE_USER).upload
0
 end
0
 
0
 desc 'Publish the gem and API docs'
0
-task :publish => [:pgem, :pdoc]
0
\ No newline at end of file
0
+task :publish => [:pgem, :pdoc, :rubyforge_upload]
0
+
0
+desc "Publish the release files to RubyForge."
0
+task :rubyforge_upload do
0
+ files = %w(gem tgz).map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
0
+
0
+ if RUBY_FORGE_PROJECT then
0
+ require 'net/http'
0
+ require 'open-uri'
0
+
0
+ project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
0
+ project_data = open(project_uri) { |data| data.read }
0
+ group_id = project_data[/[?&]group_id=(\d+)/, 1]
0
+ raise "Couldn't get group id" unless group_id
0
+
0
+ # This echos password to shell which is a bit sucky
0
+ if ENV["RUBY_FORGE_PASSWORD"]
0
+ password = ENV["RUBY_FORGE_PASSWORD"]
0
+ else
0
+ print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
0
+ password = STDIN.gets.chomp
0
+ end
0
+
0
+ login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
0
+ data = [
0
+ "login=1",
0
+ "form_loginname=#{RUBY_FORGE_USER}",
0
+ "form_pw=#{password}"
0
+ ].join("&")
0
+ http.post("/account/login.php", data)
0
+ end
0
+
0
+ cookie = login_response["set-cookie"]
0
+ raise "Login failed" unless cookie
0
+ headers = { "Cookie" => cookie }
0
+
0
+ release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
0
+ release_data = open(release_uri, headers) { |data| data.read }
0
+ package_id = release_data[/[?&]package_id=(\d+)/, 1]
0
+ raise "Couldn't get package id" unless package_id
0
+
0
+ first_file = true
0
+ release_id = ""
0
+
0
+ files.each do |filename|
0
+ basename = File.basename(filename)
0
+ file_ext = File.extname(filename)
0
+ file_data = File.open(filename, "rb") { |file| file.read }
0
+
0
+ puts "Releasing #{basename}..."
0
+
0
+ release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
0
+ release_date = Time.now.strftime("%Y-%m-%d %H:%M")
0
+ type_map = {
0
+ ".zip" => "3000",
0
+ ".tgz" => "3110",
0
+ ".gz" => "3110",
0
+ ".gem" => "1400"
0
+ }; type_map.default = "9999"
0
+ type = type_map[file_ext]
0
+ boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
0
+
0
+ query_hash = if first_file then
0
+ {
0
+ "group_id" => group_id,
0
+ "package_id" => package_id,
0
+ "release_name" => PKG_FILE_NAME,
0
+ "release_date" => release_date,
0
+ "type_id" => type,
0
+ "processor_id" => "8000", # Any
0
+ "release_notes" => "",
0
+ "release_changes" => "",
0
+ "preformatted" => "1",
0
+ "submit" => "1"
0
+ }
0
+ else
0
+ {
0
+ "group_id" => group_id,
0
+ "release_id" => release_id,
0
+ "package_id" => package_id,
0
+ "step2" => "1",
0
+ "type_id" => type,
0
+ "processor_id" => "8000", # Any
0
+ "submit" => "Add This File"
0
+ }
0
+ end
0
+
0
+ query = "?" + query_hash.map do |(name, value)|
0
+ [name, URI.encode(value)].join("=")
0
+ end.join("&")
0
+
0
+ data = [
0
+ "--" + boundary,
0
+ "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
0
+ "Content-Type: application/octet-stream",
0
+ "Content-Transfer-Encoding: binary",
0
+ "", file_data, ""
0
+ ].join("\x0D\x0A")
0
+
0
+ release_headers = headers.merge(
0
+ "Content-Type" => "multipart/form-data; boundary=#{boundary}"
0
+ )
0
+
0
+ target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
0
+ http.post(target + query, data, release_headers)
0
+ end
0
+
0
+ if first_file then
0
+ release_id = release_response.body[/release_id=(\d+)/, 1]
0
+ raise("Couldn't get release id") unless release_id
0
+ end
0
+
0
+ first_file = false
0
+ end
0
+ end
0
+end
0
\ No newline at end of file

Comments

    No one has commented yet.