summaryrefslogtreecommitdiff
path: root/README.md
blob: 6a814036f4902a0bb62724f5cfce17865648415e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# ohai

[![Build status](https://badge.buildkite.com/aa0b961fc3e5bed315c7035c6d60a4aaee57af9610cbde9a15.svg?branch=main)](https://buildkite.com/chef-oss/chef-ohai-main-verify) [![Gem Version](https://badge.fury.io/rb/ohai.svg)](https://badge.fury.io/rb/ohai)

**Umbrella Project**: [Chef Infra](https://github.com/chef/chef-oss-practices/blob/main/projects/chef-infra.md)

**Project State**: [Active](https://github.com/chef/chef-oss-practices/blob/main/repo-management/repo-states.md#active)

**Issues Response SLA**: 10 business days

**Pull Request Response SLA**: 10 business days

## Description

Ohai detects data about your operating system. It can be used standalone, but its primary purpose is to provide node data to Chef.

Ohai will print out a JSON data blob for all the known data about your system. When used with Chef, that data is reported back via node attributes.

Chef distributes ohai as a RubyGem. This README is for developers who want to modify the Ohai source code. For users who want to write plugins for Ohai, see the docs:

- General documentation: <https://docs.chef.io/ohai/>
- Writing Ohai Plugins documentation: <https://docs.chef.io/ohai_custom/>

## Development Environment

Ohai's development dependencies should be installed with bundler. Just run `bundle install` in the root of the repo.

## Spec Testing

We use RSpec for unit/spec tests. To run the full suite, run:

```
bundle exec rake spec
```

You can run individual test files by running the rspec executable:

```
bundle exec rspec spec/unit/FILE.rb
```

## Style

We use [Chefstyle](https://github.com/chef/chefstyle), as a code [linter](https://en.wikipedia.org/wiki/Lint_(software)), to enforce style guidelines. To run:

```
bundle exec rake style
```

You can run and automatically correct the issues:

```
bundle exec rake style:auto_correct
```

## Rake Tasks

Ohai has some Rake tasks for doing various things.

```
bundle exec rake -T
rake build               # Build ohai-$VERSION.gem into the pkg directory
rake clean               # Remove any temporary products
rake clobber             # Remove any generated files
rake install             # Build and install ohai-$VERSION.gem into system gems
rake install:local       # Build and install ohai-$VERSION.gem into system gems without network access
rake release[remote]     # Create tag $VERSION and build and push ohai-$VERSION.gem to rubygems.org
rake spec                # Run RSpec code examples
rake style               # Run Chefstyle tests
rake style:auto_correct  # Auto-correct RuboCop offenses

($VERSION is the current version, from the GemSpec in Rakefile)
```

## Links

Source:

- <https://github.com/chef/ohai/tree/main>

Issues:

- <https://github.com/chef/ohai/issues>

## Contributing

For information on contributing to this project see <https://github.com/chef/chef/blob/main/CONTRIBUTING.md>

1. Fork it
1. Create your feature branch (git checkout -b my-new-feature)
1. Commit your changes (git commit -am 'Add some feature')
1. Run the tests `bundle exec rake spec`
1. Run the style tests `bundle exec rake style`
1. Push to the branch (git push origin my-new-feature)
1. Create new Pull Request

## License

Ohai - system information application

- Author:: Adam Jacob ([adam@chef.io](mailto:adam@chef.io))
- Copyright:: Copyright (c) 2008-2021 Chef Software, Inc.
- License:: Apache License, Version 2.0

```text
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```