GitXplorerGitXplorer
A

example_file

public
1 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
c6bb2d913f679d124d3f44e8901b07a50f79adb5

Update all npm dependencies (2024-04-15)

ddepfu[bot] committed 9 months ago
Unverified
c71321ae226e03c196db4bc65312da499b537e01

Update rubocop to version 1.61.0

ddepfu[bot] committed a year ago
Unverified
fe613ed4f2c59af4b20d7f0c8ec35319b6dce990

Update rubocop to version 1.60.0

ddepfu[bot] committed a year ago
Verified
3f36c24d217b79d85b44f5922dd694ec507251ae

Resolve `gem build` warning about `homepage_uri` and `source_code_uri`

AAlexWayfer committed a year ago
Verified
0ead5a5ec5929befef49f4b58faf3c1d5375c9c6

Update version to 0.5.0

AAlexWayfer committed a year ago
Verified
1a90442f336c808b2bc2224b135336f58b5d0653

Update `highline` and `gem_toys` to new breaking versions

AAlexWayfer committed a year ago

README

The README file for this repository.

Example File

Cirrus CI - Base Branch Build Status Codecov branch Code Climate Depfu Inline docs Gem License

Class helper for example files. Usually it's the alternative to environment variables (and .env files).

You can have git-controlled example files and git-ignored real files. For example, configuration, especially with sensitive data.

Installation

Add this line to your application's Gemfile:

gem 'example_file'

And then execute:

bundle install

Or install it yourself as:

gem install example_file

Usage

require 'example_file'

ExampleFile.new('some_file.example.conf').actualize_regular_file

For some_file.example.conf example file there is some_file.conf regular file.

Editor below is $EDITOR environment variable. You should set it to your preferred editor, console or GUI (console is more comfortable usually for such scenarios). Otherwise the whole program will be aborted with a message about this.

It'll act in these ways:

  • If there is no regular file:
    • create it with content from example and open the editor.
  • If there is example file with file modified time after regular file:
    • If there is no difference between their contents:
      • touch regular file for updating its modified time.
    • If there is a difference between their contents:
      • ask for a further action:
        • open the editor;
        • just update regular without changes;
        • replace regular file with a content from new example file;
        • or replace and then open the editor.
  • If there is regular file with file modified time after example file:
    • do nothing.

You should add example files to git control:

git add some_file.example.conf

And ignore regular ones in .gitignore:

some_file.conf

Recursively it'd be like:

config/**/*
!config/**/*.example*

Development

After checking out the repo, run bundle install to install dependencies.

Then, run toys rspec to run the tests.

To install this gem onto your local machine, run toys gem install.

To release a new version, run toys gem release %version%. See how it works here.

Contributing

Bug reports and pull requests are welcome on GitHub.

License

The gem is available as open source under the terms of the MIT License.