Commit 528ad570 authored by Michael Witrant's avatar Michael Witrant

publish to wiki

parent 967369f5
source "http://rubygems.org"
gem 'nokogiri'
gem 'selenium-webdriver'
gem 'mediawiki-gateway', :git => "git://github.com/piglop/mediawiki-gateway.git"
GIT
remote: git://github.com/piglop/mediawiki-gateway.git
revision: 745f3c9395fd68805f18d7a93d5857a0dd43e98b
specs:
mediawiki-gateway (0.4.3)
activesupport
rest-client (>= 1.3.0)
GEM
remote: http://rubygems.org/
specs:
activesupport (3.1.0)
multi_json (~> 1.0)
childprocess (0.2.2)
ffi (~> 1.0.6)
ffi (1.0.9)
json_pure (1.6.1)
nokogiri (1.5.0)
mime-types (1.16)
multi_json (1.0.3)
rest-client (1.6.7)
mime-types (>= 1.16)
rubyzip (0.9.4)
selenium-webdriver (2.7.0)
childprocess (>= 0.2.1)
......@@ -17,5 +30,5 @@ PLATFORMS
ruby
DEPENDENCIES
nokogiri
mediawiki-gateway!
selenium-webdriver
require "rubygems"
require "bundler/setup"
require 'media_wiki'
require 'yaml'
require 'erb'
require 'answer'
require 'cgi'
env = ARGV.first || "development"
wiki = YAML.load(File.read("wiki.yaml"))[env]
types = YAML.load(File.read("answers.yaml"))
mw = MediaWiki::Gateway.new(wiki["url"])
mw.login(wiki["username"], wiki["password"])
erb = ERB.new File.read("wiki_page.erb"), nil, "<>"
text = ""
text << "==Analyse des réponses à la consultation IPRED==
à vous…
"
types.each do |type, answers|
case type
when "organisations"
title = "Organisations"
when "public_authorities"
title = "Public authorities"
else
raise "unknown: #{type.inspect}"
end
text << "===#{title}===\n"
answers.sort.each do |name, answer|
name_with_languages = answer.name
name_with_languages += " (" + answer.languages.join(", ") + ")" unless answer.languages.empty?
text << erb.result(binding)
end
text << "\n"
text << "[[Category:IPRED fr]]\n"
end
mw.edit('Analyse reponses consultation IPRED', text, :summary => 'Update from script', :section => 6)
====<%= name_with_languages %>====
<% (answer.files + answer.annexes).each do |file| %>
* [<%= file %> <%= CGI.unescape(File.basename(URI.parse(file).path)) %>]
<% end %>
=====coopération=====
=====measures=====
=====filtering=====
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment