class Rfix::Rake::Gemfile

Constants

FORMAT
VERSIONS

Public Class Methods

call(*args, **kwargs, &block) click to toggle source
# File lib/rfix/rake/gemfile.rb, line 59
def self.call(*args, **kwargs, &block)
  (self | AST).call(*args, **kwargs, &block)
end
files(root_path) click to toggle source
# File lib/rfix/rake/gemfile.rb, line 63
def self.files(root_path)
  VERSIONS.map do |version|
    Gemfile.call(root_path: root_path, version: version)
  end
end

Public Instance Methods

bundle_lock() click to toggle source
# File lib/rfix/rake/gemfile.rb, line 82
def bundle_lock
  sh(*lock_args)
rescue RuntimeError
  sh(*lock_args[0..-2])
end
call() click to toggle source
# File lib/rfix/rake/gemfile.rb, line 69
def call
  puts "Working with #{version}"

  gemfile.write(content)

  if lockfile.exist?
    lockfile.delete
  end

  bundle_lock
  puts "Finished with #{version}"
end
lock_args() click to toggle source
# File lib/rfix/rake/gemfile.rb, line 88
def lock_args
  ["bundle", "lock", "--gemfile", gemfile.to_path, "--local"]
end
to_s() click to toggle source
# File lib/rfix/rake/gemfile.rb, line 92
def to_s
  gemfile.to_s
end

Private Instance Methods

content() click to toggle source
# File lib/rfix/rake/gemfile.rb, line 106
      def content
        <<~GEMFILE
          eval_gemfile("../Gemfile")
          gem "rubocop", "#{version}"
        GEMFILE
      end
gemfile() click to toggle source
# File lib/rfix/rake/gemfile.rb, line 98
def gemfile
  root_path.join(FORMAT % [version, EMPTY_STRING])
end
lockfile() click to toggle source
# File lib/rfix/rake/gemfile.rb, line 102
def lockfile
  root_path.join(FORMAT % [version, ".lock"])
end