Skip to content

Instantly share code, notes, and snippets.

@tumf
Created March 18, 2011 22:59
Show Gist options
  • Save tumf/877003 to your computer and use it in GitHub Desktop.
Save tumf/877003 to your computer and use it in GitHub Desktop.
openpearへSymfony1.0_*プラグインをまとめて登録したときのスクリプト
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'mechanize'
$ID = "tumf"
$PASSWORD="*****"
$PLUGINS = [
"sfDocTestPlugin",
"sfGuardMemberPlugin",
"sfMobileCarrierJPPlugin",
"sfPageContentsPlugin",
"sfDinoStandardPlugin",
"sfConfigurePlugin",
"sfPropelSqlDiffPlugin",
"sfPageFlowPlugin",
"sfCryptoCaptchaPlugin",
"jpEmailPlugin",
"sfLighttpdPlugin",
"sfEscapeHelperPlugin",
"sfJsonActionGeneratorPlugin"]
agent = Mechanize.new
agent.get("http://openpear.org/account/login") { |page|
page.form_with(:action => "http://openpear.org/account/login") { |form|
form.fields.find{|f| f.name == "login" }.value = $ID
form.fields.find{|f| f.name == "password" }.value = $PASSWORD
agent.submit(form)
}
}
$PLUGINS.each { |name|
agent.get("/packages/create") { |page|
page.form_with(:action => "http://openpear.org/packages/create") { |form|
form.fields.find{|f| f.name == "description" }.value = "#{name} for symfony 1.0"
form.fields.find{|f| f.name == "name" }.value = "Symfony1.0_#{name}"
form.fields.find{|f| f.name == "external_repository" }.value = "git://github.com/tumf/Symfony1.0_#{name}.git"
form.fields.find{|f| f.name == "external_repository_type" }.value = "Git"
form.fields.find{|f| f.name == "license" }.value = "MIT License"
form.fields.find{|f| f.name == "public_level" }.value = "0"
form.radiobutton_with(:name => "repository_uri_select").check
form.fields.find{|f| f.name == "url" }.value = "http://github.com/tumf/Symfony1.0_#{name}"
agent.submit(form)
}
}
agent.get("/package/Symfony1.0_#{name}") { |page|
page.form_with(:action => "http://openpear.org/package/Symfony1.0_#{name}/category/add") { |form|
form.fields.find{|f| f.name == "prime" }.value = "false"
form.fields.find{|f| f.name == "tag_name" }.value = "symfony"
agent.submit(form)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment