From 69b1b0844ad782433d3913c687ec271cba797a8d Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 27 May 2014 21:14:59 -0500 Subject: Make some constant strings into actual constants We only need one copy of each of these strings, not ~7500. --- Library/Homebrew/cmd/bottle.rb | 2 +- Library/Homebrew/software_spec.rb | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index f9a6e968f..e9e39d49c 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -9,7 +9,7 @@ require 'extend/pathname' BOTTLE_ERB = <<-EOS bottle do - <% if root_url != BottleSpecification.new.root_url %> + <% if root_url != BottleSpecification::DEFAULT_ROOT_URL %> root_url "<%= root_url %>" <% end %> <% if prefix.to_s != "/usr/local" %> diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 0e6dddc89..77ad7d42c 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -148,14 +148,18 @@ class Bottle end class BottleSpecification + DEFAULT_PREFIX = "/usr/local".freeze + DEFAULT_CELLAR = "/usr/local/Cellar".freeze + DEFAULT_ROOT_URL = "https://downloads.sf.net/project/machomebrew/Bottles".freeze + attr_rw :root_url, :prefix, :cellar, :revision attr_reader :checksum, :collector def initialize @revision = 0 - @prefix = '/usr/local' - @cellar = '/usr/local/Cellar' - @root_url = 'https://downloads.sf.net/project/machomebrew/Bottles' + @prefix = DEFAULT_PREFIX + @cellar = DEFAULT_CELLAR + @root_url = DEFAULT_ROOT_URL @collector = BottleCollector.new end -- cgit v1.2.3