travis-client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ require './lib/travis'
2
+
@@ -0,0 +1,2 @@
1
+ require './spec/spec_helper'
2
+ require './spec/travis/api/shared_client_examples'
@@ -0,0 +1,15 @@
1
+ require './spec/spec_helper'
2
+ require './spec/travis/api/shared_client_examples'
3
+
4
+ module Travis
5
+
6
+ module API
7
+
8
+ describe Client do
9
+
10
+ end
11
+
12
+ end
13
+
14
+ end
15
+
@@ -0,0 +1,84 @@
1
+ require './spec/spec_helper'
2
+ require './spec/travis/api/shared_entity_examples'
3
+
4
+ module Travis
5
+
6
+ module API
7
+
8
+ class Entity
9
+
10
+ describe Build do
11
+
12
+ describe 'when initialized without attributes, owner or name' do
13
+
14
+ before(:each) do
15
+ @attributes = {}
16
+ @entity = Build.new
17
+ end
18
+
19
+ it_should_behave_like 'An Entity'
20
+
21
+ it 'should be successfully initialized' do
22
+ @entity.should be_instance_of Build
23
+ end
24
+
25
+ end
26
+
27
+ describe 'when initialized with valid attributes' do
28
+
29
+ before(:each) do
30
+ @attributes = {
31
+ 'number' => 100,
32
+ 'committed_at' => '2011-08-08T21:40:05Z',
33
+ 'commit' => 'df44d6862626d383ce755d02cd3de234bee72df9',
34
+ 'finished_at' => '2011-08-08T21:48:00Z',
35
+ 'config' => %{{"bundler_args":"--without development","script":"bundle exec rake","rvm":"ruby-head","notifications":{"irc":"irc.freenode.org#john"},".configured":"true"}},
36
+ 'author_name' => 'John Doe',
37
+ 'log' => %{Just the good ol' boys, never meanin' no harm. Beats all you've ever saw, been in trouble with the law since the day they was born. Straight'nin' the curve, flat'nin' the hills. Someday the mountain might get 'em, but the law never will. Makin' their way, the only way they know how, that's just a little bit more than the law will allow. Just good ol' boys, wouldn't change if they could, fightin' the system like a true modern day Robin Hood.},
38
+ 'branch' => 'master',
39
+ 'id' => 1,
40
+ 'parent_id' => 3,
41
+ 'started_at' => '2011-08-08T20:48:00Z',
42
+ 'author_email' => 'john@doe.com',
43
+ 'status' => 1,
44
+ 'repository_id' => 1,
45
+ 'message' => 'Changing this and that',
46
+ 'compare_url' => 'https://github.com/johndoe/travis-ci/compare/132df3e...hf44365',
47
+ }
48
+
49
+
50
+ end
51
+
52
+ describe 'whithout repository owner/name' do
53
+
54
+ before(:each) do
55
+ @entity = Build.new(@attributes)
56
+ end
57
+
58
+ it_should_behave_like 'An Entity'
59
+
60
+ end
61
+
62
+ describe 'with repository owner/name' do
63
+
64
+ before(:each) do
65
+ @repository_owner = 'johndoe'
66
+ @repository_name = 'travis-ci'
67
+
68
+ @entity = Build.new(@attributes, @repository_owner, @repository_name)
69
+ end
70
+
71
+ it_should_behave_like 'An Entity'
72
+
73
+ end
74
+
75
+ end
76
+
77
+ end
78
+
79
+ end
80
+
81
+ end
82
+
83
+ end
84
+
@@ -0,0 +1,79 @@
1
+ require './spec/spec_helper'
2
+ require './spec/travis/api/shared_entity_examples'
3
+
4
+ module Travis
5
+
6
+ module API
7
+
8
+ class Entity
9
+
10
+ describe Repository do
11
+
12
+ describe 'when initialized without attributes, owner or name' do
13
+
14
+ before(:each) do
15
+ @attributes = {}
16
+ @entity = Repository.new
17
+ end
18
+
19
+ it_should_behave_like 'An Entity'
20
+
21
+ it 'should be successfully initialized' do
22
+ @entity.should be_instance_of Repository
23
+ end
24
+
25
+ end
26
+
27
+ describe 'when initialized with valid attributes' do
28
+
29
+ before(:each) do
30
+ @attributes = {
31
+ "id" => 10,
32
+ "last_build_id" => 100,
33
+ "last_build_number" => "255",
34
+ "last_build_status" => 1,
35
+ "last_build_start_at" => "2011-08-08T21:45:13Z",
36
+ "last_build_finished_at" => "2011-08-08T21:48:00Z",
37
+ "slug" => "johndoe/travis-ci",
38
+ "status" => "unstable"
39
+ }
40
+ end
41
+
42
+ describe 'whithout owner/name' do
43
+
44
+ before(:each) do
45
+ @entity = Repository.new(@attributes)
46
+ end
47
+
48
+ it_should_behave_like 'An Entity'
49
+
50
+ it 'should recognize the name and the owner from the slug' do
51
+ @entity.owner.should == 'johndoe'
52
+ @entity.name.should == 'travis-ci'
53
+ end
54
+
55
+ end
56
+
57
+ describe 'with owner/name' do
58
+
59
+ before(:each) do
60
+ @repository_owner = 'johndoe'
61
+ @repository_name = 'travis-ci'
62
+
63
+ @entity = Repository.new(@attributes, @repository_owner, @repository_name)
64
+ end
65
+
66
+ it_should_behave_like 'An Entity'
67
+
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+
74
+ end
75
+
76
+ end
77
+
78
+ end
79
+
@@ -0,0 +1,46 @@
1
+ require './spec/spec_helper'
2
+ require './spec/travis/api/shared_entity_examples'
3
+
4
+ module Travis
5
+
6
+ module API
7
+
8
+ describe Entity do
9
+
10
+ describe 'when initialized without attributes' do
11
+
12
+ before(:each) do
13
+ @attributes = {}
14
+ @entity = Entity.new
15
+ end
16
+
17
+ it_should_behave_like 'An Entity'
18
+
19
+ it 'should be successfully initialized' do
20
+ @entity.should be_instance_of Entity
21
+ end
22
+
23
+ end
24
+
25
+ describe 'when initialized with valid attributes' do
26
+
27
+ before(:each) do
28
+ @attributes = {
29
+ 'number' => 1,
30
+ 'string' => "string",
31
+ 'array' => [1,2,3]
32
+ }
33
+
34
+ @entity = Entity.new(@attributes)
35
+ end
36
+
37
+ it_should_behave_like 'An Entity'
38
+
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
@@ -0,0 +1,3 @@
1
+ shared_examples_for "A Client" do
2
+ end
3
+
@@ -0,0 +1,16 @@
1
+ shared_examples_for "An Entity" do
2
+
3
+ it 'should respond to any of the attribute names' do
4
+ @attributes.each_key do |method|
5
+ @entity.should respond_to method
6
+ end
7
+ end
8
+
9
+ it 'should return any of the attributes' do
10
+ @attributes.each_key do |method|
11
+ @entity.send(method).should equal @attributes[method]
12
+ end
13
+ end
14
+
15
+ end
16
+
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |gem|
2
+
3
+ gem.name = 'travis-client'
4
+ gem.version = '0.1.0'
5
+ gem.date = '2011-08-16'
6
+ gem.authors = ['Roberto Decurnex']
7
+ gem.email = 'nex.development@gmail.com'
8
+ gem.description = %q{A Ruby wrapper for the Travis CI API}
9
+ gem.summary = %q{A Ruby wrapper for the Travis CI API}
10
+ gem.homepage = 'https://github.com/travis/travis-ruby-client'
11
+
12
+ gem.add_runtime_dependency 'faraday'
13
+ gem.add_runtime_dependency 'hirb'
14
+ gem.add_development_dependency 'rake'
15
+ gem.add_development_dependency 'rspec'
16
+ gem.add_development_dependency 'cucumber'
17
+
18
+ gem.required_ruby_version = '>= 1.8.7'
19
+
20
+ gem.require_paths = ['lib']
21
+ gem.files = `git ls-files`.split("\n")
22
+ gem.bindir = 'bin'
23
+ gem.executables = ['travis']
24
+
25
+ end
26
+
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: travis-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Roberto Decurnex
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-08-16 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: &75768790 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *75768790
25
+ - !ruby/object:Gem::Dependency
26
+ name: hirb
27
+ requirement: &75768490 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *75768490
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &75768190 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *75768190
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &75767860 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *75767860
58
+ - !ruby/object:Gem::Dependency
59
+ name: cucumber
60
+ requirement: &75767630 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *75767630
69
+ description: A Ruby wrapper for the Travis CI API
70
+ email: nex.development@gmail.com
71
+ executables:
72
+ - travis
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .rspec
78
+ - .travis.yml
79
+ - Gemfile
80
+ - README.textile
81
+ - Rakefile
82
+ - bin/travis
83
+ - features/repositories.feature
84
+ - features/step_definitions/repositories_steps.rb
85
+ - features/support/env.rb
86
+ - lib/travis.rb
87
+ - lib/travis/api.rb
88
+ - lib/travis/api/client.rb
89
+ - lib/travis/api/client/repositories.rb
90
+ - lib/travis/api/entity.rb
91
+ - lib/travis/api/entity/build.rb
92
+ - lib/travis/api/entity/repository.rb
93
+ - lib/travis/client.rb
94
+ - lib/travis/client/repositories.rb
95
+ - spec/spec_helper.rb
96
+ - spec/travis/api/client/repositories_spec.rb
97
+ - spec/travis/api/client_spec.rb
98
+ - spec/travis/api/entity/build_spec.rb
99
+ - spec/travis/api/entity/repository_spec.rb
100
+ - spec/travis/api/entity_spec.rb
101
+ - spec/travis/api/shared_client_examples.rb
102
+ - spec/travis/api/shared_entity_examples.rb
103
+ - travis-client.gemspec
104
+ homepage: https://github.com/travis/travis-ruby-client
105
+ licenses: []
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: 1.8.7
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 1.8.10
125
+ signing_key:
126
+ specification_version: 3
127
+ summary: A Ruby wrapper for the Travis CI API
128
+ test_files: []