Class: FlavorGem::Generate::Bump

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/flavor_gem/bump.rb

Instance Method Summary collapse

Methods included from Thor::Actions

#append_code_to_file, #append_template_to_file, #file_include_code?, #file_include_template?, #format_quote_to_file, #gem_class_name, #gem_name, #normalize_code, #template_content, #template_file_name

Instance Method Details

#add_rake_bump_taskObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/flavor_gem/bump.rb', line 8

def add_rake_bump_task
  bundler_task = "require 'bundler/gem_tasks'\n"
  bundler_task = format_quote_to_file bundler_task, "Rakefile"
  code_to_insert = template_content "bump.rake"
  code_to_insert = format_quote_to_file code_to_insert, "Rakefile"
  if file_include_code? "Rakefile", code_to_insert
    puts "Rakefile already has the content"
    return
  end
  if file_include_code? "Rakefile", bundler_task
    insert_into_file "Rakefile", code_to_insert, after: bundler_task
  else
    prepend_to_file "Rakefile", code_to_insert
  end
end