]> git.openstreetmap.org Git - chef.git/commitdiff
Fix issues reported by new rubocop
authorTom Hughes <tom@compton.nu>
Fri, 15 Jan 2016 23:05:34 +0000 (23:05 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 15 Jan 2016 23:05:34 +0000 (23:05 +0000)
24 files changed:
.rubocop.yml
cookbooks/chef/libraries/edit_file.rb
cookbooks/chef/libraries/random_password.rb
cookbooks/chef/libraries/subversion.rb
cookbooks/hardware/recipes/default.rb
cookbooks/munin/files/default/plugins/api_calls_
cookbooks/munin/files/default/plugins/api_calls_num
cookbooks/munin/files/default/plugins/api_calls_status
cookbooks/munin/files/default/plugins/api_waits_
cookbooks/mysql/libraries/mysql.rb
cookbooks/mysql/providers/database.rb
cookbooks/networking/libraries/interfaces.rb
cookbooks/networking/libraries/ipaddresses.rb
cookbooks/networking/recipes/default.rb
cookbooks/nfs/recipes/default.rb
cookbooks/nfs/recipes/server.rb
cookbooks/nodejs/providers/package.rb
cookbooks/nominatim/recipes/base.rb
cookbooks/postgresql/libraries/postgresql.rb
cookbooks/postgresql/providers/database.rb
cookbooks/postgresql/providers/table.rb
cookbooks/tile/files/default/ruby/expire.rb
cookbooks/web/definitions/rails_port.rb
cookbooks/wordpress/libraries/wordpress.rb

index 2219d6ec67ec53c4270a3eac6b94b8996b644936..23c3f82fc2644aadc8a36093d189c94859e0a541 100644 (file)
@@ -18,9 +18,5 @@ Style/FileName:
 Style/HashSyntax:
   EnforcedStyle: hash_rockets
 
 Style/HashSyntax:
   EnforcedStyle: hash_rockets
 
-Style/SingleSpaceBeforeFirstArg:
-  Exclude:
-    - '**/metadata.rb'
-
 Style/StringLiterals:
   EnforcedStyle: double_quotes
 Style/StringLiterals:
   EnforcedStyle: double_quotes
index 6260c8a40c182f937e592ca882d91c32035b1e5a..bfbec455cebc82d00acc90725b70b627c9e3f36a 100644 (file)
@@ -1,10 +1,10 @@
 class Chef
   module Mixin
     module EditFile
 class Chef
   module Mixin
     module EditFile
-      def edit_file(file, &block)
+      def edit_file(file, &_block)
         Chef::DelayedEvaluator.new do
           ::File.new(file).collect do |line|
         Chef::DelayedEvaluator.new do
           ::File.new(file).collect do |line|
-            block.call(line)
+            yield line
           end.join("")
         end
       end
           end.join("")
         end
       end
index f8c6674da93537a3975cad0ab92cdfed5fb0a4ef..71d8bcfededf136192f6e2b6aadb7d334321e002 100644 (file)
@@ -1,7 +1,7 @@
 class Chef
   class Recipe
     def random_password(length)
 class Chef
   class Recipe
     def random_password(length)
-      length.times.collect do
+      Array.new(length) do
         "!\#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"[rand(91)].chr
       end.join
     end
         "!\#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"[rand(91)].chr
       end.join
     end
index b5ac6f3010d535fd3085fec2d199ab8e08258e14..dd2c7ec4925abaf9d26d578feebb9295e4188653 100644 (file)
@@ -17,20 +17,18 @@ class Chef
       end
 
       def current_repository_matches_target_repository?
       end
 
       def current_repository_matches_target_repository?
-        (!current_repository.nil?) && (@new_resource.repository == current_repository)
+        !current_repository.nil? && (@new_resource.repository == current_repository)
       end
 
       def repo_attrs
         return {} unless ::File.exist?(::File.join(@new_resource.destination, ".svn"))
 
         @repo_attrs ||= svn_info.lines.each_with_object({}) do |line, attrs|
       end
 
       def repo_attrs
         return {} unless ::File.exist?(::File.join(@new_resource.destination, ".svn"))
 
         @repo_attrs ||= svn_info.lines.each_with_object({}) do |line, attrs|
-          if line =~ SVN_INFO_PATTERN
-            property = Regexp.last_match[1]
-            value = Regexp.last_match[2]
-            attrs[property] = value
-          else
-            fail "Could not parse `svn info` data: #{line}"
-          end
+          fail "Could not parse `svn info` data: #{line}" unless line =~ SVN_INFO_PATTERN
+
+          property = Regexp.last_match[1]
+          value = Regexp.last_match[2]
+          attrs[property] = value
         end
       end
 
         end
       end
 
index 8ba21da8bc18e491c83617786dea50b74d16251b..8342a9ac3f78921c59055d5ddd53e2f4a62425c7 100644 (file)
@@ -297,11 +297,11 @@ end
   end
 end
 
   end
 end
 
-if node[:hardware][:disk]
-  disks = node[:hardware][:disk][:disks]
-else
-  disks = []
-end
+disks = if node[:hardware][:disk]
+          node[:hardware][:disk][:disks]
+        else
+          []
+        end
 
 disks = disks.map do |disk|
   next if disk[:state] == "spun_down"
 
 disks = disks.map do |disk|
   next if disk[:state] == "spun_down"
@@ -476,15 +476,15 @@ unless Dir.glob("/sys/class/hwmon/hwmon*").empty?
     cpu = File.basename(coretemp).sub("coretemp.", "").to_i
     chip = format("coretemp-isa-%04d", cpu)
 
     cpu = File.basename(coretemp).sub("coretemp.", "").to_i
     chip = format("coretemp-isa-%04d", cpu)
 
-    if File.exist?("#{coretemp}/name")
-      temps = Dir.glob("#{coretemp}/temp*_input").map do |temp|
-        File.basename(temp).sub("temp", "").sub("_input", "").to_i
-      end.sort
-    else
-      temps = Dir.glob("#{coretemp}/hwmon/hwmon*/temp*_input").map do |temp|
-        File.basename(temp).sub("temp", "").sub("_input", "").to_i
-      end.sort
-    end
+    temps = if File.exist?("#{coretemp}/name")
+              Dir.glob("#{coretemp}/temp*_input").map do |temp|
+                File.basename(temp).sub("temp", "").sub("_input", "").to_i
+              end.sort
+            else
+              Dir.glob("#{coretemp}/hwmon/hwmon*/temp*_input").map do |temp|
+                File.basename(temp).sub("temp", "").sub("_input", "").to_i
+              end.sort
+            end
 
     if temps.first == 1
       node.default[:hardware][:sensors][chip][:temps][:temp1][:label] = "CPU #{cpu}"
 
     if temps.first == 1
       node.default[:hardware][:sensors][chip][:temps][:temp1][:label] = "CPU #{cpu}"
index 158bf90040bb3e2b722de77ad5a63ccada50df1d..17bba1625aeb57b7b4e6823de1b423f89065f437 100755 (executable)
@@ -26,7 +26,7 @@ CALL_TYPES = {
   :trkpts => "GPX trackpoints calls",
   :web => "Web site traffic",
   :other => "Other API calls"
   :trkpts => "GPX trackpoints calls",
   :web => "Web site traffic",
   :other => "Other API calls"
-}
+}.freeze
 
 def categorise_uri(line)
   uri = line.split(" ")[1]
 
 def categorise_uri(line)
   uri = line.split(" ")[1]
index 443af2c193565025e9a303323807dd8b00975265..e2f74d9fff691727ac88c0d059ce6d2fc851efa8 100755 (executable)
@@ -11,7 +11,7 @@ CALL_TYPES = {
   :trkpts => "GPX trackpoints calls",
   :web => "Web site traffic",
   :other => "Other API calls"
   :trkpts => "GPX trackpoints calls",
   :web => "Web site traffic",
   :other => "Other API calls"
-}
+}.freeze
 
 if ARGV[0] == "config"
   puts "graph_title Requests processed"
 
 if ARGV[0] == "config"
   puts "graph_title Requests processed"
index 6d0e619ed5e637ce15b19119f12244260fddb4ca..1f18a453bcd84147f905aa48bd8c8cc11f9102ff 100755 (executable)
@@ -23,7 +23,7 @@ HTTP_STATUSES = {
   "502" => "Bad Gateway",
   "503" => "Service Unavailable",
   "509" => "Bandwidth Limit Exceeded"
   "502" => "Bad Gateway",
   "503" => "Service Unavailable",
   "509" => "Bandwidth Limit Exceeded"
-}
+}.freeze
 
 if ARGV[0] == "config"
   puts "graph_title HTTP response codes"
 
 if ARGV[0] == "config"
   puts "graph_title HTTP response codes"
index d072b89d58f8f6be2ca306162df62849e5044d3e..49216861ab63bd9eb26f97bf8ffbe5b2be4bb00e 100755 (executable)
@@ -26,7 +26,7 @@ CALL_TYPES = {
   :trkpts => "GPX trackpoints calls",
   :web => "Web site traffic",
   :other => "Other API calls"
   :trkpts => "GPX trackpoints calls",
   :web => "Web site traffic",
   :other => "Other API calls"
-}
+}.freeze
 
 def categorise_uri(line)
   uri = line.split(" ")[1]
 
 def categorise_uri(line)
   uri = line.split(" ")[1]
index 91eb6f9d1c5527f2c4a36e17505e2ff8ab15a72e..61d600f1d547cab5fd985de442520a0418315483 100644 (file)
@@ -11,14 +11,14 @@ class Chef
       :show_db, :super, :create_tmp_table, :lock_tables, :execute,
       :repl_slave, :repl_client, :create_view, :show_view, :create_routine,
       :alter_routine, :create_user, :event, :trigger, :create_tablespace
       :show_db, :super, :create_tmp_table, :lock_tables, :execute,
       :repl_slave, :repl_client, :create_view, :show_view, :create_routine,
       :alter_routine, :create_user, :event, :trigger, :create_tablespace
-    ]
+    ].freeze
 
     DATABASE_PRIVILEGES = [
       :select, :insert, :update, :delete, :create, :drop, :grant,
       :references, :index, :alter, :create_tmp_table, :lock_tables,
       :create_view, :show_view, :create_routine, :alter_routine,
       :execute, :event, :trigger
 
     DATABASE_PRIVILEGES = [
       :select, :insert, :update, :delete, :create, :drop, :grant,
       :references, :index, :alter, :create_tmp_table, :lock_tables,
       :create_view, :show_view, :create_routine, :alter_routine,
       :execute, :event, :trigger
-    ]
+    ].freeze
 
     def execute(options)
       # Create argument array
 
     def execute(options)
       # Create argument array
index 6e488ce476c6ee774b311beb8a520c1175b4b7a6..345ef7e1ebdf68266c4b3150ee10227fb5a6d4f3 100644 (file)
@@ -65,12 +65,10 @@ action :create do
             @mysql.execute(:command => "GRANT #{@mysql.privilege_name(privilege)} ON `#{new_resource.database}`.* TO #{user}")
           end
         end
             @mysql.execute(:command => "GRANT #{@mysql.privilege_name(privilege)} ON `#{new_resource.database}`.* TO #{user}")
           end
         end
-      else
-        if current_privileges.include?(privilege)
-          converge_by("revoke #{privilege} for #{user} on #{new_resource}") do
-            Chef::Log.info("Revoking #{privilege} for #{user} on #{new_resource}")
-            @mysql.execute(:command => "REVOKE #{@mysql.privilege_name(privilege)} ON `#{new_resource.database}`.* FROM #{user}")
-          end
+      elsif current_privileges.include?(privilege)
+        converge_by("revoke #{privilege} for #{user} on #{new_resource}") do
+          Chef::Log.info("Revoking #{privilege} for #{user} on #{new_resource}")
+          @mysql.execute(:command => "REVOKE #{@mysql.privilege_name(privilege)} ON `#{new_resource.database}`.* FROM #{user}")
         end
       end
     end
         end
       end
     end
index 029cb4f32425242b3ace2a6a844df9c8e7cb3cdc..c2f170b9c73a2f56c290d0a0f3cc38110c563eae 100644 (file)
@@ -13,7 +13,7 @@ class Chef
         if block.nil?
           interfaces << interface
         else
         if block.nil?
           interfaces << interface
         else
-          block.call(interface)
+          yield interface
         end
       end
 
         end
       end
 
index 5eb54265e02ae8d57e79255a03041bd5bceeb743..51ef152b52fab21ee07c891f5ccdfe48886ac6b4 100644 (file)
@@ -7,7 +7,7 @@ class Chef
         if block.nil?
           addresses << interface[:address]
         else
         if block.nil?
           addresses << interface[:address]
         else
-          block.call(interface[:address])
+          yield interface[:address]
         end
       end
 
         end
       end
 
