brewer 0.0.10 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -15
- data/Gemfile.lock +24 -15
- data/README.md +4 -0
- data/Rakefile +4 -7
- data/bin/brewer +7 -7
- data/brewer.gemspec +6 -7
- data/lib/adaptibrew.rb +0 -5
- data/lib/brewer.rb +5 -15
- data/lib/helpers.rb +0 -9
- data/spec/adaptibrew_spec.rb +71 -0
- data/spec/brewer_spec.rb +46 -0
- data/spec/helpers_spec.rb +36 -0
- data/spec/spec_helper.rb +10 -0
- metadata +14 -14
- data/tests/tc_adaptibrew.rb +0 -26
- data/tests/tc_brewer.rb +0 -45
- data/tests/tc_helpers.rb +0 -42
- data/tests/ts_all.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fd3151ef2ca1e31779cd287565ec95a6bef5726
|
4
|
+
data.tar.gz: b6d6689d3681a42b5293ea784399ea9072f34494
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b63a554cc5966155fa62a37f91ee7625efc38d5997a8fde3009e670a544e9f83ecbdb93a934c28f55feb024582e4bfe58f34c197a062b0bd1fcb4d28a74fda78
|
7
|
+
data.tar.gz: fda7bd47781e154b96fe918fb5e44192f964000a64d6b11967a6a17d87228fb17d2237f9baa84306d5867b2d3a4094a8044b3ff730e9a389a97b983a72417e7a
|
data/Gemfile
CHANGED
@@ -1,18 +1,3 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
# Yes, I use a Gemfile and .gemspec. Get over it. This is largely a personal project,
|
4
|
-
# but i would like some of the things gems provide.
|
5
|
-
|
6
3
|
gemspec
|
7
|
-
|
8
|
-
gem 'ripl'
|
9
|
-
gem 'git'
|
10
|
-
|
11
|
-
group :test do
|
12
|
-
gem 'rake'
|
13
|
-
gem 'test-unit'
|
14
|
-
gem 'launchy'
|
15
|
-
gem 'simplecov'
|
16
|
-
gem 'simplecov-html'
|
17
|
-
gem 'rdoc'
|
18
|
-
end
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
brewer (0.0.
|
5
|
-
git (>=
|
6
|
-
ripl (
|
4
|
+
brewer (0.0.10)
|
5
|
+
git (~> 1.3, >= 1.3.0)
|
6
|
+
ripl (~> 0.7.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -11,38 +11,47 @@ GEM
|
|
11
11
|
addressable (2.5.0)
|
12
12
|
public_suffix (~> 2.0, >= 2.0.2)
|
13
13
|
bond (0.5.1)
|
14
|
+
diff-lcs (1.2.5)
|
14
15
|
docile (1.1.5)
|
15
16
|
git (1.3.0)
|
16
17
|
json (2.0.3)
|
17
18
|
launchy (2.4.3)
|
18
19
|
addressable (~> 2.3)
|
19
|
-
power_assert (0.2.2)
|
20
20
|
public_suffix (2.0.4)
|
21
21
|
rake (12.0.0)
|
22
|
-
rdoc (
|
22
|
+
rdoc (5.1.0)
|
23
23
|
ripl (0.7.1)
|
24
24
|
bond (~> 0.5.1)
|
25
|
+
rspec (3.5.0)
|
26
|
+
rspec-core (~> 3.5.0)
|
27
|
+
rspec-expectations (~> 3.5.0)
|
28
|
+
rspec-mocks (~> 3.5.0)
|
29
|
+
rspec-core (3.5.4)
|
30
|
+
rspec-support (~> 3.5.0)
|
31
|
+
rspec-expectations (3.5.0)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.5.0)
|
34
|
+
rspec-mocks (3.5.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.5.0)
|
37
|
+
rspec-support (3.5.0)
|
25
38
|
simplecov (0.13.0)
|
26
39
|
docile (~> 1.1.0)
|
27
40
|
json (>= 1.8, < 3)
|
28
41
|
simplecov-html (~> 0.10.0)
|
29
42
|
simplecov-html (0.10.0)
|
30
|
-
test-unit (3.0.8)
|
31
|
-
power_assert
|
32
43
|
|
33
44
|
PLATFORMS
|
34
45
|
ruby
|
35
46
|
|
36
47
|
DEPENDENCIES
|
37
48
|
brewer!
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
simplecov
|
44
|
-
simplecov-html
|
45
|
-
test-unit
|
49
|
+
launchy (~> 2.4, >= 2.4.0)
|
50
|
+
rake (~> 12.0, >= 12.0.0)
|
51
|
+
rdoc (~> 5.1, >= 5.1.0)
|
52
|
+
rspec (~> 3.5.0, >= 3.5.0)
|
53
|
+
simplecov (~> 0.13.0)
|
54
|
+
simplecov-html (~> 0.10.0)
|
46
55
|
|
47
56
|
BUNDLED WITH
|
48
57
|
1.12.5
|
data/README.md
CHANGED
@@ -18,3 +18,7 @@ to open an interactive shell to control your brew rig in realtime. Fancy.
|
|
18
18
|
# Documentation
|
19
19
|
**Warning: RDoc may have a seizure when encountering Gemfiles, Rakefiles, etc. Basically files that don't end in `.rb` but have ruby syntax. Docs will be a bit weird on those files. I suggest just reading the comments in source.**
|
20
20
|
Documentation is in `doc/` or on rubygems.org
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
for build triggers, please ignore
|
data/Rakefile
CHANGED
@@ -1,18 +1,15 @@
|
|
1
1
|
require 'git'
|
2
2
|
require 'launchy'
|
3
3
|
require 'rdoc/task'
|
4
|
+
require 'rspec/core/rake_task'
|
4
5
|
|
5
|
-
task default: %w[
|
6
|
+
task default: %w[spec]
|
6
7
|
|
7
8
|
# Unit testing
|
8
9
|
# You can specify a specific test case to use
|
9
10
|
# Ex: rake test['brewer']
|
10
|
-
task :
|
11
|
-
|
12
|
-
ruby "tests/tc_#{tc.to_a[0]}.rb"
|
13
|
-
else
|
14
|
-
ruby "tests/ts_all.rb"
|
15
|
-
end
|
11
|
+
task :spec, [:tc] do |t, tc|
|
12
|
+
RSpec::Core::RakeTask.new(:spec)
|
16
13
|
end
|
17
14
|
|
18
15
|
# Opens code coverage in your browser
|
data/bin/brewer
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
2
|
+
# 🍺🍺🍺
|
3
|
+
# This executable will start a Ripl shell with a 'brewer' and 'adaptibrew' objects
|
4
|
+
|
3
5
|
require 'ripl'
|
4
6
|
|
5
|
-
# pull in our source
|
6
7
|
require_relative "../lib/brewer"
|
7
8
|
|
8
|
-
#
|
9
|
+
# Refresh to make sure we have the lastest version of adaptibrew
|
9
10
|
adaptibrew = Adaptibrew.new.refresh
|
10
11
|
|
11
|
-
# Start up a brewer
|
12
12
|
brewer = Brewer.new
|
13
13
|
|
14
|
-
# Warning
|
15
14
|
puts "Warning: Adaptibrew has been cloned into the directory you executed 'brewer'"
|
16
15
|
puts "You may wish to delete it when you are finished. Do that with `adaptibrew.clear`"
|
16
|
+
puts "🍺 have fun 🍺"
|
17
17
|
|
18
|
-
#
|
18
|
+
# 🍺🍺🍺
|
19
19
|
Ripl.start :binding => binding
|
20
|
-
#
|
20
|
+
# 🍺🍺🍺
|
data/brewer.gemspec
CHANGED
@@ -2,31 +2,30 @@ require 'rake'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "brewer"
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.21"
|
6
6
|
s.default_executable = "brewer"
|
7
7
|
|
8
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
8
|
s.authors = ["Luke Sweeney"]
|
10
9
|
s.date = %q{2017-03-08}
|
11
10
|
s.description = %q{A Ruby API for adaptiman/adaptibrew}
|
12
11
|
s.email = %q{luke@thesweeneys.org}
|
13
|
-
s.files = FileList.new(['lib/*.rb', 'bin/*', '[A-Z]*', '
|
12
|
+
s.files = FileList.new(['lib/*.rb', 'bin/*', '[A-Z]*', 'spec/*.rb']).to_a
|
14
13
|
s.executables = ['brewer']
|
15
14
|
s.bindir = 'bin'
|
16
|
-
s.test_files = FileList.new(["
|
15
|
+
s.test_files = FileList.new(["spec/*.rb"]).to_a
|
17
16
|
s.homepage = %q{http://github.com/llamicron/brewer}
|
18
17
|
s.require_paths = ["lib", "lib"]
|
19
18
|
s.rubygems_version = %q{1.6.2}
|
20
19
|
s.summary = %q{A shell interface for adaptibrew}
|
21
20
|
s.license = 'MIT'
|
22
21
|
|
23
|
-
#
|
24
|
-
|
22
|
+
# Runtime dependencies
|
25
23
|
s.add_runtime_dependency 'git', '~> 1.3', '>= 1.3.0'
|
26
24
|
s.add_runtime_dependency 'ripl', '~> 0.7.0'
|
27
25
|
|
26
|
+
# Dev dependencies
|
28
27
|
s.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0'
|
29
|
-
s.add_development_dependency '
|
28
|
+
s.add_development_dependency 'rspec', '~> 3.5.0', '>= 3.5.0'
|
30
29
|
s.add_development_dependency 'launchy', '~> 2.4', '>= 2.4.0'
|
31
30
|
s.add_development_dependency 'simplecov', '~> 0.13.0'
|
32
31
|
s.add_development_dependency 'simplecov-html', '~> 0.10.0'
|
data/lib/adaptibrew.rb
CHANGED
@@ -4,10 +4,8 @@ require 'fileutils'
|
|
4
4
|
# This is the 'manager' for the adaptibrew repo. It handles cloning and such.
|
5
5
|
class Adaptibrew
|
6
6
|
|
7
|
-
# Clone the repo into the current directory, unless a path is provided
|
8
7
|
# If used in IRB, Ripl, etc. it will clone into the directory IRB was started in
|
9
8
|
def clone(path=nil)
|
10
|
-
# Don't clone if it's already there.
|
11
9
|
if !Dir.exists?('adaptibrew')
|
12
10
|
Git.clone('https://github.com/adaptiman/adaptibrew.git', 'adaptibrew', :path => path)
|
13
11
|
end
|
@@ -15,14 +13,11 @@ class Adaptibrew
|
|
15
13
|
end
|
16
14
|
|
17
15
|
# Danger zone...
|
18
|
-
# Clears the adaptibrew repo
|
19
16
|
def clear()
|
20
17
|
FileUtils.rm_rf('adaptibrew')
|
21
18
|
self
|
22
19
|
end
|
23
20
|
|
24
|
-
# Clear and re-clone the adaptibrew repo
|
25
|
-
# This can also serve as an update method
|
26
21
|
def refresh
|
27
22
|
clear
|
28
23
|
clone
|
data/lib/brewer.rb
CHANGED
@@ -3,44 +3,34 @@ require_relative 'adaptibrew'
|
|
3
3
|
|
4
4
|
include Helpers
|
5
5
|
|
6
|
-
# This is the main brewer class.
|
7
|
-
# This contains all the methods needed to control a brew rig
|
8
|
-
# setup with adaptiman/adaptibrew.
|
9
6
|
class Brewer
|
10
7
|
|
11
|
-
# Path to the gem root
|
12
8
|
attr_reader :base_path
|
13
|
-
|
14
|
-
# Output of adaptibrew
|
15
|
-
attr_accessor :out
|
9
|
+
attr_accessor :out, :log
|
16
10
|
|
17
11
|
def initialize
|
18
|
-
# Path of the package
|
19
12
|
@base_path = Dir.pwd
|
20
|
-
# Output
|
13
|
+
# Output of adaptibrew
|
21
14
|
@out = []
|
22
|
-
# Log file for @out. Everything in the log file will be from @out.
|
23
15
|
@log = @base_path + '/logs/output'
|
24
16
|
end
|
25
17
|
|
26
18
|
public
|
27
19
|
|
28
|
-
# Waits for `time` seconds. Pretty simple stuff.
|
29
20
|
def wait(time=30)
|
30
|
-
puts "Waiting for #{time} seconds"
|
31
21
|
sleep(time)
|
32
22
|
self
|
33
23
|
end
|
34
24
|
|
35
25
|
# Runs an adaptibrew script
|
36
|
-
# Output will be stored in
|
26
|
+
# Output will be stored in @out
|
37
27
|
def script(script, params=nil)
|
38
28
|
@out.unshift(`python #{@base_path}/adaptibrew/#{script}.py #{params}`.chomp)
|
39
29
|
self
|
40
30
|
end
|
41
31
|
|
42
|
-
# Clears the
|
43
|
-
# Writes current
|
32
|
+
# Clears the @out array
|
33
|
+
# Writes current @out to log
|
44
34
|
# This is why the prod log is changed when tests are run
|
45
35
|
def clear
|
46
36
|
write_log(@log, @out)
|
data/lib/helpers.rb
CHANGED
@@ -1,27 +1,18 @@
|
|
1
|
-
# Helpers Module.
|
2
|
-
# For methods that don't quite fit anywhere else,
|
3
|
-
# or that I need globally
|
4
1
|
module Helpers
|
5
2
|
|
6
|
-
# Returns the default location for the log file.
|
7
|
-
# A different log file is used for testing
|
8
3
|
def log
|
9
4
|
Dir.pwd + '/logs/output'
|
10
5
|
end
|
11
6
|
|
12
|
-
# Gets the current date and time
|
13
7
|
# Formatted as: 03/07/2017 14:26
|
14
8
|
def time
|
15
9
|
Time.now.strftime("%m/%d/%Y %H:%M")
|
16
10
|
end
|
17
11
|
|
18
|
-
# Truncates (deletes) the entire log
|
19
12
|
def clear_log(log)
|
20
13
|
File.truncate(log, 0)
|
21
14
|
end
|
22
15
|
|
23
|
-
# Writes each `line` element to `logs/output` with a timestamp. Example:
|
24
|
-
# [03/07/2017 14:27]: it worked
|
25
16
|
def write_log(log, lines)
|
26
17
|
File.open(log, 'a') do |file|
|
27
18
|
lines.each do |line|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe Adaptibrew do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@adaptibrew = Adaptibrew.new.refresh
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "#new" do
|
10
|
+
specify { expect(@adaptibrew).to be_an_instance_of Adaptibrew }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe ".clear" do
|
14
|
+
context "when the repo already exists" do
|
15
|
+
specify { expect(Dir.exists?('adaptibrew')).to be true }
|
16
|
+
|
17
|
+
it "deletes the repo" do
|
18
|
+
@adaptibrew.clear
|
19
|
+
expect(Dir.exists?('adaptibrew')).to be false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when the repo does not exist" do
|
24
|
+
let(:adaptibrew) { Adaptibrew.new }
|
25
|
+
before { adaptibrew.clear }
|
26
|
+
specify { expect(Dir.exists?('adaptibrew')).to be false }
|
27
|
+
|
28
|
+
it "does nothing" do
|
29
|
+
@adaptibrew.clear
|
30
|
+
expect(Dir.exists?('adaptibrew')).to be false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
describe ".clone" do
|
37
|
+
context "when the repo does not exist" do
|
38
|
+
let(:adaptibrew) { Adaptibrew.new }
|
39
|
+
before { adaptibrew.clear }
|
40
|
+
specify { expect(Dir.exists?('adaptibrew')).to be false }
|
41
|
+
|
42
|
+
it "clones the repo" do
|
43
|
+
@adaptibrew.clone
|
44
|
+
expect(Dir.exists?('adaptibrew')).to be true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "when the repo exists" do
|
49
|
+
let(:adaptibrew) { Adaptibrew.new }
|
50
|
+
before { adaptibrew.clone }
|
51
|
+
specify { expect(Dir.exists?('adaptibrew')).to be true }
|
52
|
+
|
53
|
+
it "does nothing" do
|
54
|
+
@adaptibrew.clone
|
55
|
+
expect(Dir.exists?('adaptibrew')).to be true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
describe ".refresh" do
|
62
|
+
let(:adaptibrew) { Adaptibrew.new }
|
63
|
+
before { adaptibrew.refresh }
|
64
|
+
it "clears and clones the repo" do # regardless of wether or not it's there
|
65
|
+
expect(Dir.exists?('adaptibrew')).to be true
|
66
|
+
@adaptibrew.refresh
|
67
|
+
expect(Dir.exists?('adaptibrew')).to be true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
data/spec/brewer_spec.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe Brewer do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@brewer = Brewer.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "#new" do
|
10
|
+
it "returns a brewer object" do
|
11
|
+
expect(@brewer).to be_an_instance_of Brewer
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ".wait" do
|
16
|
+
# This is kind of iffy like the Helpers#time test
|
17
|
+
it "can wait for a number of seconds" do
|
18
|
+
# not using let(:current_time) etc. because
|
19
|
+
# the var is created upon the first calling, which is in the expect()
|
20
|
+
current_time = Time.now.to_i
|
21
|
+
@brewer.wait(1)
|
22
|
+
expect(current_time + 1).to eq(Time.now.to_i)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe ".script" do
|
27
|
+
it "can run a python script and get output" do
|
28
|
+
@brewer.script('python_tester')
|
29
|
+
expect(@brewer.out.first).to eq("it worked")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe ".clear" do
|
34
|
+
context "when there is output" do
|
35
|
+
let(:brewer) { Brewer.new }
|
36
|
+
before { brewer.script('python_tester') }
|
37
|
+
specify { expect(brewer.out.first).to eq("it worked") }
|
38
|
+
|
39
|
+
it "can clear the output" do
|
40
|
+
@brewer.clear
|
41
|
+
expect(@brewer.out).to be_empty
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
include Helpers
|
4
|
+
|
5
|
+
describe "Helpers" do
|
6
|
+
|
7
|
+
it "returns the log file path" do
|
8
|
+
expect(log).to eq(Dir.pwd + '/logs/output')
|
9
|
+
end
|
10
|
+
|
11
|
+
it "can return the date/time" do
|
12
|
+
# This might not be consistent???
|
13
|
+
# What if the minute changes during tests?
|
14
|
+
# dunno lol
|
15
|
+
expect(time).to eq(Time.now.strftime("%m/%d/%Y %H:%M"))
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when the log is empty" do
|
19
|
+
before { clear_log(log) }
|
20
|
+
specify { expect(File.zero?(log)).to be true }
|
21
|
+
it "can write to the log" do
|
22
|
+
write_log(log, ['log entry'])
|
23
|
+
expect(File.zero?(log)).to be false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when the log is not empty" do
|
28
|
+
write_log(log, ['log entry'])
|
29
|
+
specify { expect(File.zero?(log)).to be false }
|
30
|
+
it "can clear the log" do
|
31
|
+
clear_log(log)
|
32
|
+
expect(File.zero?(log)).to be true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# This is the helper file for rspec
|
2
|
+
# For the spec of helpers.rb, see helper_spec.b
|
3
|
+
# Code Coverage
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.command_name 'RSpec'
|
6
|
+
SimpleCov.start
|
7
|
+
|
8
|
+
require_relative '../lib/adaptibrew.rb'
|
9
|
+
require_relative '../lib/brewer.rb'
|
10
|
+
require_relative '../lib/helpers.rb'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Sweeney
|
@@ -65,25 +65,25 @@ dependencies:
|
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 12.0.0
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
68
|
+
name: rspec
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
73
|
+
version: 3.5.0
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 3.
|
76
|
+
version: 3.5.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 3.5.0
|
84
84
|
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 3.
|
86
|
+
version: 3.5.0
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: launchy
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,10 +168,10 @@ files:
|
|
168
168
|
- lib/adaptibrew.rb
|
169
169
|
- lib/brewer.rb
|
170
170
|
- lib/helpers.rb
|
171
|
-
-
|
172
|
-
-
|
173
|
-
-
|
174
|
-
-
|
171
|
+
- spec/adaptibrew_spec.rb
|
172
|
+
- spec/brewer_spec.rb
|
173
|
+
- spec/helpers_spec.rb
|
174
|
+
- spec/spec_helper.rb
|
175
175
|
homepage: http://github.com/llamicron/brewer
|
176
176
|
licenses:
|
177
177
|
- MIT
|
@@ -198,7 +198,7 @@ signing_key:
|
|
198
198
|
specification_version: 4
|
199
199
|
summary: A shell interface for adaptibrew
|
200
200
|
test_files:
|
201
|
-
-
|
202
|
-
-
|
203
|
-
-
|
204
|
-
-
|
201
|
+
- spec/adaptibrew_spec.rb
|
202
|
+
- spec/brewer_spec.rb
|
203
|
+
- spec/helpers_spec.rb
|
204
|
+
- spec/spec_helper.rb
|
data/tests/tc_adaptibrew.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require_relative '../lib/adaptibrew'
|
3
|
-
|
4
|
-
class TestGit < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@adaptibrew = Adaptibrew.new
|
8
|
-
end
|
9
|
-
|
10
|
-
# `refresh` calls both `clone` and `clear`. oh that sweet, sweet code coverage
|
11
|
-
def test_refresh
|
12
|
-
@adaptibrew.refresh
|
13
|
-
assert_true(Dir.exists?('adaptibrew'))
|
14
|
-
end
|
15
|
-
|
16
|
-
# Testing a not-so-failed case of cloning
|
17
|
-
def test_clone_will_skip_if_repo_present
|
18
|
-
@adaptibrew.refresh
|
19
|
-
assert_equal(@adaptibrew, @adaptibrew.clone)
|
20
|
-
end
|
21
|
-
|
22
|
-
def teardown
|
23
|
-
@adaptibrew.refresh
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
data/tests/tc_brewer.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require_relative '../lib/brewer'
|
4
|
-
require_relative '../lib/adaptibrew'
|
5
|
-
|
6
|
-
# Test the brewer class
|
7
|
-
class TestBrewer < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@brewer = Brewer.new
|
11
|
-
Adaptibrew.new.refresh
|
12
|
-
# This is used for log testing, not logging tests. see `test_log_methods`
|
13
|
-
@log = @brewer.base_path + '/logs/test_output'
|
14
|
-
end
|
15
|
-
|
16
|
-
# Make sure that the path is correct. I hate working with paths.
|
17
|
-
# TODO: Test this on windows
|
18
|
-
def test_base_path
|
19
|
-
assert_equal(Dir.pwd, @brewer.base_path)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Don't really know how to test this one...
|
23
|
-
# Just running the code for coverage and to pick up any stray errors
|
24
|
-
def test_wait
|
25
|
-
@brewer.wait(0.1)
|
26
|
-
assert_true(true)
|
27
|
-
end
|
28
|
-
|
29
|
-
# Runs the 'python_tester.py' which print "it worked".
|
30
|
-
# Ensures that ruby can run python without errors.
|
31
|
-
def test_script_and_output
|
32
|
-
@brewer.script('python_tester')
|
33
|
-
assert_equal("it worked", @brewer.out.first)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Tests if the adaptibrew output (@brewer.out) can be cleared.
|
37
|
-
# This invloves writing to the log file
|
38
|
-
def test_clear_output
|
39
|
-
@brewer.script('python_tester')
|
40
|
-
assert_equal("it worked", @brewer.out.first)
|
41
|
-
@brewer.clear
|
42
|
-
assert_equal(nil, @brewer.out.first)
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/tests/tc_helpers.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require_relative '../lib/helpers'
|
4
|
-
|
5
|
-
class TestHelpers < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@brewer = Brewer.new
|
9
|
-
# See comment on `test_log`
|
10
|
-
@log = @brewer.base_path + '/logs/test_output'
|
11
|
-
clear_log(@log)
|
12
|
-
end
|
13
|
-
|
14
|
-
# Test that Helpers#time will rturn a string
|
15
|
-
# Not sure how to test the format, since that would require knowing the actual
|
16
|
-
# time. Might get messy.
|
17
|
-
def test_time
|
18
|
-
assert_equal(String, time.class)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_log
|
22
|
-
# This will give us the actual log i.e. '/logs/output', not the test log
|
23
|
-
assert_equal(Dir.pwd + "/logs/output", log)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_log_methods
|
27
|
-
# Clear adaptibrew ouput from brewer
|
28
|
-
@brewer.clear
|
29
|
-
|
30
|
-
clear_log(@log)
|
31
|
-
assert_true(File.zero?(@log))
|
32
|
-
|
33
|
-
# Get some output
|
34
|
-
@brewer.script('python_tester')
|
35
|
-
assert_true(@brewer.out.any?)
|
36
|
-
|
37
|
-
# Write output
|
38
|
-
write_log(@log, @brewer.out)
|
39
|
-
assert_true(!File.zero?(@log))
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
data/tests/ts_all.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# Code Coverage
|
2
|
-
require 'simplecov'
|
3
|
-
SimpleCov.command_name 'Unit Tests'
|
4
|
-
SimpleCov.start
|
5
|
-
|
6
|
-
# Require helper methods
|
7
|
-
require_relative '../lib/helpers'
|
8
|
-
include Helpers
|
9
|
-
|
10
|
-
# Test Framework
|
11
|
-
require 'test/unit'
|
12
|
-
|
13
|
-
# Test Cases
|
14
|
-
require_relative 'tc_adaptibrew'
|
15
|
-
require_relative 'tc_brewer'
|
16
|
-
require_relative 'tc_helpers'
|