Class: RubiGen::Commands::Update

### Home Classes Methods

### In Files

- lib/rubigen/commands.rb

### Parent

RubiGen::Commands::Create

### Methods

- #complex_template
- #directory
- #file
- #template

### Files

- History.txt
- License.txt
- Manifest.txt
- Todo.txt
- README.txt
- index.txt
- version-raw.txt
- version.txt

### Class/Module Index

Quicksearch

- RubiGen
- RubiGen::AbstractGemSource
- RubiGen::Base
- RubiGen::Commands
- RubiGen::Commands::Base
- RubiGen::Commands::Create
- RubiGen::Commands::Destroy
- RubiGen::Commands::List
- RubiGen::Commands::RewindBase
- RubiGen::Commands::Update
- RubiGen::GemPathSource
- RubiGen::GeneratedAttribute
- RubiGen::GeneratorError
- RubiGen::GeneratorTestHelper
- RubiGen::Lookup
- RubiGen::Lookup::ClassMethods
- RubiGen::Manifest
- RubiGen::Options
- RubiGen::Options::ClassMethods
- RubiGen::PathFilteredSource
- RubiGen::PathSource
- RubiGen::Scripts
- RubiGen::Scripts::Base
- RubiGen::Scripts::Destroy
- RubiGen::Scripts::Generate
- RubiGen::Scripts::Update
- RubiGen::Source
- RubiGen::Spec
- RubiGen::UsageError
- Rubigen
- Rubigen::CLI
- Dir
- Object

No matching classes.

# RubiGen::Commands::Update

Update generator's action manifest.

### Public Instance Methods

complex_template(relative_source, relative_destination, template_options = {}) click to toggle source

    # File lib/rubigen/commands.rb, line 655
    def complex_template(relative_source, relative_destination, template_options = {})

       begin
         dest_file = destination_path(relative_destination)
         source_to_update = File.readlines(dest_file).join
       rescue Errno::ENOENT
         logger.missing relative_destination
         return
       end

       logger.refreshing "#{template_options[:insert].gsub(/\.erb/,'')} inside #{relative_destination}"

       begin_mark = Regexp.quote(template_part_mark(template_options[:begin_mark], template_options[:mark_id]))
       end_mark = Regexp.quote(template_part_mark(template_options[:end_mark], template_options[:mark_id]))

       # Refreshing inner part of the template with freshly rendered part.
       rendered_part = render_template_part(template_options)
       source_to_update.gsub!(/#{begin_mark}.*?#{end_mark}/, rendered_part)

       File.open(dest_file, 'w') { |file| file.write(source_to_update) }
    end

directory(relative_path) click to toggle source

    # File lib/rubigen/commands.rb, line 677
    def directory(relative_path)
      # logger.directory "#{destination_path(relative_path)}/"
    end

file(relative_source, relative_destination, options = {}) click to toggle source

    # File lib/rubigen/commands.rb, line 647
    def file(relative_source, relative_destination, options = {})
      # logger.file relative_destination
    end

template(relative_source, relative_destination, options = {}) click to toggle source

    # File lib/rubigen/commands.rb, line 651
    def template(relative_source, relative_destination, options = {})
      # logger.template relative_destination
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.