class RSGem::Tasks::CleanGemfile
Gemfile should only have the gemspec directive. An exception is when you need to develop against a gem that hasn't yet been released, in this case you can declare that dependency in the Gemfile:
gem 'rack', github: 'rack/rack'
gemspec is the place to declare dependencies.
Constants
- OUTPUT
Public Instance Methods
perform()
click to toggle source
# File lib/rsgem/tasks/clean_gemfile.rb, line 19 def perform gemfile.gsub!(/gem .+\n/, '') # Remove all gem definitions gemfile.sub!(/\n\z/, '') # Remove last new line character write_to_gemfile end
Private Instance Methods
gemfile()
click to toggle source
# File lib/rsgem/tasks/clean_gemfile.rb, line 27 def gemfile @gemfile ||= File.read(context.gemfile_path) end
write_to_gemfile()
click to toggle source
# File lib/rsgem/tasks/clean_gemfile.rb, line 31 def write_to_gemfile File.open(context.gemfile_path, 'w') do |file| file.puts gemfile end end