scribe-rb 2.2.rc2 → 2.2.rc3

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color --format=doc
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - rbx-2.0
6
+ - jruby
7
+ - ree
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Scribe For Ruby Made Easy
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/highgroove/scribe-rb.png)](http://travis-ci.org/highgroove/scribe-rb)
4
+
3
5
  To use [Scribe](https://github.com/facebook/scribe), you usually have to
4
6
  use [Apache Thrift](http://thrift.apache.org/) to generate Ruby code
5
7
  from generic *.thrift files.
@@ -67,6 +69,7 @@ server.serve
67
69
  ## Hat Tips
68
70
 
69
71
  * [Installing and Using Scribe with Ruby on Mac OS](http://kpumuk.info/development/installing-and-using-scribe-with-ruby-on-mac-os/)
72
+ * [Ruby Web-Services with Facebook’s Thrift](http://www.igvita.com/2007/11/30/ruby-web-services-with-facebooks-thrift/)
70
73
 
71
74
  ## License
72
75
 
data/Rakefile CHANGED
@@ -1 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
File without changes
@@ -1,3 +1,7 @@
1
- require File.join(File.dirname(__FILE__), "scribe")
2
- require File.join(File.dirname(__FILE__), "facebook_base_handler")
3
- require File.join(File.dirname(__FILE__), "thrift_extras")
1
+ # Unfortunately the thrift generated files assume all the files are in the
2
+ # load path
3
+ $LOAD_PATH.push(File.expand_path("generated", File.dirname(__FILE__)))
4
+ require File.expand_path("generated/scribe", File.dirname(__FILE__))
5
+
6
+ require File.expand_path("extras/facebook_base_handler", File.dirname(__FILE__))
7
+ require File.expand_path("extras/non_strict_binary_protocol_factory", File.dirname(__FILE__))
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "scribe-rb"
6
- s.version = "2.2.rc2"
6
+ s.version = "2.2.rc3"
7
7
  s.authors = ["Andy Lindeman"]
8
8
  s.email = ["andy@highgroove.com"]
9
9
  s.homepage = "http://github.com/highgroove/scribe-rb"
@@ -18,4 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency "thrift", "~>0.7.0"
19
19
 
20
20
  s.add_development_dependency "rake"
21
+ s.add_development_dependency "rspec", "~>2.6.0"
22
+ s.add_development_dependency "timecop"
21
23
  end
@@ -0,0 +1,78 @@
1
+ require "spec_helper"
2
+
3
+ describe FacebookService::BaseHandler do
4
+ subject do
5
+ described_class.new("Test Handler")
6
+ end
7
+
8
+ describe "#getName" do
9
+ it "returns the name given in the constructor" do
10
+ subject.getName.should eq("Test Handler")
11
+ end
12
+ end
13
+
14
+ describe "#getVersion" do
15
+ it "returns an empty string" do
16
+ subject.getVersion.should be_empty
17
+ end
18
+ end
19
+
20
+ describe "#getStatus" do
21
+ it "always returns alive" do
22
+ subject.getStatus.should eq(Fb_status::ALIVE)
23
+ end
24
+ end
25
+
26
+ describe "#getStatusDetails" do
27
+ it "returns an empty string" do
28
+ subject.getStatusDetails.should be_empty
29
+ end
30
+ end
31
+
32
+ # TODO: Expose an interface for manipulating counters
33
+
34
+ describe "#setOption" do
35
+ it "stores the option" do
36
+ subject.setOption("foo", "bar")
37
+
38
+ subject.getOption("foo").should eq("bar")
39
+ end
40
+ end
41
+
42
+ describe "#getOptions" do
43
+ it "returns all options as a Hash" do
44
+ subject.setOption("foo", "bar")
45
+ subject.setOption("foo2", "bar2")
46
+
47
+
48
+ subject.getOptions.should eq({"foo" => "bar", "foo2" => "bar2"})
49
+ end
50
+ end
51
+
52
+ describe "#getCpuProfile" do
53
+ it "returns an empty string" do
54
+ subject.getCpuProfile.should be_empty
55
+ end
56
+ end
57
+
58
+ describe "#aliveSince" do
59
+ before { Timecop.freeze(Time.now) }
60
+ after { Timecop.return }
61
+
62
+ it "returns the time the service was created" do
63
+ subject.aliveSince.should eq(Time.now.to_i)
64
+ end
65
+ end
66
+
67
+ describe "#reinitialize" do
68
+ it "provides a noop method" do
69
+ subject.should respond_to(:reinitialize)
70
+ end
71
+ end
72
+
73
+ describe "#shutdown" do
74
+ it "provides a noop method" do
75
+ subject.should respond_to(:shutdown)
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,14 @@
1
+ require "spec_helper"
2
+
3
+ describe Thrift::NonStrictBinaryProtocolFactory do
4
+ subject { described_class.new }
5
+
6
+ describe "#get_protocol" do
7
+ it "constructs a BinaryProtocol instance with strict_read and strict_write as false" do
8
+ Thrift::BinaryProtocol.should_receive(:new).
9
+ with(anything, false, false)
10
+
11
+ subject.get_protocol(double)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ require "timecop"
2
+
3
+ require File.expand_path("../lib/scribe-rb", File.dirname(__FILE__))
metadata CHANGED
@@ -1,111 +1,113 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: scribe-rb
3
- version: !ruby/object:Gem::Version
4
- hash: 15424209
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.rc3
5
5
  prerelease: 4
6
- segments:
7
- - 2
8
- - 2
9
- - rc
10
- - 2
11
- version: 2.2.rc2
12
6
  platform: ruby
13
- authors:
7
+ authors:
14
8
  - Andy Lindeman
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2011-09-09 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
12
+ date: 2011-09-09 00:00:00.000000000 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thrift
17
+ requirement: &21378900 !ruby/object:Gem::Requirement
23
18
  none: false
24
- requirements:
19
+ requirements:
25
20
  - - ~>
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 0
30
- - 7
31
- - 0
21
+ - !ruby/object:Gem::Version
32
22
  version: 0.7.0
33
- name: thrift
34
23
  type: :runtime
35
24
  prerelease: false
36
- requirement: *id001
37
- - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
25
+ version_requirements: *21378900
26
+ - !ruby/object:Gem::Dependency
47
27
  name: rake
28
+ requirement: &21378460 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *21378460
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec
39
+ requirement: &21377900 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 2.6.0
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *21377900
48
+ - !ruby/object:Gem::Dependency
49
+ name: timecop
50
+ requirement: &21377480 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
48
56
  type: :development
49
57
  prerelease: false
50
- requirement: *id002
51
- description: ""
52
- email:
58
+ version_requirements: *21377480
59
+ description: ''
60
+ email:
53
61
  - andy@highgroove.com
54
62
  executables: []
55
-
56
63
  extensions: []
57
-
58
64
  extra_rdoc_files: []
59
-
60
- files:
65
+ files:
61
66
  - .gitignore
67
+ - .rspec
68
+ - .travis.yml
62
69
  - Gemfile
63
70
  - README.md
64
71
  - Rakefile
65
- - lib/facebook_base_handler.rb
66
- - lib/facebook_service.rb
67
- - lib/fb303_constants.rb
68
- - lib/fb303_types.rb
72
+ - lib/extras/facebook_base_handler.rb
73
+ - lib/extras/non_strict_binary_protocol_factory.rb
74
+ - lib/generated/facebook_service.rb
75
+ - lib/generated/fb303_constants.rb
76
+ - lib/generated/fb303_types.rb
77
+ - lib/generated/scribe.rb
78
+ - lib/generated/scribe_constants.rb
79
+ - lib/generated/scribe_types.rb
69
80
  - lib/scribe-rb.rb
70
- - lib/scribe.rb
71
- - lib/scribe_constants.rb
72
- - lib/scribe_types.rb
73
- - lib/thrift_extras.rb
74
81
  - scribe-rb.gemspec
82
+ - spec/lib/extras/facebook_base_handler_spec.rb
83
+ - spec/lib/extras/non_strict_binary_protocol_factory_spec.rb
84
+ - spec/spec_helper.rb
85
+ has_rdoc: true
75
86
  homepage: http://github.com/highgroove/scribe-rb
76
87
  licenses: []
77
-
78
88
  post_install_message:
79
89
  rdoc_options: []
80
-
81
- require_paths:
90
+ require_paths:
82
91
  - lib
83
- required_ruby_version: !ruby/object:Gem::Requirement
92
+ required_ruby_version: !ruby/object:Gem::Requirement
84
93
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ segments:
90
99
  - 0
91
- version: "0"
92
- required_rubygems_version: !ruby/object:Gem::Requirement
100
+ hash: -2559920720779231407
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
102
  none: false
94
- requirements:
95
- - - ">"
96
- - !ruby/object:Gem::Version
97
- hash: 25
98
- segments:
99
- - 1
100
- - 3
101
- - 1
103
+ requirements:
104
+ - - ! '>'
105
+ - !ruby/object:Gem::Version
102
106
  version: 1.3.1
103
107
  requirements: []
104
-
105
108
  rubyforge_project:
106
- rubygems_version: 1.8.6
109
+ rubygems_version: 1.6.2
107
110
  signing_key:
108
111
  specification_version: 3
109
112
  summary: Generated scribe and fb303 bindings for Ruby packed into a gem
110
113
  test_files: []
111
-