doc/classes/MediaWiki/Config.html in mediawiki-gateway-0.1.0 vs doc/classes/MediaWiki/Config.html in mediawiki-gateway-0.1.1

- old
+ new

@@ -53,12 +53,12 @@ <td class="class-name-in-header">MediaWiki::Config</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> - <a href="../../files/media_wiki/config_rb.html"> - media_wiki/config.rb + <a href="../../files/lib/media_wiki/config_rb.html"> + lib/media_wiki/config.rb </a> <br /> </td> </tr> @@ -84,12 +84,12 @@ <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> - <a href="#M000023">abort</a>&nbsp;&nbsp; - <a href="#M000022">new</a>&nbsp;&nbsp; + <a href="#M000025">abort</a>&nbsp;&nbsp; + <a href="#M000024">new</a>&nbsp;&nbsp; </div> </div> </div> @@ -155,101 +155,101 @@ <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Class methods</h3> - <div id="method-M000022" class="method-detail"> - <a name="M000022"></a> + <div id="method-M000024" class="method-detail"> + <a name="M000024"></a> <div class="method-heading"> - <a href="#M000022" class="method-signature"> + <a href="#M000024" class="method-signature"> <span class="method-name">new</span><span class="method-args">(args, type = &quot;read&quot;)</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000022-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000022-source"> + onclick="toggleCode('M000024-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000024-source"> <pre> - <span class="ruby-comment cmt"># File media_wiki/config.rb, line 9</span> - 9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">type</span> = <span class="ruby-value str">&quot;read&quot;</span>) -10: <span class="ruby-ivar">@summary</span> = <span class="ruby-value str">&quot;Automated edit via MediaWiki::Gateway&quot;</span> -11: <span class="ruby-ivar">@opts</span> = <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span> -12: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-value str">&quot;Usage: [options]&quot;</span> -13: -14: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-h&quot;</span>, <span class="ruby-value str">&quot;--host HOST&quot;</span>, <span class="ruby-value str">&quot;Use preconfigured HOST in config/hosts.yml&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">host_id</span><span class="ruby-operator">|</span> -15: <span class="ruby-identifier">yaml</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load_file</span>(<span class="ruby-value str">'config/hosts.yml'</span>) -16: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">yaml</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">host_id</span> -17: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">yaml</span>[<span class="ruby-identifier">host_id</span>] -18: <span class="ruby-ivar">@url</span> = <span class="ruby-identifier">host</span>[<span class="ruby-value str">'url'</span>] -19: <span class="ruby-ivar">@pw</span> = <span class="ruby-identifier">host</span>[<span class="ruby-value str">'pw'</span>] -20: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">host</span>[<span class="ruby-value str">'user'</span>] -21: <span class="ruby-keyword kw">else</span> -22: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Host #{host_id} not found in config/hosts.yml&quot;</span> -23: <span class="ruby-keyword kw">end</span> -24: <span class="ruby-keyword kw">end</span> -25: -26: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;upload&quot;</span> -27: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-d&quot;</span>, <span class="ruby-value str">&quot;--description DESCRIPTION&quot;</span>, <span class="ruby-value str">&quot;Description of file to upload&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">desc</span><span class="ruby-operator">|</span> -28: <span class="ruby-ivar">@desc</span> = <span class="ruby-identifier">desc</span> -29: <span class="ruby-keyword kw">end</span> -30: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-t&quot;</span>, <span class="ruby-value str">&quot;--target-file TARGET-FILE&quot;</span>, <span class="ruby-value str">&quot;Target file name to upload to&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">target</span><span class="ruby-operator">|</span> -31: <span class="ruby-ivar">@target</span> = <span class="ruby-identifier">target</span> -32: <span class="ruby-keyword kw">end</span> -33: <span class="ruby-keyword kw">else</span> -34: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-a&quot;</span>, <span class="ruby-value str">&quot;--article ARTICLE&quot;</span>, <span class="ruby-value str">&quot;Name of article in Wiki&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">article</span><span class="ruby-operator">|</span> -35: <span class="ruby-ivar">@article</span> = <span class="ruby-identifier">article</span> -36: <span class="ruby-keyword kw">end</span> -37: <span class="ruby-keyword kw">end</span> -38: -39: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-n&quot;</span>, <span class="ruby-value str">&quot;--username USERNAME&quot;</span>, <span class="ruby-value str">&quot;Username for login&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">user</span><span class="ruby-operator">|</span> -40: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">user</span> -41: <span class="ruby-keyword kw">end</span> -42: -43: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;--password PASSWORD&quot;</span>, <span class="ruby-value str">&quot;Password for login&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pw</span><span class="ruby-operator">|</span> -44: <span class="ruby-ivar">@pw</span> = <span class="ruby-identifier">pw</span> -45: <span class="ruby-keyword kw">end</span> -46: -47: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;read&quot;</span> -48: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-s&quot;</span>, <span class="ruby-value str">&quot;--summary SUMMARY&quot;</span>, <span class="ruby-value str">&quot;Edit summary for this change&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">summary</span><span class="ruby-operator">|</span> -49: <span class="ruby-ivar">@summary</span> = <span class="ruby-identifier">summary</span> -50: <span class="ruby-keyword kw">end</span> -51: <span class="ruby-keyword kw">end</span> -52: -53: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-u&quot;</span>, <span class="ruby-value str">&quot;--url URL&quot;</span>, <span class="ruby-value str">&quot;MediaWiki API URL&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">url</span><span class="ruby-operator">|</span> -54: <span class="ruby-ivar">@url</span> = <span class="ruby-identifier">url</span> -55: <span class="ruby-keyword kw">end</span> -56: <span class="ruby-keyword kw">end</span> -57: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">parse!</span> -58: <span class="ruby-identifier">abort</span>(<span class="ruby-value str">&quot;URL (-u) or valid host (-h) is mandatory.&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@url</span> -59: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/media_wiki/config.rb, line 10</span> +10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">type</span> = <span class="ruby-value str">&quot;read&quot;</span>) +11: <span class="ruby-ivar">@summary</span> = <span class="ruby-value str">&quot;Automated edit via MediaWiki::Gateway&quot;</span> +12: <span class="ruby-ivar">@opts</span> = <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span> +13: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-value str">&quot;Usage: [options]&quot;</span> +14: +15: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-h&quot;</span>, <span class="ruby-value str">&quot;--host HOST&quot;</span>, <span class="ruby-value str">&quot;Use preconfigured HOST in config/hosts.yml&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">host_id</span><span class="ruby-operator">|</span> +16: <span class="ruby-identifier">yaml</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load_file</span>(<span class="ruby-value str">'config/hosts.yml'</span>) +17: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">yaml</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">host_id</span> +18: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">yaml</span>[<span class="ruby-identifier">host_id</span>] +19: <span class="ruby-ivar">@url</span> = <span class="ruby-identifier">host</span>[<span class="ruby-value str">'url'</span>] +20: <span class="ruby-ivar">@pw</span> = <span class="ruby-identifier">host</span>[<span class="ruby-value str">'pw'</span>] +21: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">host</span>[<span class="ruby-value str">'user'</span>] +22: <span class="ruby-keyword kw">else</span> +23: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Host #{host_id} not found in config/hosts.yml&quot;</span> +24: <span class="ruby-keyword kw">end</span> +25: <span class="ruby-keyword kw">end</span> +26: +27: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;upload&quot;</span> +28: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-d&quot;</span>, <span class="ruby-value str">&quot;--description DESCRIPTION&quot;</span>, <span class="ruby-value str">&quot;Description of file to upload&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">desc</span><span class="ruby-operator">|</span> +29: <span class="ruby-ivar">@desc</span> = <span class="ruby-identifier">desc</span> +30: <span class="ruby-keyword kw">end</span> +31: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-t&quot;</span>, <span class="ruby-value str">&quot;--target-file TARGET-FILE&quot;</span>, <span class="ruby-value str">&quot;Target file name to upload to&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">target</span><span class="ruby-operator">|</span> +32: <span class="ruby-ivar">@target</span> = <span class="ruby-identifier">target</span> +33: <span class="ruby-keyword kw">end</span> +34: <span class="ruby-keyword kw">else</span> +35: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-a&quot;</span>, <span class="ruby-value str">&quot;--article ARTICLE&quot;</span>, <span class="ruby-value str">&quot;Name of article in Wiki&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">article</span><span class="ruby-operator">|</span> +36: <span class="ruby-ivar">@article</span> = <span class="ruby-identifier">article</span> +37: <span class="ruby-keyword kw">end</span> +38: <span class="ruby-keyword kw">end</span> +39: +40: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-n&quot;</span>, <span class="ruby-value str">&quot;--username USERNAME&quot;</span>, <span class="ruby-value str">&quot;Username for login&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">user</span><span class="ruby-operator">|</span> +41: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">user</span> +42: <span class="ruby-keyword kw">end</span> +43: +44: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;--password PASSWORD&quot;</span>, <span class="ruby-value str">&quot;Password for login&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pw</span><span class="ruby-operator">|</span> +45: <span class="ruby-ivar">@pw</span> = <span class="ruby-identifier">pw</span> +46: <span class="ruby-keyword kw">end</span> +47: +48: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;read&quot;</span> +49: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-s&quot;</span>, <span class="ruby-value str">&quot;--summary SUMMARY&quot;</span>, <span class="ruby-value str">&quot;Edit summary for this change&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">summary</span><span class="ruby-operator">|</span> +50: <span class="ruby-ivar">@summary</span> = <span class="ruby-identifier">summary</span> +51: <span class="ruby-keyword kw">end</span> +52: <span class="ruby-keyword kw">end</span> +53: +54: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-u&quot;</span>, <span class="ruby-value str">&quot;--url URL&quot;</span>, <span class="ruby-value str">&quot;MediaWiki API URL&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">url</span><span class="ruby-operator">|</span> +55: <span class="ruby-ivar">@url</span> = <span class="ruby-identifier">url</span> +56: <span class="ruby-keyword kw">end</span> +57: <span class="ruby-keyword kw">end</span> +58: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">parse!</span> +59: <span class="ruby-identifier">abort</span>(<span class="ruby-value str">&quot;URL (-u) or valid host (-h) is mandatory.&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@url</span> +60: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <h3 class="section-bar">Public Instance methods</h3> - <div id="method-M000023" class="method-detail"> - <a name="M000023"></a> + <div id="method-M000025" class="method-detail"> + <a name="M000025"></a> <div class="method-heading"> - <a href="#M000023" class="method-signature"> + <a href="#M000025" class="method-signature"> <span class="method-name">abort</span><span class="method-args">(error)</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000023-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000023-source"> + onclick="toggleCode('M000025-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000025-source"> <pre> - <span class="ruby-comment cmt"># File media_wiki/config.rb, line 61</span> -61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">abort</span>(<span class="ruby-identifier">error</span>) -62: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Error: #{error}\n\n#{@opts.to_s}&quot;</span> -63: <span class="ruby-identifier">exit</span> -64: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/media_wiki/config.rb, line 62</span> +62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">abort</span>(<span class="ruby-identifier">error</span>) +63: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Error: #{error}\n\n#{@opts.to_s}&quot;</span> +64: <span class="ruby-identifier">exit</span> +65: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> \ No newline at end of file