index 477a15b240741795c392b88d10db8d0a5365a092..ab139e9fff80b8b9afa30116760f3067cc493590 100644 (file)
@@ -35,7 +35,7 @@ node[:networking][:interfaces].each do |name, interface|
 
   prefix = node[:networking][:interfaces][name][:prefix]
 
 
   prefix = node[:networking][:interfaces][name][:prefix]
 
-  node.set[:networking][:interfaces][name][:netmask] = (~IPAddr.new(interface[:address]).mask(0)).mask(prefix)
+  node.set[:networking][:interfaces][name][:netmask] = ~IPAddr.new(interface[:address]).mask(0).mask(prefix)
   node.set[:networking][:interfaces][name][:network] = IPAddr.new(interface[:address]).mask(prefix)
 end
 
   node.set[:networking][:interfaces][name][:network] = IPAddr.new(interface[:address]).mask(prefix)
 end
 
index 8d44e2bd62673550c8e77f8042b6d4f6b8492644..f4c6016bbd7604b3a7b853bd56cb74cbab6efe44 100644 (file)
 package "nfs-common"
 
 node[:nfs].each do |mountpoint, details|
 package "nfs-common"
 
 node[:nfs].each do |mountpoint, details|
-  if details[:readonly]
-    mount_options = "ro,bg,soft,udp,rsize=8192,wsize=8192,nfsvers=3"
-  else
-    mount_options = "rw,bg,udp,rsize=8192,wsize=8192,nfsvers=3"
-  end
+  mount_options = if details[:readonly]
+                    "ro,bg,soft,udp,rsize=8192,wsize=8192,nfsvers=3"
+                  else
+                    "rw,bg,udp,rsize=8192,wsize=8192,nfsvers=3"
+                  end
 
   directory mountpoint do
     owner "root"
 
   directory mountpoint do
     owner "root"
index f75e44e889880f920f4db5986f4fbd332ef4d3fa..33e5a315ea3097699421ed4cdfcf912aaed80087 100644 (file)
@@ -41,11 +41,11 @@ search(:node, "*:*") do |client|
     client.ipaddresses do |address|
       exports[mount[:path]] ||= {}
 
     client.ipaddresses do |address|
       exports[mount[:path]] ||= {}
 
-      if mount[:readonly]
-        exports[mount[:path]][address] = "ro"
-      else
-        exports[mount[:path]][address] = "rw"
-      end
+      exports[mount[:path]][address] = if mount[:readonly]
+                                         "ro"
+                                       else
+                                         "rw"
+                                       end
     end
   end
 end
     end
   end
 end
index 3a33040635c06b8cc0dcd642cd4b8bdd16a4bdae..4c852732fc61b71f682b70e00ebe32812ac24b2d 100644 (file)
@@ -34,21 +34,19 @@ def load_current_resource
 end
 
 action :install do
 end
 
 action :install do
-  if new_resource.version
-    package_name = "#{new_resource.package_name}@#{new_resource.version}"
-  else
-    package_name = new_resource.package_name
-  end
+  package_name = if new_resource.version
+                   "#{new_resource.package_name}@#{new_resource.version}"
+                 else
+                   new_resource.package_name
+                 end
 
   if !@packages.include?(new_resource.package_name)
     shell_out!("npm install --global #{package_name}")
     new_resource.updated_by_last_action(true)
 
   if !@packages.include?(new_resource.package_name)
     shell_out!("npm install --global #{package_name}")
     new_resource.updated_by_last_action(true)
-  else
-    if new_resource.version &&
-       new_resource.version != @current_resource.version
-      shell_out!("npm install --global #{package_name}")
-      new_resource.updated_by_last_action(true)
-    end
+  elsif new_resource.version &&
+        new_resource.version != @current_resource.version
+    shell_out!("npm install --global #{package_name}")
+    new_resource.updated_by_last_action(true)
   end
 end
 
   end
 end
 
index c8e996655b7dba2f93c561e7bc650244777951b7..8721ef0146e987bf4018cad29cd7b2d10575551f 100644 (file)
@@ -158,11 +158,11 @@ file "#{source_directory}/settings/ip_blocks.map" do
   mode 0664
 end
 
   mode 0664
 end
 
-if node[:nominatim][:enabled]
-  cron_action = :create
-else
-  cron_action = :delete
-end
+cron_action = if node[:nominatim][:enabled]
+                :create
+              else
+                :delete
+              end
 
 template "/etc/cron.d/nominatim" do
   action cron_action
 
 template "/etc/cron.d/nominatim" do
   action cron_action
