rbitter 0.2.0-java → 0.2.1-java
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 +4 -4
- data/.gitignore +23 -22
- data/.rspec +2 -2
- data/.travis.yml +15 -15
- data/Gemfile +12 -12
- data/LICENSE.txt +22 -22
- data/Rakefile +8 -8
- data/bin/rbitter +20 -20
- data/lib/rbitter/arcserver.rb +169 -165
- data/lib/rbitter/console.rb +93 -93
- data/lib/rbitter/default/config_json.rb +41 -41
- data/lib/rbitter/dlthread.rb +62 -62
- data/lib/rbitter/env.rb +116 -116
- data/lib/rbitter/override/gems/rubysl-socket/socket.rb +8 -8
- data/lib/rbitter/override/gems/twitter/connection.rb +45 -45
- data/lib/rbitter/override.rb +47 -47
- data/lib/rbitter/progress.rb +23 -0
- data/lib/rbitter/records.rb +127 -127
- data/lib/rbitter/records_migrate/20150327_add_index.rb +11 -11
- data/lib/rbitter/records_migrate/20150504_add_replyto_column.rb +11 -11
- data/lib/rbitter/streaming.rb +104 -104
- data/lib/rbitter/version.rb +20 -20
- data/lib/rbitter/xmlrpc.rb +3 -3
- data/lib/rbitter/xmlrpcd/base.rb +24 -24
- data/lib/rbitter/xmlrpcd/rpchandles.rb +11 -11
- data/lib/rbitter/xmlrpcd/xmlrpc_auth_server.rb +82 -82
- data/lib/rbitter/xmlrpcd/xmlrpcd.rb +69 -69
- data/lib/rbitter.rb +62 -62
- data/rbitter.gemspec +46 -46
- data/spec/config/default.json +32 -32
- data/spec/rbitter/arcserver_spec.rb +30 -30
- data/spec/rbitter/console_spec.rb +9 -9
- data/spec/rbitter/default/config_json_spec.rb +3 -3
- data/spec/rbitter/dlthread_spec.rb +8 -8
- data/spec/rbitter/env_spec.rb +76 -76
- data/spec/rbitter/override/gems/twitter/connection_spec.rb +8 -8
- data/spec/rbitter/progress_spec.rb +1 -0
- data/spec/rbitter/records_spec.rb +13 -13
- data/spec/rbitter/streaming_spec.rb +9 -9
- data/spec/rbitter/version_spec.rb +8 -8
- data/spec/rbitter/xmlrpc_spec.rb +8 -8
- data/spec/rbitter/xmlrpcd/base_spec.rb +29 -29
- data/spec/rbitter/xmlrpcd/rpchandles_spec.rb +10 -10
- data/spec/rbitter/xmlrpcd/xmlrpc_auth_server_spec.rb +8 -8
- data/spec/rbitter/xmlrpcd/xmlrpcd_spec.rb +9 -9
- data/spec/rbitter_spec.rb +38 -38
- data/spec/spec_helper.rb +39 -39
- metadata +6 -3
data/lib/rbitter.rb
CHANGED
@@ -1,62 +1,62 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
|
4
|
-
require "rbitter/version"
|
5
|
-
require "rbitter/arcserver"
|
6
|
-
require "rbitter/env"
|
7
|
-
require "rbitter/console"
|
8
|
-
require "rbitter/xmlrpc"
|
9
|
-
require "rbitter/override"
|
10
|
-
|
11
|
-
module Rbitter
|
12
|
-
BOOTSTRAP_ARGS = ['configure', 'console', 'help', 'logs', 'serve']
|
13
|
-
|
14
|
-
def self.rbitter_header
|
15
|
-
puts "Rbitter #{VERSION} on #{RUBY_VERSION} (#{RUBY_PLATFORM})"
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.rbitter_help_msg
|
19
|
-
puts "Rbitter is a Twitter streaming archiver, with XMLRPC access."
|
20
|
-
puts "-------"
|
21
|
-
puts "Usage: rbitter (application-mode)"
|
22
|
-
puts "application-mode's are:"
|
23
|
-
puts "|- serve : Launch Rbitter full system (Streaming + Database + XMLRPC)"
|
24
|
-
puts "|- console : Launch console application utilizing XMLRPC"
|
25
|
-
puts "|- configure: Write default configuration file 'config.json' in current folder"
|
26
|
-
puts "|- help : Show this message"
|
27
|
-
puts "`- logs : Show Rbitter internal logs"
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.bootstrap_configs
|
31
|
-
require "rbitter/default/config_json"
|
32
|
-
|
33
|
-
open(File.join(Dir.pwd, "config.json"), "w") { |io|
|
34
|
-
io.write(DEFAULT_CONFIG_JSON)
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.bootstrap args=[]
|
39
|
-
return nil if args.length < 1
|
40
|
-
|
41
|
-
if args[0] == "serve"
|
42
|
-
Rbitter.config_initialize
|
43
|
-
|
44
|
-
archive_server = Rbitter::ArcServer.new
|
45
|
-
archive_server.main_loop
|
46
|
-
elsif args[0] == "help"
|
47
|
-
rbitter_help_msg
|
48
|
-
elsif args[0] == "configure"
|
49
|
-
bootstrap_configs
|
50
|
-
elsif args[0] == "console"
|
51
|
-
Rbitter.config_initialize
|
52
|
-
|
53
|
-
con = Rbitter::Console.new
|
54
|
-
con.start
|
55
|
-
elsif args[0] == "logs"
|
56
|
-
# show log in stdout
|
57
|
-
puts "Log buffer feature is in heavy development. Sorry."
|
58
|
-
else
|
59
|
-
fail StandardError, "Invalid bootstrap parameter: #{args[0]}"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
|
4
|
+
require "rbitter/version"
|
5
|
+
require "rbitter/arcserver"
|
6
|
+
require "rbitter/env"
|
7
|
+
require "rbitter/console"
|
8
|
+
require "rbitter/xmlrpc"
|
9
|
+
require "rbitter/override"
|
10
|
+
|
11
|
+
module Rbitter
|
12
|
+
BOOTSTRAP_ARGS = ['configure', 'console', 'help', 'logs', 'serve']
|
13
|
+
|
14
|
+
def self.rbitter_header
|
15
|
+
puts "Rbitter #{VERSION} on #{RUBY_VERSION} (#{RUBY_PLATFORM})"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.rbitter_help_msg
|
19
|
+
puts "Rbitter is a Twitter streaming archiver, with XMLRPC access."
|
20
|
+
puts "-------"
|
21
|
+
puts "Usage: rbitter (application-mode)"
|
22
|
+
puts "application-mode's are:"
|
23
|
+
puts "|- serve : Launch Rbitter full system (Streaming + Database + XMLRPC)"
|
24
|
+
puts "|- console : Launch console application utilizing XMLRPC"
|
25
|
+
puts "|- configure: Write default configuration file 'config.json' in current folder"
|
26
|
+
puts "|- help : Show this message"
|
27
|
+
puts "`- logs : Show Rbitter internal logs"
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.bootstrap_configs
|
31
|
+
require "rbitter/default/config_json"
|
32
|
+
|
33
|
+
open(File.join(Dir.pwd, "config.json"), "w") { |io|
|
34
|
+
io.write(DEFAULT_CONFIG_JSON)
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.bootstrap args=[]
|
39
|
+
return nil if args.length < 1
|
40
|
+
|
41
|
+
if args[0] == "serve"
|
42
|
+
Rbitter.config_initialize
|
43
|
+
|
44
|
+
archive_server = Rbitter::ArcServer.new
|
45
|
+
archive_server.main_loop
|
46
|
+
elsif args[0] == "help"
|
47
|
+
rbitter_help_msg
|
48
|
+
elsif args[0] == "configure"
|
49
|
+
bootstrap_configs
|
50
|
+
elsif args[0] == "console"
|
51
|
+
Rbitter.config_initialize
|
52
|
+
|
53
|
+
con = Rbitter::Console.new
|
54
|
+
con.start
|
55
|
+
elsif args[0] == "logs"
|
56
|
+
# show log in stdout
|
57
|
+
puts "Log buffer feature is in heavy development. Sorry."
|
58
|
+
else
|
59
|
+
fail StandardError, "Invalid bootstrap parameter: #{args[0]}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/rbitter.gemspec
CHANGED
@@ -1,46 +1,46 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'rbitter/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = "rbitter"
|
9
|
-
spec.version = Rbitter::VERSION
|
10
|
-
spec.authors = ["Nidev Plontra"]
|
11
|
-
spec.email = ["nidev.plontra@gmail.com"]
|
12
|
-
spec.summary = %q{Rbitter is a Twitter client specialized in archiving}
|
13
|
-
spec.description = %q{Rbitter archives all tweets appeared on user streaming using ActiveRecord. XMLRPC is used to serve archived tweets and useful features}
|
14
|
-
spec.homepage = "https://github.com/nidev/rbitter"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0")
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
|
23
|
-
spec.add_dependency 'twitter', '~> 5.14'
|
24
|
-
spec.add_dependency 'json', '~> 1.7'
|
25
|
-
spec.add_dependency 'ripl', '~> 0.7'
|
26
|
-
spec.add_dependency 'activerecord', '~> 4.0'
|
27
|
-
|
28
|
-
if RUBY_PLATFORM == 'java'
|
29
|
-
spec.platform = 'java'
|
30
|
-
|
31
|
-
spec.add_dependency 'activerecord-jdbc-adapter', '~> 1.3'
|
32
|
-
spec.add_dependency 'jdbc-sqlite3', '~> 3.8'
|
33
|
-
spec.add_dependency 'jdbc-mysql', '~> 5.1'
|
34
|
-
spec.add_dependency 'activerecord-jdbcsqlite3-adapter', '~> 1.3'
|
35
|
-
spec.add_dependency 'activerecord-jdbcmysql-adapter', '~> 1.3'
|
36
|
-
else
|
37
|
-
spec.platform = 'ruby'
|
38
|
-
|
39
|
-
spec.add_dependency 'sqlite3', '~> 1.3'
|
40
|
-
spec.add_dependency 'mysql2', '~> 0.3'
|
41
|
-
spec.add_dependency 'activerecord-mysql2-adapter', '~> 0.0.3'
|
42
|
-
end
|
43
|
-
|
44
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
45
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
46
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'rbitter/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "rbitter"
|
9
|
+
spec.version = Rbitter::VERSION
|
10
|
+
spec.authors = ["Nidev Plontra"]
|
11
|
+
spec.email = ["nidev.plontra@gmail.com"]
|
12
|
+
spec.summary = %q{Rbitter is a Twitter client specialized in archiving}
|
13
|
+
spec.description = %q{Rbitter archives all tweets appeared on user streaming using ActiveRecord. XMLRPC is used to serve archived tweets and useful features}
|
14
|
+
spec.homepage = "https://github.com/nidev/rbitter"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
|
23
|
+
spec.add_dependency 'twitter', '~> 5.14'
|
24
|
+
spec.add_dependency 'json', '~> 1.7'
|
25
|
+
spec.add_dependency 'ripl', '~> 0.7'
|
26
|
+
spec.add_dependency 'activerecord', '~> 4.0'
|
27
|
+
|
28
|
+
if RUBY_PLATFORM == 'java'
|
29
|
+
spec.platform = 'java'
|
30
|
+
|
31
|
+
spec.add_dependency 'activerecord-jdbc-adapter', '~> 1.3'
|
32
|
+
spec.add_dependency 'jdbc-sqlite3', '~> 3.8'
|
33
|
+
spec.add_dependency 'jdbc-mysql', '~> 5.1'
|
34
|
+
spec.add_dependency 'activerecord-jdbcsqlite3-adapter', '~> 1.3'
|
35
|
+
spec.add_dependency 'activerecord-jdbcmysql-adapter', '~> 1.3'
|
36
|
+
else
|
37
|
+
spec.platform = 'ruby'
|
38
|
+
|
39
|
+
spec.add_dependency 'sqlite3', '~> 1.3'
|
40
|
+
spec.add_dependency 'mysql2', '~> 0.3'
|
41
|
+
spec.add_dependency 'activerecord-mysql2-adapter', '~> 0.0.3'
|
42
|
+
end
|
43
|
+
|
44
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
45
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
46
|
+
end
|
data/spec/config/default.json
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
{
|
2
|
-
"twitter": {
|
3
|
-
"consumer_key": "",
|
4
|
-
"consumer_secret": "",
|
5
|
-
"access_token": "",
|
6
|
-
"access_token_secret": ""
|
7
|
-
},
|
8
|
-
"activerecord": "sqlite3",
|
9
|
-
"sqlite3": {
|
10
|
-
"dbfile": "rbitter.sqlite"
|
11
|
-
},
|
12
|
-
"mysql2": {
|
13
|
-
"host": "localhost",
|
14
|
-
"port": 3306,
|
15
|
-
"dbname": "archive",
|
16
|
-
"username": "",
|
17
|
-
"password": ""
|
18
|
-
},
|
19
|
-
"media_downloader": {
|
20
|
-
"cacert_path": "/cacerts/cacert.pem",
|
21
|
-
"download_dir": "imgs/"
|
22
|
-
},
|
23
|
-
"xmlrpc": {
|
24
|
-
"enable": true,
|
25
|
-
"bind_host": "0.0.0.0",
|
26
|
-
"bind_port": 1400,
|
27
|
-
"auth": {
|
28
|
-
"username": "username",
|
29
|
-
"password": "password"
|
30
|
-
},
|
31
|
-
"handles": ["/path/to/handles"]
|
32
|
-
}
|
1
|
+
{
|
2
|
+
"twitter": {
|
3
|
+
"consumer_key": "",
|
4
|
+
"consumer_secret": "",
|
5
|
+
"access_token": "",
|
6
|
+
"access_token_secret": ""
|
7
|
+
},
|
8
|
+
"activerecord": "sqlite3",
|
9
|
+
"sqlite3": {
|
10
|
+
"dbfile": "rbitter.sqlite"
|
11
|
+
},
|
12
|
+
"mysql2": {
|
13
|
+
"host": "localhost",
|
14
|
+
"port": 3306,
|
15
|
+
"dbname": "archive",
|
16
|
+
"username": "",
|
17
|
+
"password": ""
|
18
|
+
},
|
19
|
+
"media_downloader": {
|
20
|
+
"cacert_path": "/cacerts/cacert.pem",
|
21
|
+
"download_dir": "imgs/"
|
22
|
+
},
|
23
|
+
"xmlrpc": {
|
24
|
+
"enable": true,
|
25
|
+
"bind_host": "0.0.0.0",
|
26
|
+
"bind_port": 1400,
|
27
|
+
"auth": {
|
28
|
+
"username": "username",
|
29
|
+
"password": "password"
|
30
|
+
},
|
31
|
+
"handles": ["/path/to/handles"]
|
32
|
+
}
|
33
33
|
}
|
@@ -1,30 +1,30 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rbitter/arcserver"
|
4
|
-
require "rbitter/streaming"
|
5
|
-
require "rbitter/xmlrpcd/xmlrpcd"
|
6
|
-
|
7
|
-
describe Rbitter::ArcServer do
|
8
|
-
it 'is presented' do
|
9
|
-
expect(Rbitter::ArcServer).to be_a(Class)
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'With dummy implementations, ' do
|
13
|
-
before(:all) do
|
14
|
-
Rbitter.bootstrap(['configure'])
|
15
|
-
expect(File.file?('config.json')).to be(true)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'successfully returns from main_loop' do
|
19
|
-
Rbitter.config_initialize
|
20
|
-
|
21
|
-
arcserver = Rbitter::ArcServer.new(Rbitter::DummyRPCServer)
|
22
|
-
arcserver.main_loop(Rbitter::DummyStreamClient)
|
23
|
-
end
|
24
|
-
|
25
|
-
after(:all) do
|
26
|
-
File.delete('config.json') if File.exist?('config.json')
|
27
|
-
File.delete('rbitter.sqlite') if File.exist?('rbitter.sqlite')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "rbitter/arcserver"
|
4
|
+
require "rbitter/streaming"
|
5
|
+
require "rbitter/xmlrpcd/xmlrpcd"
|
6
|
+
|
7
|
+
describe Rbitter::ArcServer do
|
8
|
+
it 'is presented' do
|
9
|
+
expect(Rbitter::ArcServer).to be_a(Class)
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'With dummy implementations, ' do
|
13
|
+
before(:all) do
|
14
|
+
Rbitter.bootstrap(['configure'])
|
15
|
+
expect(File.file?('config.json')).to be(true)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'successfully returns from main_loop' do
|
19
|
+
Rbitter.config_initialize
|
20
|
+
|
21
|
+
arcserver = Rbitter::ArcServer.new(Rbitter::DummyRPCServer)
|
22
|
+
arcserver.main_loop(Rbitter::DummyStreamClient)
|
23
|
+
end
|
24
|
+
|
25
|
+
after(:all) do
|
26
|
+
File.delete('config.json') if File.exist?('config.json')
|
27
|
+
File.delete('rbitter.sqlite') if File.exist?('rbitter.sqlite')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "rbitter/console"
|
3
|
-
|
4
|
-
describe Rbitter::Console do
|
5
|
-
# TODO: Perform test...
|
6
|
-
it 'is presented' do
|
7
|
-
expect(Rbitter::Console).to be_a(Class)
|
8
|
-
end
|
9
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require "rbitter/console"
|
3
|
+
|
4
|
+
describe Rbitter::Console do
|
5
|
+
# TODO: Perform test...
|
6
|
+
it 'is presented' do
|
7
|
+
expect(Rbitter::Console).to be_a(Class)
|
8
|
+
end
|
9
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rbitter/default/config_json"
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "rbitter/default/config_json"
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "rbitter/dlthread"
|
3
|
-
|
4
|
-
describe Rbitter::DLThread do
|
5
|
-
it 'is presented' do
|
6
|
-
expect(Rbitter::DLThread).to be_a(Class)
|
7
|
-
end
|
8
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require "rbitter/dlthread"
|
3
|
+
|
4
|
+
describe Rbitter::DLThread do
|
5
|
+
it 'is presented' do
|
6
|
+
expect(Rbitter::DLThread).to be_a(Class)
|
7
|
+
end
|
8
|
+
end
|
data/spec/rbitter/env_spec.rb
CHANGED
@@ -1,76 +1,76 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rbitter"
|
4
|
-
|
5
|
-
describe Rbitter do
|
6
|
-
it 'has env_reset function and clears Rbitter.env,' do
|
7
|
-
Rbitter.env_reset
|
8
|
-
expect(Rbitter.env).to be_a(Hash)
|
9
|
-
expect(Rbitter.env.length).to be(0)
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'when config.json is not installed,' do
|
13
|
-
it 'fails on loading' do
|
14
|
-
expect{Rbitter.config_initialize}.to raise_error(Rbitter::ConfigFileError)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'when path to config.json is invalid,' do
|
19
|
-
it 'fals on loading' do
|
20
|
-
expect{Rbitter.config_initialize("/silly/dummy/.")}.to raise_error(Rbitter::ConfigFileError)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
context 'when default config.json is installed,' do
|
26
|
-
before(:all) do
|
27
|
-
Rbitter.bootstrap(['configure'])
|
28
|
-
expect(File.file?('config.json')).to be(true)
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'loads configuration successfully with autodetection' do
|
32
|
-
expect{Rbitter.config_initialize}.to_not raise_error
|
33
|
-
expect(Rbitter.env.length > 0).to be(true)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'loads configuration successfully with given config.json path' do
|
37
|
-
expect{Rbitter.config_initialize('config.json')}.to_not raise_error
|
38
|
-
expect(Rbitter.env.length > 0).to be(true)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'checks that Rbitter.env returns Hash' do
|
42
|
-
expect{Rbitter.config_initialize}.to_not raise_error
|
43
|
-
expect(Rbitter.env).to be_a(Hash)
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'checks that Rbitter[] works' do
|
47
|
-
expect{Rbitter.config_initialize}.to_not raise_error
|
48
|
-
expect(Rbitter["twitter"]).to be_a(Hash)
|
49
|
-
end
|
50
|
-
|
51
|
-
after(:all) do
|
52
|
-
File.delete('config.json')
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context "when 'env_valid?' validates loaded configuration" do
|
57
|
-
before(:all) do
|
58
|
-
Rbitter.bootstrap(['configure'])
|
59
|
-
expect(File.file?('config.json')).to be(true)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'gets \'false\' for empty configuration' do
|
63
|
-
Rbitter.env_reset
|
64
|
-
expect(Rbitter.env_valid?).to be(false)
|
65
|
-
end
|
66
|
-
|
67
|
-
it "gets \'true\' with default and another default" do
|
68
|
-
Rbitter.config_initialize
|
69
|
-
expect(Rbitter.env_valid?).to be(true)
|
70
|
-
end
|
71
|
-
|
72
|
-
after(:all) do
|
73
|
-
File.delete('config.json')
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "rbitter"
|
4
|
+
|
5
|
+
describe Rbitter do
|
6
|
+
it 'has env_reset function and clears Rbitter.env,' do
|
7
|
+
Rbitter.env_reset
|
8
|
+
expect(Rbitter.env).to be_a(Hash)
|
9
|
+
expect(Rbitter.env.length).to be(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'when config.json is not installed,' do
|
13
|
+
it 'fails on loading' do
|
14
|
+
expect{Rbitter.config_initialize}.to raise_error(Rbitter::ConfigFileError)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when path to config.json is invalid,' do
|
19
|
+
it 'fals on loading' do
|
20
|
+
expect{Rbitter.config_initialize("/silly/dummy/.")}.to raise_error(Rbitter::ConfigFileError)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
context 'when default config.json is installed,' do
|
26
|
+
before(:all) do
|
27
|
+
Rbitter.bootstrap(['configure'])
|
28
|
+
expect(File.file?('config.json')).to be(true)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'loads configuration successfully with autodetection' do
|
32
|
+
expect{Rbitter.config_initialize}.to_not raise_error
|
33
|
+
expect(Rbitter.env.length > 0).to be(true)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'loads configuration successfully with given config.json path' do
|
37
|
+
expect{Rbitter.config_initialize('config.json')}.to_not raise_error
|
38
|
+
expect(Rbitter.env.length > 0).to be(true)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'checks that Rbitter.env returns Hash' do
|
42
|
+
expect{Rbitter.config_initialize}.to_not raise_error
|
43
|
+
expect(Rbitter.env).to be_a(Hash)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'checks that Rbitter[] works' do
|
47
|
+
expect{Rbitter.config_initialize}.to_not raise_error
|
48
|
+
expect(Rbitter["twitter"]).to be_a(Hash)
|
49
|
+
end
|
50
|
+
|
51
|
+
after(:all) do
|
52
|
+
File.delete('config.json')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when 'env_valid?' validates loaded configuration" do
|
57
|
+
before(:all) do
|
58
|
+
Rbitter.bootstrap(['configure'])
|
59
|
+
expect(File.file?('config.json')).to be(true)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'gets \'false\' for empty configuration' do
|
63
|
+
Rbitter.env_reset
|
64
|
+
expect(Rbitter.env_valid?).to be(false)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "gets \'true\' with default and another default" do
|
68
|
+
Rbitter.config_initialize
|
69
|
+
expect(Rbitter.env_valid?).to be(true)
|
70
|
+
end
|
71
|
+
|
72
|
+
after(:all) do
|
73
|
+
File.delete('config.json')
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "rbitter/override/gems/twitter/connection"
|
3
|
-
|
4
|
-
describe Rbitter do
|
5
|
-
it 'overrides twitter gem' do
|
6
|
-
expect(Twitter::Streaming::Connection::MODIFIED).to be(true)
|
7
|
-
end
|
8
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require "rbitter/override/gems/twitter/connection"
|
3
|
+
|
4
|
+
describe Rbitter do
|
5
|
+
it 'overrides twitter gem' do
|
6
|
+
expect(Twitter::Streaming::Connection::MODIFIED).to be(true)
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# encoding: utf-8
|
@@ -1,13 +1,13 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "rbitter/records"
|
3
|
-
|
4
|
-
describe Rbitter::Record do
|
5
|
-
# TODO: Perform test...
|
6
|
-
it 'has ActiveRecord class named Record' do
|
7
|
-
expect(Rbitter::Record).to be_a(Class)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'has supportive module of ActiveRecord' do
|
11
|
-
expect(ARSupport).to be_a(Module)
|
12
|
-
end
|
13
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require "rbitter/records"
|
3
|
+
|
4
|
+
describe Rbitter::Record do
|
5
|
+
# TODO: Perform test...
|
6
|
+
it 'has ActiveRecord class named Record' do
|
7
|
+
expect(Rbitter::Record).to be_a(Class)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'has supportive module of ActiveRecord' do
|
11
|
+
expect(ARSupport).to be_a(Module)
|
12
|
+
end
|
13
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "rbitter/streaming"
|
3
|
-
|
4
|
-
describe Rbitter::StreamClient do
|
5
|
-
# TODO: Perform test...
|
6
|
-
it 'is presented' do
|
7
|
-
expect(Rbitter::StreamClient).to be_a(Class)
|
8
|
-
end
|
9
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require "rbitter/streaming"
|
3
|
+
|
4
|
+
describe Rbitter::StreamClient do
|
5
|
+
# TODO: Perform test...
|
6
|
+
it 'is presented' do
|
7
|
+
expect(Rbitter::StreamClient).to be_a(Class)
|
8
|
+
end
|
9
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "rbitter/version"
|
3
|
-
|
4
|
-
describe Rbitter do
|
5
|
-
it 'has version string' do
|
6
|
-
expect(Rbitter::VERSION).to be_a(String)
|
7
|
-
end
|
8
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require "rbitter/version"
|
3
|
+
|
4
|
+
describe Rbitter do
|
5
|
+
it 'has version string' do
|
6
|
+
expect(Rbitter::VERSION).to be_a(String)
|
7
|
+
end
|
8
|
+
end
|
data/spec/rbitter/xmlrpc_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "rbitter/xmlrpc"
|
3
|
-
|
4
|
-
describe Rbitter do
|
5
|
-
it 'Rbitter is a module' do
|
6
|
-
expect(Rbitter.class === Module).to be(true)
|
7
|
-
end
|
8
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require "rbitter/xmlrpc"
|
3
|
+
|
4
|
+
describe Rbitter do
|
5
|
+
it 'Rbitter is a module' do
|
6
|
+
expect(Rbitter.class === Module).to be(true)
|
7
|
+
end
|
8
|
+
end
|