diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index f077f64514..14c3e93d8a 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -12,18 +12,18 @@ class Tab < OpenStruct def self.create(formula, compiler, stdlib, build) attributes = { - :used_options => build.used_options.as_flags, - :unused_options => build.unused_options.as_flags, - :tabfile => formula.prefix.join(FILENAME), - :built_as_bottle => !!ARGV.build_bottle?, - :poured_from_bottle => false, - :tapped_from => formula.tap, - :time => Time.now.to_i, - :HEAD => Homebrew.git_head, - :compiler => compiler, - :stdlib => stdlib, - :source => { - :path => formula.path.to_s, + "used_options" => build.used_options.as_flags, + "unused_options" => build.unused_options.as_flags, + "tabfile" => formula.prefix.join(FILENAME), + "built_as_bottle" => !!ARGV.build_bottle?, + "poured_from_bottle" => false, + "tapped_from" => formula.tap, + "time" => Time.now.to_i, + "HEAD" => Homebrew.git_head, + "compiler" => compiler, + "stdlib" => stdlib, + "source" => { + "path" => formula.path.to_s, }, } @@ -32,7 +32,7 @@ class Tab < OpenStruct def self.from_file path attributes = Utils::JSON.load(File.read(path)) - attributes[:tabfile] = path + attributes["tabfile"] = path new(attributes) end @@ -86,7 +86,7 @@ class Tab < OpenStruct else tab = empty tab.unused_options = f.options.as_flags - tab.source = { :path => f.path.to_s } + tab.source = { "path" => f.path.to_s } end tab @@ -94,17 +94,17 @@ class Tab < OpenStruct def self.empty attributes = { - :used_options => [], - :unused_options => [], - :built_as_bottle => false, - :poured_from_bottle => false, - :tapped_from => "", - :time => nil, - :HEAD => nil, - :stdlib => nil, - :compiler => "clang", - :source => { - :path => nil, + "used_options" => [], + "unused_options" => [], + "built_as_bottle" => false, + "poured_from_bottle" => false, + "tapped_from" => "", + "time" => nil, + "HEAD" => nil, + "stdlib" => nil, + "compiler" => "clang", + "source" => { + "path" => nil, }, } @@ -157,16 +157,16 @@ class Tab < OpenStruct def to_json attributes = { - :used_options => used_options.as_flags, - :unused_options => unused_options.as_flags, - :built_as_bottle => built_as_bottle, - :poured_from_bottle => poured_from_bottle, - :tapped_from => tapped_from, - :time => time, - :HEAD => self.HEAD, - :stdlib => (stdlib.to_s if stdlib), - :compiler => (compiler.to_s if compiler), - :source => source || {}, + "used_options" => used_options.as_flags, + "unused_options" => unused_options.as_flags, + "built_as_bottle" => built_as_bottle, + "poured_from_bottle" => poured_from_bottle, + "tapped_from" => tapped_from, + "time" => time, + "HEAD" => self.HEAD, + "stdlib" => (stdlib.to_s if stdlib), + "compiler" => (compiler.to_s if compiler), + "source" => source || {}, } Utils::JSON.dump(attributes) diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index 1ffa7fbb03..e6116b057a 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -8,16 +8,16 @@ class TabTests < Homebrew::TestCase @unused = Options.create(%w(--with-baz --without-qux)) @tab = Tab.new({ - :used_options => @used.as_flags, - :unused_options => @unused.as_flags, - :built_as_bottle => false, - :poured_from_bottle => true, - :tapped_from => "Homebrew/homebrew", - :time => nil, - :HEAD => TEST_SHA1, - :compiler => "clang", - :stdlib => "libcxx", - :source => { :path => nil }, + "used_options" => @used.as_flags, + "unused_options" => @unused.as_flags, + "built_as_bottle" => false, + "poured_from_bottle" => true, + "tapped_from" => "Homebrew/homebrew", + "time" => nil, + "HEAD" => TEST_SHA1, + "compiler" => "clang", + "stdlib" => "libcxx", + "source" => { "path" => nil }, }) end