openfire_admin 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cc939e2a210154f50c37e6598c1ee5f1fe5898f4
4
+ data.tar.gz: bc6e3246f02c30635b34f8c6d63f85fbfcab4015
5
+ SHA512:
6
+ metadata.gz: ffd281131ccd00c1900757a10aad788c797593a26ab177b0edfa366d376e297644c5ba46f8c4089d4ad190f049cc16e3da6fc8053e893f142617a6325a0034c0
7
+ data.tar.gz: 8b0901b1585e54922e446114a83299dde6a75ee90ceb5c07950f30b69ce691d4ead24a3d72d554ee1cf512c6119d73f186ae5535ec9eae3d584beb82f49c1a68
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ spec/reports
17
17
  test/tmp
18
18
  test/version_tmp
19
19
  tmp
20
+ bin/
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ language: ruby
3
+ rvm:
4
+ - 1.9.3
5
+ - 1.8.7
6
+ - 2.1.1
7
+ - 2.0.0
8
+ - jruby-19mode
9
+ script: bundle exec rspec spec
data/Gemfile CHANGED
@@ -2,4 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'nokogiri'
5
+ group :test do
6
+ gem 'coveralls', :require => false, :platforms => [ :ruby_20 ]
7
+ end
data/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # OpenfireAdmin
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/openfire_admin.png)](http://badge.fury.io/rb/openfire_admin)
4
+ [![Build Status](https://travis-ci.org/nazoking/openfire_admin.png?branch=master)](https://travis-ci.org/nazoking/openfire_admin)
5
+ [![Coverage Status](https://coveralls.io/repos/nazoking/openfire_admin/badge.png)](https://coveralls.io/r/nazoking/openfire_admin)
6
+ [![Code Climate](https://codeclimate.com/github/nazoking/openfire_admin.png)](https://codeclimate.com/github/nazoking/openfire_admin)
7
+ [![Dependency Status](https://gemnasium.com/nazoking/openfire_admin.png)](https://gemnasium.com/nazoking/openfire_admin)
8
+
3
9
  Controll Openfire Admin by ruby. (by web scraping,
4
10
  no need openfire plugins)
5
11
 
@@ -25,6 +31,20 @@ Or install it yourself as:
25
31
 
26
32
  $ gem install openfire_admin
27
33
 
34
+ ## API Document
35
+
36
+ http://rubydoc.info/gems/openfire_admin/frames/file/README.md
37
+
38
+ ## make develop directory
39
+
40
+ ```
41
+ bundle install --path .bundle/gems --binstubs bin/
42
+ ```
43
+
44
+ ### run test
45
+
46
+ ./bin/rspec
47
+
28
48
  ## TODO
29
49
 
30
50
  1. write comment, and document.
@@ -0,0 +1,41 @@
1
+ require 'rexml/document'
2
+ require 'rehtml'
3
+ module OpenfireAdmin
4
+ module ElementHelper
5
+ def at(xpath)
6
+ xpath = ".#{xpath}" if !self.is_a?(REXML::Document) and xpath =~ /^\//
7
+ elm = REXML::XPath.first(self,xpath)
8
+ elm.extend(ElementHelper)
9
+ elm
10
+ end
11
+ def search(xpath)
12
+ xpath = ".#{xpath}" if !self.is_a?(REXML::Document) and xpath =~ /^\//
13
+ ret = REXML::XPath.match(self,xpath).map{|elm|
14
+ elm.extend(ElementHelper)
15
+ elm
16
+ block_given? ? (yield elm) : elm
17
+ }
18
+ end
19
+ def [](arg, name=nil)
20
+ if arg.is_a?(Symbol)
21
+ self.attributes[arg.to_s]
22
+ else
23
+ super
24
+ end
25
+ end
26
+ end
27
+ # html parser wrapper
28
+ class HtmlParser
29
+ def initialize(html)
30
+ @doc = REHTML.to_rexml(html)
31
+ @doc.extend(ElementHelper)
32
+ end
33
+ def search(xpath, &proc)
34
+ @doc.search(xpath, &proc)
35
+ end
36
+ def at(xpath)
37
+ @doc.at(xpath)
38
+ end
39
+ end
40
+ end
41
+
@@ -1,22 +1,22 @@
1
- require 'nokogiri'
1
+ require 'openfire_admin/html_parser'
2
2
  require 'openfire_admin/admin_client'
3
3
 
4
4
  module OpenfireAdmin
5
5
  class AdminClient
6
6
  def get_installed_plugins
7
7
  get("/plugin-admin.jsp") do |res|
8
- doc =Nokogiri::HTML(res.body)
9
- doc.at('h1').parent.at('table').search('tbody tr[valign=top]').map do |tr|
10
- img = tr.at('a[href*="reloadplugin="]')
8
+ doc = HtmlParser.new(res.body)
9
+ doc.search("//h1/parent::*//table/tbody/tr[@valign='top']"){|tr|
10
+ img = tr.at('//a[contains(@href,"reloadplugin=")]')
11
11
  if img
12
12
  {
13
13
  :key => img[:href].match(/\?reloadplugin=([^"'&>]*)/)[1],
14
- :name => tr.search('td')[1].content.gsub(NBSP,' ').strip,
15
- :description => tr.search('td')[3].content.strip,
16
- :version => tr.search('td')[4].content.strip
14
+ :name => tr.search('td')[1].text.strip,
15
+ :description => tr.search('td')[3].text.strip,
16
+ :version => tr.search('td')[4].text.strip
17
17
  }
18
18
  end
19
- end
19
+ }.collect
20
20
  end
21
21
  end
22
22
  def install_plugin(url)
@@ -117,14 +117,14 @@ module OpenfireAdmin
117
117
  def self.availables(client, xml=nil)
118
118
  xml = open(PLUGIN_LIST_URL).read unless xml
119
119
  ret = PluginList.new
120
- doc = Nokogiri::XML(xml)
121
- doc.search('plugin').each do |tr|
122
- p = AvailablePlugin.new(client, tr[:url].match(/\/([^\.\/]+)\.[^\/.]+$/)[1])
123
- p.name = tr[:name]
124
- p.description = tr[:description]
125
- p.version = tr[:latest]
126
- p.url = tr[:url]
127
- ret << p
120
+ doc = HtmlParser.new(xml)
121
+ doc.search('//plugin') do |tr|
122
+ ap = AvailablePlugin.new(client, tr[:url].match(/\/([^\.\/]+)\.[^\/.]+$/)[1])
123
+ ap.name = tr[:name]
124
+ ap.description = tr[:description]
125
+ ap.version = tr[:latest]
126
+ ap.url = tr[:url]
127
+ ret << ap
128
128
  end
129
129
  ret
130
130
  end
@@ -1,4 +1,4 @@
1
- require 'nokogiri'
1
+ require 'openfire_admin/html_parser'
2
2
  require 'openfire_admin/admin_client'
3
3
 
4
4
  module OpenfireAdmin
@@ -15,20 +15,20 @@ module OpenfireAdmin
15
15
  end
16
16
  def get_property(name)
17
17
  post("/server-properties.jsp", "edit"=>"true", "propName"=>name) do |res|
18
- ta = Nokogiri::HTML(res.body).at('textarea[name=propValue]')
18
+ ta = HtmlParser.new(res.body).at('//textarea[@name="propValue"]')
19
19
  raise ResponceException.new("not found textarea",res) unless ta
20
- ta.content.to_s
20
+ ta.text.to_s
21
21
  end
22
22
  end
23
23
  def get_properties
24
24
  ret = {}
25
25
  get("/server-properties.jsp") do |res|
26
26
  raise ResponceException.new("can't read",res) unless res.code== "200"
27
- doc = Nokogiri::HTML(res.body)
27
+ doc = HtmlParser.new(res.body)
28
28
  doc.search('//h1/parent::node()//table/tbody/tr[@class=""]').each do |tr|
29
- v = tr.at('td[2] span')[:title]
29
+ v = tr.at('//td[2]//span')[:title]
30
30
  v = "" if v == NBSP
31
- ret[tr.at('td span')[:title]]= v
31
+ ret[tr.at('//td//span')[:title]]= v
32
32
  end
33
33
  end
34
34
  ret
@@ -1,4 +1,4 @@
1
- require 'nokogiri'
1
+ require 'openfire_admin/html_parser'
2
2
  require 'net/http'
3
3
  # openfire admin operator
4
4
  module OpenfireAdmin
@@ -8,8 +8,8 @@ module OpenfireAdmin
8
8
  def initialize(message,res)
9
9
  case res
10
10
  when Net::HTTPSuccess
11
- doc = Nokogiri::HTML(res.body)
12
- msgs = ( doc.search('.jive-error-text, .error') || [] ).map{|c| c.text.strip}
11
+ doc = HtmlParser.new(res.body)
12
+ msgs = ( doc.search('//*[contains(@class,"jive-error-text") or contains(@class , "error")]') || [] ).map{|c| c.text.strip}
13
13
  if msgs.empty?
14
14
  super(message)
15
15
  else
@@ -1,22 +1,22 @@
1
- require 'nokogiri'
2
- require 'openfire_admin/admin_client.rb'
1
+ require 'openfire_admin/html_parser'
2
+ require 'openfire_admin/admin_client'
3
3
 
4
4
  module OpenfireAdmin
5
5
  # extend for system cache
6
6
  class AdminClient
7
7
  def system_cache
8
8
  get("/system-cache.jsp") do |res|
9
- Nokogiri::HTML(res.body).search('input[type=checkbox][name=cacheID]').map{|i|
9
+ HtmlParser.new(res.body).search('//input[@type="checkbox"][@name="cacheID"]'){|i|
10
10
  {
11
11
  :cacheID => i[:value],
12
- :name => i.ancestors("tr").first.search("td td")[1].content.strip
12
+ :name => i.at("ancestor::tr[1]//table[1]//td[2]").text.strip
13
13
  }
14
14
  }
15
15
  end
16
16
  end
17
17
  def system_cache_clear(cacheID)
18
18
  post("/system-cache.jsp","cacheID"=>cacheID, "clear"=>"Clear") do |res|
19
- ! Nokogiri::HTML(res.body).at("div[class='jive-success']").nil?
19
+ ! HtmlParser.new(res.body).at("//div[@class='jive-success']").nil?
20
20
  end
21
21
  end
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module OpenfireAdmin
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -4,9 +4,9 @@ require File.expand_path('../lib/openfire_admin/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["nazoking"]
6
6
  gem.email = ["nazoking@gmai.com"]
7
- gem.description = %q{Manipurate Openfire admin console}
8
- gem.summary = %q{}
9
- gem.homepage = ""
7
+ gem.description = %q{Control for Openfire admin console}
8
+ gem.summary = %q{Control for Openfire admin console}
9
+ gem.homepage = "https://github.com/nazoking/openfire_admin"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -15,6 +15,8 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = OpenfireAdmin::VERSION
17
17
 
18
+ gem.add_dependency "rehtml"
19
+
18
20
  gem.add_development_dependency "rspec"
19
21
  gem.add_development_dependency "fakeweb"
20
22
  end
@@ -0,0 +1,147 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
29
+
30
+ <html>
31
+ <head>
32
+ <title>Openfire Admin Console</title>
33
+ <script language="JavaScript" type="text/javascript">
34
+ <!--
35
+ // break out of frames
36
+ if (self.parent.frames.length != 0) {
37
+ self.parent.location=document.location;
38
+ }
39
+ function updateFields(el) {
40
+ if (el.checked) {
41
+ document.loginForm.username.disabled = true;
42
+ document.loginForm.password.disabled = true;
43
+ }
44
+ else {
45
+ document.loginForm.username.disabled = false;
46
+ document.loginForm.password.disabled = false;
47
+ document.loginForm.username.focus();
48
+ }
49
+ }
50
+ //-->
51
+ </script>
52
+ <link rel="stylesheet" href="style/global.css" type="text/css">
53
+ <link rel="stylesheet" href="style/login.css" type="text/css">
54
+ </head>
55
+
56
+ <body>
57
+
58
+ <form action="login.jsp" name="loginForm" method="post">
59
+
60
+
61
+
62
+ <input type="hidden" name="login" value="true">
63
+
64
+ <div align="center">
65
+ <!-- BEGIN login box -->
66
+ <div id="jive-loginBox">
67
+
68
+ <div align="center" id="jive-loginTable">
69
+
70
+ <span id="jive-login-header" style="background: transparent url(images/login_logo.gif) no-repeat left; padding: 29px 0 10px 205px;">
71
+ Administration Console
72
+ </span>
73
+
74
+ <div style="text-align: center; width: 380px;">
75
+ <table cellpadding="0" cellspacing="0" border="0" align="center">
76
+ <tr>
77
+ <td align="right" class="loginFormTable">
78
+
79
+ <table cellpadding="2" cellspacing="0" border="0">
80
+ <noscript>
81
+ <tr>
82
+ <td colspan="3">
83
+ <table cellpadding="0" cellspacing="0" border="0">
84
+ <tr valign="top">
85
+ <td><img src="images/error-16x16.gif" width="16" height="16" border="0" alt="" vspace="2"></td>
86
+ <td><div class="jive-error-text" style="padding-left:5px; color:#cc0000;">Error: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page.</div></td>
87
+ </tr>
88
+ </table>
89
+ </td>
90
+ </tr>
91
+ </noscript>
92
+
93
+ <tr>
94
+ <td colspan="3">
95
+ <table cellpadding="0" cellspacing="0" border="0">
96
+
97
+ <tr valign="top">
98
+ <td><img src="images/error-16x16.gif" width="16" height="16" border="0" alt="" vspace="2"></td>
99
+ <td><div class="jive-error-text" style="padding-left:5px; color:#cc0000;">Login failed: make sure your username and password are correct and that you're an admin or moderator.</div></td>
100
+ </tr>
101
+
102
+ </table>
103
+ </td>
104
+ </tr>
105
+
106
+ <tr>
107
+ <td><input type="text" name="username" size="15" maxlength="50" id="u01" value="badusername"></td>
108
+ <td><input type="password" name="password" size="15" maxlength="50" id="p01"></td>
109
+ <td align="center"><input type="submit" value="&nbsp; Login &nbsp;"></td>
110
+ </tr>
111
+ <tr valign="top">
112
+ <td class="jive-login-label"><label for="u01">username</label></td>
113
+ <td class="jive-login-label"><label for="p01">password</label></td>
114
+ <td>&nbsp;</td>
115
+ </tr>
116
+ </table>
117
+ </td>
118
+ </tr>
119
+ <tr>
120
+ <td align="right">
121
+ <div align="right" id="jive-loginVersion">
122
+ Openfire, Version: 3.8.2
123
+ </div>
124
+ </td>
125
+ </tr>
126
+ </table>
127
+ </div>
128
+ </div>
129
+
130
+ </div>
131
+ <!-- END login box -->
132
+ </div>
133
+
134
+ </form>
135
+
136
+ <script language="JavaScript" type="text/javascript">
137
+ <!--
138
+ if (document.loginForm.username.value == '') {
139
+ document.loginForm.username.focus();
140
+ } else {
141
+ document.loginForm.password.focus();
142
+ }
143
+ //-->
144
+ </script>
145
+
146
+ </body>
147
+ </html>
@@ -59,6 +59,20 @@ describe OpenfireAdmin::Client do
59
59
  }
60
60
  client.logined?.should be_true
61
61
  end
62
+ it "login fail" do
63
+ client = OpenfireAdmin.new
64
+ client.logined?.should be_false
65
+ proc {
66
+ expect_post( "/login.jsp",{
67
+ "login"=>"true",
68
+ "password"=>"bbb",
69
+ "username"=>"aaa"},
70
+ "/login-fail.jsp"){
71
+ client.login("aaa","bbb")
72
+ }
73
+ }.should raise_error( OpenfireAdmin::ResponceException, /Login failed/ )
74
+ client.logined?.should be_false
75
+ end
62
76
  it "can operate setup mode" do
63
77
  client = OpenfireAdmin.new
64
78
  expect_get( "/login.jsp", :body=>"hoge"){
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,19 @@
1
1
  require 'rubygems'
2
- require 'bundler/setup'
2
+ begin
3
+ require 'coveralls'
4
+ Coveralls.wear!
5
+ rescue LoadError
6
+ end
3
7
 
8
+ require 'bundler/setup'
4
9
  require 'openfire_admin'
5
10
  require 'fakeweb'
6
11
 
12
+ unless URI.respond_to?(:decode_www_form) # for ruby 1.8
13
+ require File.dirname(__FILE__)+"/uri_backport"
14
+ end
15
+
16
+
7
17
  module FakeWebHelper
8
18
  def path_of(url)
9
19
  "http://localhost:9090#{url}"
@@ -59,6 +69,7 @@ module FakeWebHelper
59
69
  FakeWeb.allow_net_connect = false
60
70
  ret = yield
61
71
  FakeWeb.clean_registry
72
+ FakeWeb.allow_net_connect = true
62
73
  ret
63
74
  end
64
75
  def expect_get(path,option)
@@ -87,5 +98,4 @@ end
87
98
 
88
99
  RSpec.configure do |config|
89
100
  config.include FakeWebHelper
90
- # some (optional) config here
91
101
  end
@@ -0,0 +1,131 @@
1
+ # Taken from Ruby 1.9's uri/common.rb
2
+ # By Akira Yamada <akira@ruby-lang.org>
3
+ # License:
4
+ # You can redistribute it and/or modify it under the same term as Ruby.
5
+
6
+ require 'uri'
7
+
8
+ # Backport Ruby 1.9's form encoding/decoding functionality
9
+ module URI
10
+ TBLENCWWWCOMP_ = {} # :nodoc:
11
+ 256.times do |i|
12
+ TBLENCWWWCOMP_[i.chr] = '%%%02X' % i
13
+ end
14
+ TBLENCWWWCOMP_[' '] = '+'
15
+ TBLENCWWWCOMP_.freeze
16
+ TBLDECWWWCOMP_ = {} # :nodoc:
17
+ 256.times do |i|
18
+ h, l = i>>4, i&15
19
+ TBLDECWWWCOMP_['%%%X%X' % [h, l]] = i.chr
20
+ TBLDECWWWCOMP_['%%%x%X' % [h, l]] = i.chr
21
+ TBLDECWWWCOMP_['%%%X%x' % [h, l]] = i.chr
22
+ TBLDECWWWCOMP_['%%%x%x' % [h, l]] = i.chr
23
+ end
24
+ TBLDECWWWCOMP_['+'] = ' '
25
+ TBLDECWWWCOMP_.freeze
26
+
27
+ # Encode given +str+ to URL-encoded form data.
28
+ #
29
+ # This method doesn't convert *, -, ., 0-9, A-Z, _, a-z, but does convert SP
30
+ # (ASCII space) to + and converts others to %XX.
31
+ #
32
+ # This is an implementation of
33
+ # http://www.w3.org/TR/html5/association-of-controls-and-forms.html#url-encoded-form-data
34
+ #
35
+ # See URI.decode_www_form_component, URI.encode_www_form
36
+ def self.encode_www_form_component(str)
37
+ str.to_s.gsub(/[^*\-.0-9A-Z_a-z]/) { |chr| TBLENCWWWCOMP_[chr] }
38
+ end
39
+
40
+ # Decode given +str+ of URL-encoded form data.
41
+ #
42
+ # This decods + to SP.
43
+ #
44
+ # See URI.encode_www_form_component, URI.decode_www_form
45
+ def self.decode_www_form_component(str)
46
+ raise ArgumentError, "invalid %-encoding (#{str})" unless /\A[^%]*(?:%[a-fA-F0-9][a-fA-F0-9][^%]*)*\z/ =~ str
47
+ str.gsub(/\+|%[a-fA-F0-9][a-fA-F0-9]/) { |chr| TBLDECWWWCOMP_[chr] }
48
+ end
49
+
50
+ # Generate URL-encoded form data from given +enum+.
51
+ #
52
+ # This generates application/x-www-form-urlencoded data defined in HTML5
53
+ # from given an Enumerable object.
54
+ #
55
+ # This internally uses URI.encode_www_form_component(str).
56
+ #
57
+ # This method doesn't convert the encoding of given items, so convert them
58
+ # before call this method if you want to send data as other than original
59
+ # encoding or mixed encoding data. (Strings which are encoded in an HTML5
60
+ # ASCII incompatible encoding are converted to UTF-8.)
61
+ #
62
+ # This method doesn't handle files. When you send a file, use
63
+ # multipart/form-data.
64
+ #
65
+ # This is an implementation of
66
+ # http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
67
+ #
68
+ # URI.encode_www_form([["q", "ruby"], ["lang", "en"]])
69
+ # #=> "q=ruby&lang=en"
70
+ # URI.encode_www_form("q" => "ruby", "lang" => "en")
71
+ # #=> "q=ruby&lang=en"
72
+ # URI.encode_www_form("q" => ["ruby", "perl"], "lang" => "en")
73
+ # #=> "q=ruby&q=perl&lang=en"
74
+ # URI.encode_www_form([["q", "ruby"], ["q", "perl"], ["lang", "en"]])
75
+ # #=> "q=ruby&q=perl&lang=en"
76
+ #
77
+ # See URI.encode_www_form_component, URI.decode_www_form
78
+ def self.encode_www_form(enum)
79
+ enum.map do |k,v|
80
+ if v.nil?
81
+ encode_www_form_component(k)
82
+ elsif v.respond_to?(:to_ary)
83
+ v.to_ary.map do |w|
84
+ str = encode_www_form_component(k)
85
+ unless w.nil?
86
+ str << '='
87
+ str << encode_www_form_component(w)
88
+ end
89
+ end.join('&')
90
+ else
91
+ str = encode_www_form_component(k)
92
+ str << '='
93
+ str << encode_www_form_component(v)
94
+ end
95
+ end.join('&')
96
+ end
97
+
98
+ WFKV_ = '(?:[^%#=;&]*(?:%[a-fA-F0-9][a-fA-F0-9][^%#=;&]*)*)' # :nodoc:
99
+
100
+ # Decode URL-encoded form data from given +str+.
101
+ #
102
+ # This decodes application/x-www-form-urlencoded data
103
+ # and returns array of key-value array.
104
+ # This internally uses URI.decode_www_form_component.
105
+ #
106
+ # _charset_ hack is not supported now because the mapping from given charset
107
+ # to Ruby's encoding is not clear yet.
108
+ # see also http://www.w3.org/TR/html5/syntax.html#character-encodings-0
109
+ #
110
+ # This refers http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
111
+ #
112
+ # ary = URI.decode_www_form("a=1&a=2&b=3")
113
+ # p ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
114
+ # p ary.assoc('a').last #=> '1'
115
+ # p ary.assoc('b').last #=> '3'
116
+ # p ary.rassoc('a').last #=> '2'
117
+ # p Hash[ary] # => {"a"=>"2", "b"=>"3"}
118
+ #
119
+ # See URI.decode_www_form_component, URI.encode_www_form
120
+ def self.decode_www_form(str)
121
+ return [] if str.empty?
122
+ unless /\A#{WFKV_}=#{WFKV_}(?:[;&]#{WFKV_}=#{WFKV_})*\z/o =~ str
123
+ raise ArgumentError, "invalid data of application/x-www-form-urlencoded (#{str})"
124
+ end
125
+ ary = []
126
+ $&.scan(/([^=;&]+)=([^;&]*)/) do
127
+ ary << [decode_www_form_component($1), decode_www_form_component($2)]
128
+ end
129
+ ary
130
+ end
131
+ end
metadata CHANGED
@@ -1,48 +1,66 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: openfire_admin
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - nazoking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2013-10-08 00:00:00 +09:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
11
+ date: 2014-05-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rehtml
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
16
28
  name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
17
34
  type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
26
42
  name: fakeweb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
27
48
  type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
- description: Manipurate Openfire admin console
36
- email:
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Control for Openfire admin console
56
+ email:
37
57
  - nazoking@gmai.com
38
58
  executables: []
39
-
40
59
  extensions: []
41
-
42
60
  extra_rdoc_files: []
43
-
44
- files:
61
+ files:
45
62
  - .gitignore
63
+ - .travis.yml
46
64
  - Gemfile
47
65
  - LICENSE
48
66
  - README.md
@@ -50,6 +68,7 @@ files:
50
68
  - lib/openfire_admin.rb
51
69
  - lib/openfire_admin/admin_client.rb
52
70
  - lib/openfire_admin/client.rb
71
+ - lib/openfire_admin/html_parser.rb
53
72
  - lib/openfire_admin/http_client.rb
54
73
  - lib/openfire_admin/plugin.rb
55
74
  - lib/openfire_admin/property_map.rb
@@ -59,6 +78,7 @@ files:
59
78
  - lib/openfire_admin/user_admin.rb
60
79
  - lib/openfire_admin/version.rb
61
80
  - openfire_admin.gemspec
81
+ - spec/fixtures/login-fail.jsp
62
82
  - spec/fixtures/plugin-admin.jsp
63
83
  - spec/fixtures/server-properties.jsp
64
84
  - spec/fixtures/server-properties_password.jsp
@@ -67,33 +87,32 @@ files:
67
87
  - spec/fixtures/versions.xml
68
88
  - spec/openfire_admin_spec.rb
69
89
  - spec/spec_helper.rb
70
- has_rdoc: false
71
- homepage: ""
90
+ - spec/uri_backport.rb
91
+ homepage: https://github.com/nazoking/openfire_admin
92
+ licenses: []
93
+ metadata: {}
72
94
  post_install_message:
73
95
  rdoc_options: []
74
-
75
- require_paths:
96
+ require_paths:
76
97
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: "0"
82
- version:
83
- required_rubygems_version: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- version: "0"
88
- version:
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
89
108
  requirements: []
90
-
91
109
  rubyforge_project:
92
- rubygems_version: 1.3.1
110
+ rubygems_version: 2.2.2
93
111
  signing_key:
94
- specification_version: 2
95
- summary: ""
96
- test_files:
112
+ specification_version: 4
113
+ summary: Control for Openfire admin console
114
+ test_files:
115
+ - spec/fixtures/login-fail.jsp
97
116
  - spec/fixtures/plugin-admin.jsp
98
117
  - spec/fixtures/server-properties.jsp
99
118
  - spec/fixtures/server-properties_password.jsp
@@ -102,3 +121,4 @@ test_files:
102
121
  - spec/fixtures/versions.xml
103
122
  - spec/openfire_admin_spec.rb
104
123
  - spec/spec_helper.rb
124
+ - spec/uri_backport.rb