Skip to content

tongueroo/text_injector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Injector

Build Status

Injects text to a file with markers around the text so it can update it again.

Installation

Add this line to your application's Gemfile:

gem 'text_injector'

And then execute:

$ bundle

Or install it yourself as:

$ gem install text_injector

Usage

require 'text_injector'
injector = TextInjector.new(
  :identifier => "custom-id",
  :file => "/tmp/test.txt",
  :content => "added content"
)
injector.run # first run
injector.content = "updated content"
injector.run # second run

Starting /tmp/test.txt file:

test file

After first run:

test file

# Begin TextInjector marker for custom-id
added content
# End TextInjector marker for custom-id

After second run:

test file

# Begin TextInjector marker for custom-id
updated content
# End TextInjector marker for custom-id

Contributing

  1. Fork it ( http://github.com/tongueroo/text_injector/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Text Injector: injects text to a file

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages