https://github.com/schultyy/niman
Provisions your machine
https://github.com/schultyy/niman
Last synced: 11 months ago
JSON representation
Provisions your machine
- Host: GitHub
- URL: https://github.com/schultyy/niman
- Owner: schultyy
- License: mit
- Created: 2015-02-03T21:32:23.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-03T17:43:25.000Z (about 11 years ago)
- Last Synced: 2025-07-20T09:59:15.209Z (11 months ago)
- Language: Ruby
- Homepage:
- Size: 606 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Niman
[](https://travis-ci.org/schultyy/Niman)
[](https://codeclimate.com/github/schultyy/Niman)
Niman is a proof-of-concept provisioner.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'niman'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install niman
## Usage
It starts with a `Nimanfile`:
```ruby
Niman::Recipe.configure do |config|
config.file '/home/bob/hello.txt' do |file|
file.content = 'hello from alice'
end
end
```
This places a new file `hello.txt` in `/home/bob` with rights 0600.
A `Nimanfile` contains all necessary commands for `niman` to run.
### Commands
Niman has support to execute arbitrary commands on the host system:
```ruby
Niman::Recipe.configure do |config|
config.exec "touch ~/hello.txt"
end
```
Or if you need sudo privileges:
```ruby
Niman::Recipe.configure do |config|
config.exec :sudo, "apt-get update"
end
```
### Packages
Use a concrete package in your script:
```ruby
Niman::Recipe.configure do |config|
config.package do |package|
package.name = "vim"
end
end
```
#### Custom packages
Custom packages live in `packages/`. Every package gets its own file.
Package description:
```ruby
#packages/ruby.rb
require 'niman'
class RubyPackage < Niman::Library::CustomPackage
package_name :ubuntu, "ruby1.9.1"
package_name :centos, "ruby1.9.1"
end
```
In your `Nimanfile`:
```ruby
Niman::Recipe.configure do |config|
config.package "packages/ruby"
end
```
A custom package can have one or more configuration files inside of it:
```ruby
#packages/nginx
class NginxPackage < Niman::Library::CustomPackage
package_name :ubuntu, 'nginx'
file '/etc/nginx/nginx.conf' do |config|
#general nginx configuration goes here
config.content = '...'
end
file '/etc/nginx/sites-available/example.com' do |config|
config.content = '...'
end
end
```
A custom package can also be used as a container for a bunch of configuration files
and shell commands without the need to specify `package_names`:
```ruby
#packages/ruby
require 'niman'
class RubyPackage < Niman::Library::CustomPackage
exec '\\curl -sSL https://get.rvm.io | bash -s stable'
exec 'rvm install ruby --latest'
end
```
### Apply `Nimanfile`
To apply a `Nimanfile` run:
```bash
$ niman apply
```
### Use it as a Vagrant plugin
At first, install it as Vagrant plugin:
```bash
$ vagrant plugin install niman
```
Then, in `Vagrantfile`, add this line:
```ruby
config.vm.provision "niman"
```
Save the file and after this you can `vagrant provision`.
## Contributing
1. Fork it ( https://github.com/[my-github-username]/niman/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 a new Pull Request