Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Clean up file joins/reads

  • Loading branch information...
commit bd05269ef76146e0c0c77bb8f3233f66ab396d6d 1 parent 00fb27b
Nathaniel Bibler authored June 17, 2011
4  app/models/keymaster.rb
@@ -4,7 +4,7 @@ module Keymaster
4 4
   # Returns the current version number of the application.
5 5
   #
6 6
   def self.version
7  
-    @@version ||= File.read(File.join(Rails.root, 'VERSION')).strip
  7
+    @@version ||= Rails.root.join('VERSION').read.strip
8 8
   end
9 9
 
10 10
   ##
@@ -12,7 +12,7 @@ def self.version
12 12
   # the servers.
13 13
   #
14 14
   def self.gatekeeper_data
15  
-    @@gatekeeper_data ||= File.read(File.join(Rails.root, 'lib', 'gatekeeper.rb')).
  15
+    @@gatekeeper_data ||= Rails.root.join('lib/gatekeeper.rb').read.
16 16
       gsub('%CURRENT_KEYMASTER_VERSION%', self.version).
17 17
       gsub('%CURRENT_PUBLIC_KEY%', ENV['PUBLIC_SIGNING_KEY'])
18 18
   end
5  lib/tasks/test.rake
@@ -2,8 +2,9 @@ namespace :test do
2 2
   namespace :ci do
3 3
     desc "Configure the CI test server"
4 4
     task :configure do
5  
-      root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
6  
-      cp File.join(root, 'config/database.ci.yml'), File.join(root, 'config/database.yml')
  5
+      require 'pathname'
  6
+      root = Pathname.new File.expand_path('../../../', __FILE__)
  7
+      cp root.join('config/database.ci.yml'), root.join('config/database.yml')
7 8
     end
8 9
   end
9 10
 end
4  test/test_helper.rb
... ...
@@ -1,6 +1,6 @@
1 1
 ENV["RAILS_ENV"] = "test"
2  
-ENV["PUBLIC_SIGNING_KEY"] = File.read(File.join(File.dirname(__FILE__), 'public.key'))
3  
-ENV["PRIVATE_SIGNING_KEY"] = File.read(File.join(File.dirname(__FILE__), 'private.key'))
  2
+ENV["PUBLIC_SIGNING_KEY"] = File.read(File.expand_path('../public.key', __FILE__))
  3
+ENV["PRIVATE_SIGNING_KEY"] = File.read(File.expand_path('../private.key', __FILE__))
4 4
 
5 5
 require File.expand_path('../../config/environment', __FILE__)
6 6
 require 'rails/test_help'

0 notes on commit bd05269

Please sign in to comment.
Something went wrong with that request. Please try again.