No commit activity in last 3 years
No release in over 3 years
Scans all github repositories in a github org check for the presence of a file
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0
~> 3.0

Runtime

 Project Readme

GitOrgFileScanner

This Gem allows you to scan all GitHub repos in a GitHub organization to determine if they contain or if they are missing a specified file.

Installation

Add this line to your application's Gemfile:

gem 'git_org_file_scanner'

And then execute:

$ bundle

Or install it yourself as:

$ gem install git_org_file_scanner

Usage

Access the library in Ruby

require 'git_org_file_scanner'

You will need a GitHub Personal Access Token to authenticate to the GithHub API.

We can initialize the scannerlike this:

scanner = GitOrgFileScanner::Scanner.new('<your GitHub access token>', 'habitat-sh')

To limit the repositories to search to those that match a specific Github repo type you can pass in a valid repo type ('all', 'public', 'member', 'sources', 'forks', 'private'). If no type is specified then 'sources' will be used.

scanner = GitOrgFileScanner::Scanner.new('<your GitHub access token>', 'habitat-sh', 'public')

Let's say we want a list of all repos in the habitat-sh GitHub Org that DO contain a CONTRIBUTING.md file. We would request that list like this:

scanner.contain_file('CONTRIBUTING.md')
=> ["habitat-sh/habitat", "habitat-sh/core-plans", "habitat-sh/habitat-launch", "habitat-sh/urlencoded", "habitat-sh/habitat-operator"]

Now what if we want a list of all repos that do NOT contain a CONTRIBUTING.md file?

scanner.missing_file('CONTRIBUTING.md')
=> ["habitat-sh/habitat-example-plans", "habitat-sh/net-habitat", "habitat-sh/habitat-aspnet-sample", "habitat-sh/habitat-windows-package", "habitat-sh/language-habitat", "habitat-sh/rust-zmq", "habitat-sh/redis-postgres-migrator", "habitat-sh/habitat-aspnet-full", "habitat-sh/ipc-channel", "habitat-sh/prost", "habitat-sh/frank_jwt", "habitat-sh/sample-node-app", "habitat-sh/expresso", "habitat-sh/homebrew-habitat", "habitat-sh/sample-rails-app", "habitat-sh/windows-service", "habitat-sh/kubernetes-the-hab-way", "habitat-sh/guide-node", "habitat-sh/guide-ruby", "habitat-sh/testapp", "habitat-sh/windows-service-sample", "habitat-sh/national-parks"]

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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nellshamrell/git_org_file_scanner. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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

Code of Conduct

Everyone interacting in the GitOrgFileScanner project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.