Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
Replace TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bresson committed Dec 5, 2016
1 parent e217075 commit 57baa20
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 TODO: Write your name
Copyright (c) 2016 Compellon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
41 changes: 36 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Bedouin

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bedouin`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem
Bedouin is a tool for templatizing job files for Hashicorp Nomad.

## Installation

Expand All @@ -22,7 +20,40 @@ Or install it yourself as:

## Usage

TODO: Write usage instructions here
Create one or more environment files and one or more ERB job templates, and then execute:

$ bedouin <environment file> <template1> <template2> ...

Bedouin will evaluate each template with any attributes from the environment file available as instance variables. Bedouin will then run the results of each with "nomad run".

### Environment Files

Environment files should contain any environment-specific information needed to templatize the Nomad job definitions.

In the file myname.rb
```ruby
environment "myname" do |e|
e.foo = "bar"
end
```

This would make an environment file which injects the value "bar" for @foo in any template files. @name is also available with the value "myname".

Environments are also able to inherit from other environments. Simply specify the path of the parent environment file as a second argument to the environment method:

In the file mydir/mychild.rb
```ruby
environment "mychild", "../myname.rb" do |e|
e.bar = "baz"
end
```

As these files are pure ruby, there is a vast amount of possibilities for how to use them. All they must do is return an object which converts to a Hash.

### Template Files

Template files are just ERuby files that output a valid nomad job file. For information about ERuby, see https://en.wikipedia.org/wiki/ERuby.


## Development

Expand All @@ -32,7 +63,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bedouin.
Bug reports and pull requests are welcome on GitHub at https://github.com/compellon/bedouin.


## License
Expand Down
11 changes: 1 addition & 10 deletions bedouin.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,9 @@ Gem::Specification.new do |spec|
spec.email = ["[email protected]"]

spec.summary = %q{Bedouin provides a templating system for Hashicorp Nomad.}
#spec.description = %q{TODO: Write a longer description or delete this line.}
spec.homepage = "TODO: Put your gem's website or public repo URL here."
spec.homepage = "https://github.com/compellon/bedouin"
spec.license = "MIT"

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
else
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
end

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "bin"
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
Expand Down

0 comments on commit 57baa20

Please sign in to comment.