From bd6c01828e1c684da2ea2bb3cdfd1421da6e859a Mon Sep 17 00:00:00 2001 From: Erik Benoist Date: Thu, 2 Jan 2014 11:27:11 -0600 Subject: [PATCH 1/2] Gemify blinkstick --- .ruby-gemset | 1 + .ruby-version | 1 + Gemfile | 4 +++ Gemfile.lock | 14 +++++++++ README.md | 19 ++++++++++-- blinkstick.gemspec | 30 +++++++++++++++++++ example-find.rb => examples/example-find.rb | 0 example-info.rb => examples/example-info.rb | 0 .../example-infoblock.rb | 0 example-off.rb => examples/example-off.rb | 0 .../example-random.rb | 0 blinkstick.rb => lib/blinkstick.rb | 0 lib/blinkstick/version.rb | 3 ++ 13 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 .ruby-gemset create mode 100644 .ruby-version create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 blinkstick.gemspec rename example-find.rb => examples/example-find.rb (100%) rename example-info.rb => examples/example-info.rb (100%) rename example-infoblock.rb => examples/example-infoblock.rb (100%) rename example-off.rb => examples/example-off.rb (100%) rename example-random.rb => examples/example-random.rb (100%) rename blinkstick.rb => lib/blinkstick.rb (100%) create mode 100644 lib/blinkstick/version.rb diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..642acd8 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +blinkstick diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..cb50681 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.0.0-p247 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..bc54542 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source "http://rubygems.org" + +gem "libusb" +gem "color" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..ffb6ad9 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,14 @@ +GEM + remote: http://rubygems.org/ + specs: + color (1.4.2) + ffi (1.9.3) + libusb (0.4.0) + ffi (>= 1.0) + +PLATFORMS + ruby + +DEPENDENCIES + color + libusb diff --git a/README.md b/README.md index c1b8dcd..bb596e5 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,29 @@ Description of files: * blinkstick.rb - main BlinkStick class definition * example-info.rb - displays information of each BlinkStick -* example-infoblock.rb - read/write info block sample +* example-infoblock.rb - read/write info block sample * example-off.rb - turn all blinksticks off * example-random.rb - set random color to all blinksticks Running examples: ```sh -ruby example-info.py +ruby examples/example-info.rb +``` + +Usage +----- + +Add gem "blinkstick" to your Gemfile. +```gem "blinkstick"``` + +``` +require "blinkstick" + +BlinkStick.find_all.each { | b | + b.random_color + puts b.serial + ": " + b.color.html +} ``` Permission problems diff --git a/blinkstick.gemspec b/blinkstick.gemspec new file mode 100644 index 0000000..f0fc820 --- /dev/null +++ b/blinkstick.gemspec @@ -0,0 +1,30 @@ +# -*- encoding: utf-8 -*- + $:.push File.expand_path("../lib", __FILE__) + require "blinkstick/version" + +Gem::Specification.new do |s| + s.name = "blinkstick" + s.version = BlinkStick::VERSION + s.date = "2014-01-02" + s.summary = "Blinkstick" + s.description = <<-DESC + BlinkStick provides a ruby interface to an Agile Innovative BlinkStick via libusb. + + see ./examples for more info. + + require "blinkstick" + + BlinkStick.find_all.do { | b | + b.random_color + puts b.serial + ": " + b.color.html + end + ``` + DESC + s.files = Dir.glob("{lib}/**/*") + s.require_path = "lib" + s.authors = ["Arvydas Juskevicius "] + + s.add_runtime_dependency "libusb", [">= 0.4.0"] + s.add_runtime_dependency "color", [">= 1.4.2"] +end + diff --git a/example-find.rb b/examples/example-find.rb similarity index 100% rename from example-find.rb rename to examples/example-find.rb diff --git a/example-info.rb b/examples/example-info.rb similarity index 100% rename from example-info.rb rename to examples/example-info.rb diff --git a/example-infoblock.rb b/examples/example-infoblock.rb similarity index 100% rename from example-infoblock.rb rename to examples/example-infoblock.rb diff --git a/example-off.rb b/examples/example-off.rb similarity index 100% rename from example-off.rb rename to examples/example-off.rb diff --git a/example-random.rb b/examples/example-random.rb similarity index 100% rename from example-random.rb rename to examples/example-random.rb diff --git a/blinkstick.rb b/lib/blinkstick.rb similarity index 100% rename from blinkstick.rb rename to lib/blinkstick.rb diff --git a/lib/blinkstick/version.rb b/lib/blinkstick/version.rb new file mode 100644 index 0000000..3e7bcaa --- /dev/null +++ b/lib/blinkstick/version.rb @@ -0,0 +1,3 @@ +class BlinkStick + VERSION = "1.0.0" +end From 4864f208b4dd75320ec22c29733a145e17b7eb4e Mon Sep 17 00:00:00 2001 From: Erik Benoist Date: Thu, 2 Jan 2014 16:04:02 -0600 Subject: [PATCH 2/2] Fixed up gemspec and bumped version --- blinkstick.gemspec | 15 ++++----------- lib/blinkstick/version.rb | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/blinkstick.gemspec b/blinkstick.gemspec index f0fc820..cfa8193 100644 --- a/blinkstick.gemspec +++ b/blinkstick.gemspec @@ -9,20 +9,13 @@ Gem::Specification.new do |s| s.summary = "Blinkstick" s.description = <<-DESC BlinkStick provides a ruby interface to an Agile Innovative BlinkStick via libusb. - - see ./examples for more info. - - require "blinkstick" - - BlinkStick.find_all.do { | b | - b.random_color - puts b.serial + ": " + b.color.html - end - ``` DESC s.files = Dir.glob("{lib}/**/*") s.require_path = "lib" - s.authors = ["Arvydas Juskevicius "] + + s.homepage = "https://github.com/arvydas/blinkstick-ruby" + s.email = "arvydas@agileinnovative.co.uk" + s.authors = ["Arvydas Juskevicius"] s.add_runtime_dependency "libusb", [">= 0.4.0"] s.add_runtime_dependency "color", [">= 1.4.2"] diff --git a/lib/blinkstick/version.rb b/lib/blinkstick/version.rb index 3e7bcaa..1a184f8 100644 --- a/lib/blinkstick/version.rb +++ b/lib/blinkstick/version.rb @@ -1,3 +1,3 @@ class BlinkStick - VERSION = "1.0.0" + VERSION = "1.0.1" end