lib/eefgilm/gemfile.rb in eefgilm-1.0.0 vs lib/eefgilm/gemfile.rb in eefgilm-1.1.0
- old
+ new
@@ -1,8 +1,8 @@
module Eefgilm
class Gemfile
- attr_accessor :path, :source, :groups
+ attr_accessor :path, :source, :groups, :rubyversion
def initialize(path = ".", options = {})
@path = path
@groups ={}
@options = {
@@ -33,10 +33,11 @@
group_block = :all
file_lines = gemfile.readlines
file_lines.each do |line|
self.source = line if line.match(/^source/)
+ self.rubyversion = line if line.match(/^ruby/)
if line.match(/^\s*group/)
group_block = line.match(/^group (:.*)[,|\s]/)[1]
elsif line.match(/^\s*end/)
group_block = :all
@@ -69,9 +70,10 @@
end
def recreate_file
output = File.open( "#{@path}/Gemfile", "w+" )
output.puts @source
+ output.puts @rubyversion
output.puts
@groups.each do |group, gems|
if group == :all
gems.each do |g|