little_bits 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +101 -0
- data/Rakefile +6 -0
- data/lib/little_bits.rb +8 -0
- data/lib/little_bits/arduino_module.rb +36 -0
- data/lib/little_bits/cloud_bit.rb +27 -0
- data/lib/little_bits/number_module.rb +15 -0
- data/lib/little_bits/version.rb +3 -0
- data/little_bits.gemspec +28 -0
- data/spec/lib/arduino_module_spec.rb +109 -0
- data/spec/lib/cloud_bit_spec.rb +32 -0
- data/spec/lib/number_module_spec.rb +19 -0
- data/spec/spec_helper.rb +95 -0
- metadata +148 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35c3e6f043c2066ce7ec079bc4040f06f46b8230
|
4
|
+
data.tar.gz: 7426bd46d69939d5241af2f9ae7241d2d9b55dbe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ae3814ac379ad0cb2a23bf0605f3e4c853ce7f23a56d325fff3f5bf301ab3e75ff8454850b9afe474a9bd8f103dfbb31a1987b75ec5ddd60c65740e93030e924
|
7
|
+
data.tar.gz: 45f68dffa692f819f48b7b92251e99ca7914b23e44469619228f14a028b25040b8a91c2a171418014692f790c30b3e21a9e208e99ce4b33d85fe6278d5396d29
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Brian Kelly
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
[](https://travis-ci.org/spilth/little_bits)
|
2
|
+
|
3
|
+
# LittleBits Ruby Gem
|
4
|
+
|
5
|
+
A Ruby Gem for communicating with [littleBits](http://littlebits.cc) modules.
|
6
|
+
|
7
|
+
Currently supported are:
|
8
|
+
|
9
|
+
- [cloudBit](http://littlebits.cc/bits/cloudbit)
|
10
|
+
- [Arduino Module](http://littlebits.cc/bits/arduino)
|
11
|
+
|
12
|
+
## Requirements
|
13
|
+
|
14
|
+
- [Ruby](https://www.ruby-lang.org/en/)
|
15
|
+
- [RubyGems](https://rubygems.org/pages/download)
|
16
|
+
- [Bundler](http://bundler.io)
|
17
|
+
- [Arduino IDE](http://arduino.cc/en/Main/Software)
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'little_bits'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install little_bits
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
### cloudBit
|
38
|
+
|
39
|
+
You'll need the **Access Token** and **Device ID** from the Settings page of the [littleBits CloudBit Control Panel](http://control.littlebitscloud.cc)
|
40
|
+
|
41
|
+
You can then start up `irb` or create a script with the following code:
|
42
|
+
|
43
|
+
require 'little_bits'
|
44
|
+
|
45
|
+
cloud_bit = LittleBits::CloudBit.new('your-access-token', 'your-device-id')
|
46
|
+
|
47
|
+
# Set output to 100% for 3 seconds (3000 milliseconds)
|
48
|
+
cloud_bit.output(100, 3000)
|
49
|
+
|
50
|
+
# Set output to 50% indefinitely (-1 for duration)
|
51
|
+
cloud_Bit.output(50, -1)
|
52
|
+
|
53
|
+
#### Method Arguments
|
54
|
+
|
55
|
+
The first argument is the percentage which should be between `0` and `100`.
|
56
|
+
|
57
|
+
The second argument is the duration which should be between `0` and `32000`. You can send `-1` if you want the duration to be indefinite.
|
58
|
+
|
59
|
+
### Arduino Module
|
60
|
+
|
61
|
+
First, follow the [littleBits Arduino Module Getting Started Guide](http://discuss.littlebits.cc/t/getting-started/109) to set up your Arduino module.
|
62
|
+
|
63
|
+
You'll need to know the serial port that the Arduino is plugged into.
|
64
|
+
|
65
|
+
You'll also need to load the **StandardFirmata** sketch onto your Arduino Module:
|
66
|
+
|
67
|
+
- Start the Arduino IDE
|
68
|
+
- Plug in a USB cable from your computer to the Arduino Module
|
69
|
+
- Select the serial port your Arduino is on from **Tools** > **Serial Port**
|
70
|
+
- Switch to the **Arduino Leonardo** board by clicking on the **Tools** menu, then **Board** > **Arduino Leonardo**
|
71
|
+
- Select the **File** menu, then **Example** > **Firmata** > **Standard Firmata**
|
72
|
+
- Select the **File** menu, then **Upload**
|
73
|
+
|
74
|
+
You can then start up `irb` or create a Ruby script with the following code:
|
75
|
+
|
76
|
+
require 'little_bits'
|
77
|
+
|
78
|
+
arduino_module = LittleBits::ArduinoModule.new('/your/serial_port')
|
79
|
+
|
80
|
+
# Turn on d1
|
81
|
+
arduino_module.d1(true)
|
82
|
+
|
83
|
+
# Set d5 to max output
|
84
|
+
arduino_module.d5(255)
|
85
|
+
|
86
|
+
# Set d9 to min output
|
87
|
+
arduino_module.d9(0)
|
88
|
+
|
89
|
+
#### Method Arguments
|
90
|
+
|
91
|
+
The `d1` method can be sent `true` or `false`.
|
92
|
+
|
93
|
+
The `d5` and `d9` methods can be sent `true`, `false`, or a number between `0` and `255`.
|
94
|
+
|
95
|
+
## Contributing
|
96
|
+
|
97
|
+
1. Fork it ( https://github.com/spilth/little_bits/fork )
|
98
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
99
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
100
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
101
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/little_bits.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'arduino_firmata'
|
2
|
+
|
3
|
+
module LittleBits
|
4
|
+
class ArduinoModule
|
5
|
+
def initialize(serial_port)
|
6
|
+
@arduino = ArduinoFirmata.connect(serial_port)
|
7
|
+
|
8
|
+
Kernel.at_exit { @arduino.close }
|
9
|
+
end
|
10
|
+
|
11
|
+
def d1(value)
|
12
|
+
arduino.digital_write(1, value)
|
13
|
+
end
|
14
|
+
|
15
|
+
def d5(value)
|
16
|
+
if value.is_a?(Numeric)
|
17
|
+
arduino.analog_write(5, value)
|
18
|
+
else
|
19
|
+
arduino.digital_write(5, value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def d9(value)
|
24
|
+
if value.is_a?(Numeric)
|
25
|
+
arduino.analog_write(9, value)
|
26
|
+
else
|
27
|
+
arduino.digital_write(9, value)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
attr_reader :arduino
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
|
3
|
+
module LittleBits
|
4
|
+
class CloudBit
|
5
|
+
API_URL = 'https://api-http.littlebitscloud.cc'
|
6
|
+
API_VERSION = 'v2'
|
7
|
+
|
8
|
+
def initialize(access_token, device_id)
|
9
|
+
@access_token = access_token
|
10
|
+
@device_id = device_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def output(percent = 100, duration_ms = 3000)
|
14
|
+
RestClient.post "#{API_URL}/devices/#{device_id}/output",
|
15
|
+
{
|
16
|
+
:percent => percent,
|
17
|
+
:duration_ms => duration_ms
|
18
|
+
},
|
19
|
+
Accept: "application/vnd.littlebits.#{API_VERSION}+json",
|
20
|
+
Authorization: "Bearer #{access_token}"
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :access_token, :device_id
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module LittleBits
|
2
|
+
class NumberModule
|
3
|
+
|
4
|
+
# From https://lb-community.s3.amazonaws.com/uploads/supporting_file/asset/448/Counter.ino
|
5
|
+
NUMBER_VALUES = [0,3,6,8,10,13,15,18,20,23,26,28,30,33,35,38,40,43,45,48,50,53,55,58,61,
|
6
|
+
64,66,69,71,74,76,78,81,84,86,89,91,94,96,99,102,104,106,108,111,114,116,
|
7
|
+
119,121,124,127,129,132,134,136,139,141,143,146,149,151,154,156,159,160,163,
|
8
|
+
166,169,171,173,176,179,181,184,186,188,190,193,196,199,202,205,208,210,212,
|
9
|
+
214,217,218,221,224,227,230,232,235,237,239,242,245,247,252,255]
|
10
|
+
|
11
|
+
def self.number_to_pwm(number)
|
12
|
+
NUMBER_VALUES[number]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/little_bits.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'little_bits/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'little_bits'
|
8
|
+
spec.version = LittleBits::VERSION
|
9
|
+
spec.authors = ['Brian Kelly']
|
10
|
+
spec.email = ['polymonic@gmail.com']
|
11
|
+
spec.summary = %q{Gem for communicating with littleBits modules}
|
12
|
+
spec.description = %q{Classes to easily talk to the cloudBit and Arduino module}
|
13
|
+
spec.homepage = 'https://github.com/spilth/little_bits'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'rest_client', '~> 1.8'
|
22
|
+
spec.add_runtime_dependency 'arduino_firmata', '~>0.3.7'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec'
|
27
|
+
spec.add_development_dependency 'webmock'
|
28
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module LittleBits
|
4
|
+
describe ArduinoModule do
|
5
|
+
let(:arduino_firmata) { double(:arduino_firmata) }
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
allow(ArduinoFirmata).to receive(:connect) { arduino_firmata }
|
9
|
+
allow(Kernel).to receive(:at_exit) do |&block|
|
10
|
+
block.call
|
11
|
+
end
|
12
|
+
allow(arduino_firmata).to receive(:close)
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'deconstruction' do
|
16
|
+
it 'closes arduino connection on exit' do
|
17
|
+
LittleBits::ArduinoModule.new('serial_port')
|
18
|
+
|
19
|
+
expect(arduino_firmata).to have_received(:close)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'd1' do
|
24
|
+
context 'passing it true' do
|
25
|
+
it 'turns the d1 output on' do
|
26
|
+
allow(arduino_firmata).to receive(:digital_write).with(1, true)
|
27
|
+
|
28
|
+
arduino_module = LittleBits::ArduinoModule.new('serial_port')
|
29
|
+
|
30
|
+
arduino_module.d1(true)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'passing it false' do
|
35
|
+
it 'turns the d1 output off' do
|
36
|
+
allow(arduino_firmata).to receive(:digital_write).with(1, false)
|
37
|
+
|
38
|
+
arduino_module = LittleBits::ArduinoModule.new('serial_port')
|
39
|
+
|
40
|
+
arduino_module.d1(false)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'd5' do
|
46
|
+
context 'passing it true' do
|
47
|
+
it 'turns the d5 output on' do
|
48
|
+
allow(arduino_firmata).to receive(:digital_write).with(5, true)
|
49
|
+
|
50
|
+
arduino_module = LittleBits::ArduinoModule.new('serial_port')
|
51
|
+
|
52
|
+
arduino_module.d5(true)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'passing it false' do
|
57
|
+
it 'turns the d5 output off' do
|
58
|
+
allow(arduino_firmata).to receive(:digital_write).with(5, false)
|
59
|
+
|
60
|
+
arduino_module = LittleBits::ArduinoModule.new('serial_port')
|
61
|
+
|
62
|
+
arduino_module.d5(false)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'passing it a number' do
|
67
|
+
it 'sends the number to the arduino' do
|
68
|
+
allow(arduino_firmata).to receive(:analog_write).with(5, 128)
|
69
|
+
|
70
|
+
arduino_module = LittleBits::ArduinoModule.new('serial_port')
|
71
|
+
|
72
|
+
arduino_module.d5(128)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe 'd9' do
|
78
|
+
context 'passing it true' do
|
79
|
+
it 'turns the d9 output on' do
|
80
|
+
allow(arduino_firmata).to receive(:digital_write).with(9, true)
|
81
|
+
|
82
|
+
arduino_module = LittleBits::ArduinoModule.new('serial_port')
|
83
|
+
|
84
|
+
arduino_module.d9(true)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'passing it false' do
|
89
|
+
it 'turns the d9 output off' do
|
90
|
+
allow(arduino_firmata).to receive(:digital_write).with(9, false)
|
91
|
+
|
92
|
+
arduino_module = LittleBits::ArduinoModule.new('serial_port')
|
93
|
+
|
94
|
+
arduino_module.d9(false)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'passing it a number' do
|
99
|
+
it 'sends the number to the arduino' do
|
100
|
+
allow(arduino_firmata).to receive(:analog_write).with(9, 128)
|
101
|
+
|
102
|
+
arduino_module = LittleBits::ArduinoModule.new('serial_port')
|
103
|
+
|
104
|
+
arduino_module.d9(128)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module LittleBits
|
4
|
+
describe CloudBit do
|
5
|
+
describe '#output' do
|
6
|
+
it 'POSTs an output request to the littleBits Cloud API' do
|
7
|
+
stub_request(
|
8
|
+
:post,
|
9
|
+
'https://api-http.littlebitscloud.cc/devices/DEVICE_ID/output').
|
10
|
+
with(
|
11
|
+
:body => {
|
12
|
+
'duration_ms' => '3000',
|
13
|
+
'percent' => '100'
|
14
|
+
},
|
15
|
+
:headers => {
|
16
|
+
'Accept'=>'application/vnd.littlebits.v2+json',
|
17
|
+
'Accept-Encoding'=>'gzip, deflate',
|
18
|
+
'Authorization'=>'Bearer ACCESS_TOKEN',
|
19
|
+
'Content-Length'=>'28',
|
20
|
+
'Content-Type'=>'application/x-www-form-urlencoded',
|
21
|
+
'User-Agent'=>'Ruby'
|
22
|
+
}).
|
23
|
+
to_return(:status => 200, :body => 'OK', :headers => {})
|
24
|
+
|
25
|
+
client = LittleBits::CloudBit.new('ACCESS_TOKEN', 'DEVICE_ID')
|
26
|
+
result = client.output(100, 3000)
|
27
|
+
|
28
|
+
expect(result).to be_truthy
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module LittleBits
|
4
|
+
describe NumberModule do
|
5
|
+
describe '.number_to_pwm' do
|
6
|
+
it 'converts numbers to clock values' do
|
7
|
+
expect(NumberModule.number_to_pwm(0)).to eq 0
|
8
|
+
expect(NumberModule.number_to_pwm(1)).to eq 3
|
9
|
+
|
10
|
+
expect(NumberModule.number_to_pwm(49)).to eq 124
|
11
|
+
expect(NumberModule.number_to_pwm(50)).to eq 127
|
12
|
+
expect(NumberModule.number_to_pwm(51)).to eq 129
|
13
|
+
|
14
|
+
expect(NumberModule.number_to_pwm(98)).to eq 247
|
15
|
+
expect(NumberModule.number_to_pwm(99)).to eq 252
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
|
18
|
+
require 'webmock/rspec'
|
19
|
+
WebMock.disable_net_connect!
|
20
|
+
|
21
|
+
require './lib/little_bits'
|
22
|
+
|
23
|
+
RSpec.configure do |config|
|
24
|
+
# rspec-expectations config goes here. You can use an alternate
|
25
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
26
|
+
# assertions if you prefer.
|
27
|
+
config.expect_with :rspec do |expectations|
|
28
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
29
|
+
# and `failure_message` of custom matchers include text for helper methods
|
30
|
+
# defined using `chain`, e.g.:
|
31
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
32
|
+
# # => "be bigger than 2 and smaller than 4"
|
33
|
+
# ...rather than:
|
34
|
+
# # => "be bigger than 2"
|
35
|
+
#expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
36
|
+
end
|
37
|
+
|
38
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
39
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
40
|
+
config.mock_with :rspec do |mocks|
|
41
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
42
|
+
# a real object. This is generally recommended, and will default to
|
43
|
+
# `true` in RSpec 4.
|
44
|
+
mocks.verify_partial_doubles = true
|
45
|
+
end
|
46
|
+
|
47
|
+
# The settings below are suggested to provide a good initial experience
|
48
|
+
# with RSpec, but feel free to customize to your heart's content.
|
49
|
+
=begin
|
50
|
+
# These two settings work together to allow you to limit a spec run
|
51
|
+
# to individual examples or groups you care about by tagging them with
|
52
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
53
|
+
# get run.
|
54
|
+
config.filter_run :focus
|
55
|
+
config.run_all_when_everything_filtered = true
|
56
|
+
|
57
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
58
|
+
# For more details, see:
|
59
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
60
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
61
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
62
|
+
config.disable_monkey_patching!
|
63
|
+
|
64
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
65
|
+
# be too noisy due to issues in dependencies.
|
66
|
+
config.warnings = true
|
67
|
+
|
68
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
69
|
+
# file, and it's useful to allow more verbose output when running an
|
70
|
+
# individual spec file.
|
71
|
+
if config.files_to_run.one?
|
72
|
+
# Use the documentation formatter for detailed output,
|
73
|
+
# unless a formatter has already been configured
|
74
|
+
# (e.g. via a command-line flag).
|
75
|
+
config.default_formatter = 'doc'
|
76
|
+
end
|
77
|
+
|
78
|
+
# Print the 10 slowest examples and example groups at the
|
79
|
+
# end of the spec run, to help surface which specs are running
|
80
|
+
# particularly slow.
|
81
|
+
config.profile_examples = 10
|
82
|
+
|
83
|
+
# Run specs in random order to surface order dependencies. If you find an
|
84
|
+
# order dependency and want to debug it, you can fix the order by providing
|
85
|
+
# the seed, which is printed after each run.
|
86
|
+
# --seed 1234
|
87
|
+
config.order = :random
|
88
|
+
|
89
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
90
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
91
|
+
# test failures related to randomization by passing the same `--seed` value
|
92
|
+
# as the one that triggered the failure.
|
93
|
+
Kernel.srand config.seed
|
94
|
+
=end
|
95
|
+
end
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: little_bits
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Kelly
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest_client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: arduino_firmata
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.3.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.3.7
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Classes to easily talk to the cloudBit and Arduino module
|
98
|
+
email:
|
99
|
+
- polymonic@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- lib/little_bits.rb
|
111
|
+
- lib/little_bits/arduino_module.rb
|
112
|
+
- lib/little_bits/cloud_bit.rb
|
113
|
+
- lib/little_bits/number_module.rb
|
114
|
+
- lib/little_bits/version.rb
|
115
|
+
- little_bits.gemspec
|
116
|
+
- spec/lib/arduino_module_spec.rb
|
117
|
+
- spec/lib/cloud_bit_spec.rb
|
118
|
+
- spec/lib/number_module_spec.rb
|
119
|
+
- spec/spec_helper.rb
|
120
|
+
homepage: https://github.com/spilth/little_bits
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.2.2
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Gem for communicating with littleBits modules
|
144
|
+
test_files:
|
145
|
+
- spec/lib/arduino_module_spec.rb
|
146
|
+
- spec/lib/cloud_bit_spec.rb
|
147
|
+
- spec/lib/number_module_spec.rb
|
148
|
+
- spec/spec_helper.rb
|