Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soartec-lab/oneshot_cov
Use ruby's oneshot_coverage to detect code executed in rails app.
https://github.com/soartec-lab/oneshot_cov
Last synced: 4 days ago
JSON representation
Use ruby's oneshot_coverage to detect code executed in rails app.
- Host: GitHub
- URL: https://github.com/soartec-lab/oneshot_cov
- Owner: soartec-lab
- License: mit
- Created: 2019-09-27T14:03:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-17T07:24:09.000Z (over 4 years ago)
- Last Synced: 2024-12-18T19:49:07.886Z (6 days ago)
- Language: Ruby
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# OneshotCov
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/oneshot_cov`. To experiment with that code, run `bin/console` for an interactive prompt.
TODO: Delete this and the text above, and describe your gem
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'oneshot_cov'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install oneshot_cov
## Usage
Create a configuration file to run `OneshotCov.configure` and` OneshotCov.start`
The logger sample will be described later.```ruby:config/initializers/oneshot_cov.rb
logger = Rails.application.config.oneshot_cov_loggerOneshotCov.configure(
logger: OneshotCov::Logger::LineByLineLogger.new(logger),
emit_term: 600,
)
OneshotCov.start
```### Sample loggers
* LineByLineLogger(logger)
The logger passed to the argument is set in the application config
please```ruby:config/application.rb
config.oneshot_cov_logger = Logger.new(Rails.root.join('log/oneshot_cov.log'))
config.oneshot_cov_logger.formatter = proc { |_, _, _, msg| "#{msg}\n" }
``````
app/controllers/users/user?controller.rb: 2
app/controllers/users/user?controller.rb: 3
app/controllers/users/user?controller.rb: 4
```* EachFileLogger(logger)
The logger passed to the argument is set in the application config
please```ruby:config/application.rb
config.oneshot_cov_logger = Logger.new(Rails.root.join('log/oneshot_cov.log'))
config.oneshot_cov_logger.formatter = proc { |_, _, _, msg| "#{msg}\n" }
``````ruby:config/initializers/oneshot_cov.rb
logger = Rails.application.config.oneshot_cov_loggerOneshotCov.configure(
logger: OneshotCov::Logger::EachFileLogger.new(logger),
emit_term: 600,
)
OneshotCov.start
``````
app/controllers/users/user?controller.rb: 2,3,4
```## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/oneshot_cov. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the OneshotCov project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/oneshot_cov/blob/master/CODE_OF_CONDUCT.md).