index 6960ec9890b9db2c6d69855b52b0c9235f4466bb..266a7b83387182f5a7b81c730ee3e53cb5abf37d 100644 (file)
@@ -6,7 +6,7 @@ class Chef
 
     TABLE_PRIVILEGES = [
       :select, :insert, :update, :delete, :truncate, :references, :trigger
 
     TABLE_PRIVILEGES = [
       :select, :insert, :update, :delete, :truncate, :references, :trigger
-    ]
+    ].freeze
 
     def initialize(cluster)
       @cluster = cluster
 
     def initialize(cluster)
       @cluster = cluster
@@ -118,7 +118,7 @@ class Chef
         permissions[user] = {
           "a" => :insert, "r" => :select, "w" => :update, "d" => :delete,
           "D" => :truncate, "x" => :references, "t" => :trigger
         permissions[user] = {
           "a" => :insert, "r" => :select, "w" => :update, "d" => :delete,
           "D" => :truncate, "x" => :references, "t" => :trigger
-        }.values_at(*(privileges.chars)).compact
+        }.values_at(*privileges.chars).compact
       end
     end
   end
       end
     end
   end
index 31704314be414ecd1f12e77a7ce27e97a6221e60..a3a7cbc073b700737b9b4999f7c58c554481f955 100644 (file)
@@ -36,11 +36,9 @@ action :create do
   if !@pg.databases.include?(new_resource.database)
     @pg.execute(:command => "CREATE DATABASE \"#{new_resource.database}\" OWNER \"#{new_resource.owner}\" TEMPLATE template0 ENCODING '#{new_resource.encoding}' LC_COLLATE '#{new_resource.collation}' LC_CTYPE '#{new_resource.ctype}'")
     new_resource.updated_by_last_action(true)
   if !@pg.databases.include?(new_resource.database)
     @pg.execute(:command => "CREATE DATABASE \"#{new_resource.database}\" OWNER \"#{new_resource.owner}\" TEMPLATE template0 ENCODING '#{new_resource.encoding}' LC_COLLATE '#{new_resource.collation}' LC_CTYPE '#{new_resource.ctype}'")
     new_resource.updated_by_last_action(true)
-  else
-    if new_resource.owner != @current_resource.owner
-      @pg.execute(:command => "ALTER DATABASE \"#{new_resource.database}\" OWNER TO \"#{new_resource.owner}\"")
-      new_resource.updated_by_last_action(true)
-    end
+  elsif new_resource.owner != @current_resource.owner
+    @pg.execute(:command => "ALTER DATABASE \"#{new_resource.database}\" OWNER TO \"#{new_resource.owner}\"")
+    new_resource.updated_by_last_action(true)
   end
 end
 
   end
 end
 
index f162347ddab5fcec9e88bbde57372dc75145c120..b1dc67571aa7f26e1a85885074d3397021d93d48 100644 (file)
@@ -67,12 +67,10 @@ action :create do
               @pg.execute(:command => "GRANT #{privilege.to_s.upcase} ON #{@name} TO \"#{user}\"", :database => new_resource.database)
             end
           end
               @pg.execute(:command => "GRANT #{privilege.to_s.upcase} ON #{@name} TO \"#{user}\"", :database => new_resource.database)
             end
           end
-        else
-          if current_privileges.include?(privilege)
-            converge_by("revoke #{privilege} for #{user} on #{new_resource}") do
-              Chef::Log.info("Revoking #{privilege} for #{user} on #{new_resource}")
-              @pg.execute(:command => "REVOKE #{privilege.to_s.upcase} ON #{@name} FROM \"#{user}\"", :database => new_resource.database)
-            end
+        elsif current_privileges.include?(privilege)
+          converge_by("revoke #{privilege} for #{user} on #{new_resource}") do
+            Chef::Log.info("Revoking #{privilege} for #{user} on #{new_resource}")
+            @pg.execute(:command => "REVOKE #{privilege.to_s.upcase} ON #{@name} FROM \"#{user}\"", :database => new_resource.database)
           end
         end
       end
           end
         end
       end
index d695a0bc53de611f3a752fe424292ee1dc3bf560..8a212aa92f3904dc79d738c617a351aeacaf50b9 100755 (executable)
@@ -18,9 +18,9 @@ module Expire
   # the size of the meta tile blocks
   METATILE = 8
   # the directory root for meta tiles
   # the size of the meta tile blocks
   METATILE = 8
   # the directory root for meta tiles
