nimbo 0.0.2 → 0.0.3
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.
- data/Rakefile +6 -9
- data/bin/nimbo +4 -4
- data/lib/nimbo.rb +2 -1
- data/lib/nimbo/client.rb +9 -17
- data/lib/nimbo/suite.rb +19 -0
- data/lib/nimbo/version.rb +1 -1
- data/nimbo.gemspec +1 -0
- data/spec/lib/nimbo/client_spec.rb +27 -0
- data/spec/lib/nimbo/suite_spec.rb +32 -0
- data/spec/spec_helper.rb +7 -0
- metadata +23 -9
- data/test/lib/nimbo/version_test.rb +0 -7
- data/test/test_helper.rb +0 -3
data/Rakefile
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
t.verbose = true
|
8
|
-
end
|
9
|
-
|
10
|
-
task :default => :test
|
4
|
+
desc "Run specs"
|
5
|
+
RSpec::Core::RakeTask.new
|
6
|
+
|
7
|
+
task :default => :spec
|
data/bin/nimbo
CHANGED
@@ -3,8 +3,8 @@ require 'nimbo'
|
|
3
3
|
|
4
4
|
suite_dir = ARGV[0] || '.'
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
suite = Nimbo::Client::Suite.new suite_dir
|
7
|
+
client = Nimbo::Client.new
|
8
8
|
|
9
|
-
|
10
|
-
puts
|
9
|
+
response = nimbo_client.send suite
|
10
|
+
puts response
|
data/lib/nimbo.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require "nimbo/client"
|
1
|
+
require "nimbo/client"
|
2
|
+
require "nimbo/suite"
|
data/lib/nimbo/client.rb
CHANGED
@@ -1,22 +1,14 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
class Nimbo::Client
|
4
|
+
attr_accessor :service_url
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
6
|
+
def initialize
|
7
|
+
@service_url = 'http://nimbolab.com/test'
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
10
|
+
def send(suite)
|
11
|
+
RestClient.post @service_url, :suite_archive => suite.archive
|
12
|
+
end
|
13
|
+
end
|
16
14
|
|
17
|
-
def request(suite_archive)
|
18
|
-
RestClient.post @service_url, :suite_archive => File.new(suite_archive, 'rb')
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
data/lib/nimbo/suite.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'zip/zip'
|
2
|
+
|
3
|
+
class Nimbo::Client::Suite
|
4
|
+
attr_accessor :tmp_dir
|
5
|
+
|
6
|
+
def initialize(suite_dir)
|
7
|
+
@suite_dir = suite_dir
|
8
|
+
@tmp_dir = ENV['TMPDIR']
|
9
|
+
end
|
10
|
+
|
11
|
+
def archive
|
12
|
+
`tar -cvf #{archive_path} #{@suite_dir}`
|
13
|
+
File.new(archive_path, 'a+')
|
14
|
+
end
|
15
|
+
|
16
|
+
def archive_path
|
17
|
+
File.join @tmp_dir, "suite_#{object_id}.tar.gz"
|
18
|
+
end
|
19
|
+
end
|
data/lib/nimbo/version.rb
CHANGED
data/nimbo.gemspec
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Nimbo::Client' do
|
4
|
+
before :each do
|
5
|
+
@client = Nimbo::Client.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "is defined" do
|
9
|
+
Nimbo::Client.should_not be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "service_url" do
|
13
|
+
it "is defined" do
|
14
|
+
@client.service_url.should_not be_nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#send' do
|
19
|
+
it 'returns nimbo service response' do
|
20
|
+
response = "result data"
|
21
|
+
RestClient.stub(:post).and_return response
|
22
|
+
suite = Nimbo::Client::Suite.new "/home/user/suite"
|
23
|
+
suite.stub(:archive).and_return(File.new('test', 'a+'))
|
24
|
+
@client.send(suite).should == response
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Nimbo::Client::Suite' do
|
4
|
+
it "is defined" do
|
5
|
+
Nimbo::Client::Suite.should_not be_nil
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#archive" do
|
9
|
+
before :each do
|
10
|
+
@suite = Nimbo::Client::Suite.new "/home/user/suite"
|
11
|
+
@suite.stub(:`).and_return('archive file created')
|
12
|
+
@archive_path = File.join(@suite.tmp_dir, "suite_#{@suite.object_id}.tar.gz")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "creates archive file in tmp dir" do
|
16
|
+
@suite.archive.path.should == @archive_path
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns archive file" do
|
20
|
+
File.file?(@suite.archive).should be_true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#archive_path" do
|
25
|
+
it "returns archive file path" do
|
26
|
+
suite = Nimbo::Client::Suite.new "home/user/suite"
|
27
|
+
suite.tmp_dir = '/tmp/dir'
|
28
|
+
suite.archive_path.should == File.join("/tmp/dir", "suite_#{suite.object_id}.tar.gz")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nimbo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70243079271220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,18 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70243079271220
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &70243079270160 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70243079270160
|
25
36
|
description: NimboLab client
|
26
37
|
email:
|
27
38
|
- gbiesiadecki@gmail.com
|
@@ -38,10 +49,12 @@ files:
|
|
38
49
|
- bin/nimbo
|
39
50
|
- lib/nimbo.rb
|
40
51
|
- lib/nimbo/client.rb
|
52
|
+
- lib/nimbo/suite.rb
|
41
53
|
- lib/nimbo/version.rb
|
42
54
|
- nimbo.gemspec
|
43
|
-
-
|
44
|
-
-
|
55
|
+
- spec/lib/nimbo/client_spec.rb
|
56
|
+
- spec/lib/nimbo/suite_spec.rb
|
57
|
+
- spec/spec_helper.rb
|
45
58
|
homepage: ''
|
46
59
|
licenses: []
|
47
60
|
post_install_message:
|
@@ -56,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
69
|
version: '0'
|
57
70
|
segments:
|
58
71
|
- 0
|
59
|
-
hash:
|
72
|
+
hash: 883788078828805168
|
60
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
74
|
none: false
|
62
75
|
requirements:
|
@@ -65,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
78
|
version: '0'
|
66
79
|
segments:
|
67
80
|
- 0
|
68
|
-
hash:
|
81
|
+
hash: 883788078828805168
|
69
82
|
requirements: []
|
70
83
|
rubyforge_project: nimbo
|
71
84
|
rubygems_version: 1.8.15
|
@@ -73,5 +86,6 @@ signing_key:
|
|
73
86
|
specification_version: 3
|
74
87
|
summary: NimboLab client
|
75
88
|
test_files:
|
76
|
-
-
|
77
|
-
-
|
89
|
+
- spec/lib/nimbo/client_spec.rb
|
90
|
+
- spec/lib/nimbo/suite_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
data/test/test_helper.rb
DELETED