Sha256: 1a451f22e254c4b52e9a58be5427c649d1da042dfe236a47ff34f9abde6e38ca
Contents?: true
Size: 859 Bytes
Versions: 4
Compression:
Stored size: 859 Bytes
Contents
require_relative 'exceptions' module Rocktumbler # The Gemfile is a class responsible for reading and parsing a Gemfile class Gemfile attr_accessor :ruby, :source def initialize(gemfile_location) @gemfile_location = gemfile_location @gemfile_contents = read_contents @ruby = parse_ruby @source = parse_source end def read_contents gemfile = File.open(@gemfile_location, 'r') str = gemfile.read gemfile.close str end def print_source_and_ruby str = '' str += "#{@source.tr('\"', '\'')}\n" if @source str += "\n#{@ruby.tr('\"', '\'')}\n" if @ruby str end def parse_ruby /^(ruby.*)/.match(@gemfile_contents)[1] if @gemfile_contents =~ /^(ruby.*)/ end def parse_source /^(source.*)/.match(@gemfile_contents)[1] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rocktumbler-0.2.2 | lib/rocktumbler/gemfile.rb |
rocktumbler-0.2.1 | lib/rocktumbler/gemfile.rb |
rocktumbler-0.2.0 | lib/rocktumbler/gemfile.rb |
rocktumbler-0.1.3 | lib/rocktumbler/gemfile.rb |