-  HASH_ROOT = "/tiles/default/"
+  HASH_ROOT = "/tiles/default/".freeze
   # node cache file
   # node cache file
-  NODE_CACHE_FILE = "/store/database/nodes"
+  NODE_CACHE_FILE = "/store/database/nodes".freeze
 
   # turns a spherical mercator coord into a tile coord
   def self.tile_from_merc(point, zoom)
 
   # turns a spherical mercator coord into a tile coord
   def self.tile_from_merc(point, zoom)
@@ -143,7 +143,7 @@ module Expire
     set = Set.new nodes.values
 
     # expire tiles and shrink to the set of parents
     set = Set.new nodes.values
 
     # expire tiles and shrink to the set of parents
-    (max_zoom).downto(min_zoom) do |_|
+    max_zoom.downto(min_zoom) do |_|
       # allow the block to work on the set, returning the set at the next
       # zoom level
       set = yield set
       # allow the block to work on the set, returning the set at the next
       # zoom level
       set = yield set
index f3d89d0577a30cf8152c9732cdb515e3267c9591..79a9cc83680c01eb111d7199a2de8882734e20d2 100644 (file)
@@ -145,7 +145,7 @@ define :rails_port, :action => [:create, :enable] do
     end
 
     if params[:memcache_servers]
     end
 
     if params[:memcache_servers]
-      line.gsub!(/^( *)#memcache_servers:.*$/, "\\1memcache_servers: [ \"#{params[:memcache_servers].join("\", \"")}\" ]")
+      line.gsub!(/^( *)#memcache_servers:.*$/, "\\1memcache_servers: [ \"#{params[:memcache_servers].join('", "')}\" ]")
     end
 
     if params[:potlatch2_key]
     end
 
     if params[:potlatch2_key]
index f4f17e2202b0391879c1ed9e10519ba6e235989a..a381ecfff4446fa0331646268ee6d1f82f4104ab 100644 (file)
@@ -7,37 +7,39 @@ class Chef
     @api_responses = {}
     @svn_responses = {}
 
     @api_responses = {}
     @svn_responses = {}
 
-    def self.current_version
-      core_version_check["offers"].first["current"]
-    end
+    class << self
+      def current_version
+        core_version_check["offers"].first["current"]
+      end
 
 
-    def self.current_plugin_version(name)
-      if svn_cat("http://plugins.svn.wordpress.org/#{name}/trunk/readme.txt") =~ /Stable tag:\s*([^\s\r]*)[\s\r]*/
-        Regexp.last_match[1]
-      else
-        "trunk"
+      def current_plugin_version(name)
+        if svn_cat("http://plugins.svn.wordpress.org/#{name}/trunk/readme.txt") =~ /Stable tag:\s*([^\s\r]*)[\s\r]*/
+          Regexp.last_match[1]
+        else
+          "trunk"
+        end
       end
       end
-    end
 
 
-    private
+      private
 
 
-    def self.core_version_check
-      api_get("http://api.wordpress.org/core/version-check/1.6")
-    end
+      def core_version_check
+        api_get("http://api.wordpress.org/core/version-check/1.6")
+      end
 
 
-    def self.api_get(url)
-      @api_responses[url] ||= ::PHP.unserialize(::HTTPClient.new.get_content(url))
-    end
+      def api_get(url)
+        @api_responses[url] ||= ::PHP.unserialize(::HTTPClient.new.get_content(url))
+      end
 
 
-    def self.svn_cat(url)
-      unless @svn_responses[url]
-        status, stdout, stderr = output_of_command("svn cat #{url}", {})
-        handle_command_failures(status, "STDOUT: #{stdout}\nSTDERR: #{stderr}", :output_on_failure => true)
+      def svn_cat(url)
+        unless @svn_responses[url]
+          status, stdout, stderr = output_of_command("svn cat #{url}", {})
+          handle_command_failures(status, "STDOUT: #{stdout}\nSTDERR: #{stderr}", :output_on_failure => true)
 
 
-        @svn_responses[url] = stdout.force_encoding("UTF-8")
-      end
+          @svn_responses[url] = stdout.force_encoding("UTF-8")
+        end
 
 
-      @svn_responses[url]
+        @svn_responses[url]
+      end
     end
   end
 end
     end
   end
 end