Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: Tom Copeland
RE: Package#create works, huzzah! [ reply ]  
2009-06-16 22:37
Using .netrc now, so:

==========
$ curl -n http://localhost:3000/groups/support.js
{"group": {"use_tracker": 1, "use_survey": 1, "status": "A", "license_other": "", "group_name": "RubyForge Support", "rand_hash": "74a31a48ddb8b0d9ffcc9bad75ed3a1f", "license": 102, "enable_pserver": 1, "use_pm_depend_box": 1, "use_forum": 1, "unix_group_name": "support", "unix_box": "shell1", "register_time": 1058291358, "register_purpose": "RubyForge.RubyForge.RubyForge.RubyForge.RubyForge.RubyForge.", "short_description": "Support for RubyForge users.", "new_doc_address": "", "use_news": 1, "use_frs": 1, "use_docman": 1, "type_id": 1, "use_scm": 1, "group_id": 5, "use_stats": 1, "homepage": "support.rubyforge.org/", "use_mail": 1, "is_public": 1, "sys_state": null, "send_all_docs": 0, "scm_box": "cvs1", "http_domain": "support.rubyforge", "use_pm": 0, "use_ftp": 0, "needs_vhost_permissions_reset": false, "enable_anonscm": 1}}
==========

Tom

By: Tom Copeland
RE: Package#create works, huzzah! [ reply ]  
2009-06-07 01:31
Oh, and with curl:

$ curl -F 'username=tom' -F 'password=xxxxxxxx' -F 'package[name]=testtest' -F 'package[is_public=1]' http://localhost:3000/groups/97/packages

Hm, I guess we don't really need the package[] thing, do we... kinda handy on the server side but seems like a pain client-side. Huh.

By: Tom Copeland
RE: Package#create works, huzzah! [ reply ]  
2009-06-07 01:27
Here's the diff to the "rubyforge" gem so far:

$ svn diff
Index: lib/rubyforge.rb
===================================================================
--- lib/rubyforge.rb (revision 781)
+++ lib/rubyforge.rb (working copy)
@@ -202,18 +202,17 @@
end

def create_package(group_id, package_name)
- page = "/frs/admin/index.php"
+ page = "/groups/#{group_id}/packages"

group_id = lookup "group", group_id
is_private = @userconfig["is_private"]
is_public = is_private ? 0 : 1

form = {
- "func" => "add_package",
- "group_id" => group_id,
- "package_name" => package_name,
- "is_public" => is_public,
- "submit" => "Create This Package",
+ "username" => @userconfig["username"],
+ "password" => @userconfig["password"],
+ "package[name]" => package_name,
+ "package[is_public]" => is_public
}

run page, form


By: Tom Copeland
Package#create works, huzzah! [ reply ]  
2009-06-07 01:21
$ ./script/runner "p Group.find(97).packages.size"
0
# from "rubyforge" gem directory:
$ bin/rubyforge create_package 97 testtest
[ ... some output ... ]
$ ./script/runner "p Group.find(97).packages.size"
1

w00t!

I'm trying to limit the changes to the rubyforge gem, but lots of stuff can go away with a proper API in place. Cookie mgmt, page urls and form field names, etc. Good times.

Tom