forked from arkadiybutermanov/co2mon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arkadiy Butermanov
committed
Mar 13, 2016
1 parent
f66819a
commit fcbea53
Showing
11 changed files
with
63 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in co2mond.gemspec | ||
# Specify your gem's dependencies in co2mon.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,7 @@ | ||
# Co2mond | ||
# Co2mon | ||
|
||
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/co2mond`. To experiment with that code, run `bin/console` for an interactive prompt. | ||
Based on https://github.com/dmage/co2mon | ||
|
||
TODO: Delete this and the text above, and describe your gem | ||
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
|
||
```ruby | ||
gem 'co2mond' | ||
``` | ||
|
||
And then execute: | ||
|
||
$ bundle | ||
|
||
Or install it yourself as: | ||
|
||
$ gem install co2mond | ||
|
||
## Usage | ||
|
||
TODO: Write usage instructions here | ||
|
||
## Development | ||
|
||
After checking out the repo, run `bin/setup` to install dependencies. 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]/co2mond. 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](http://opensource.org/licenses/MIT). | ||
## Requirements | ||
|
||
$ brew install hidapi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
require 'rake/extensiontask' | ||
spec = Gem::Specification.load('co2mond.gemspec') | ||
Rake::ExtensionTask.new('co2mon', spec) | ||
require "bundler/gem_tasks" | ||
task :default => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../lib', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'co2mon/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "co2mon" | ||
spec.version = Co2mon::VERSION | ||
spec.authors = ["Arkadiy Butermanov"] | ||
spec.email = ["[email protected]"] | ||
|
||
spec.summary = %q{FFI bindings for MasterKit CO2 Monitor} | ||
spec.homepage = "https://github.com/arkadiybutermanov/co2mon" | ||
spec.license = "MIT" | ||
|
||
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } | ||
spec.bindir = "bin" | ||
spec.extensions << './ext/co2mon/extconf.rb' | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_dependency "ffi" | ||
|
||
spec.add_development_dependency "bundler", "~> 1.11" | ||
spec.add_development_dependency "rake", "~> 10.0" | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require "co2mon/version" | ||
require "ffi" | ||
|
||
module Co2mon | ||
extend FFI::Library | ||
|
||
ffi_lib File.expand_path("co2mon.bundle", __dir__) | ||
|
||
attach_function :get, [], :pointer | ||
|
||
def self.get_data | ||
data = get.get_array_of_int32(0, 2) | ||
|
||
{ | ||
:co2 => data[0], | ||
:temp => data[1] | ||
} | ||
rescue => e | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Co2mond | ||
module Co2mon | ||
VERSION = "0.1.0" | ||
end |
This file was deleted.
Oops, something went wrong.