omg_pull_request 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -3
- data/bin/omg_pull_request +4 -2
- data/lib/omg_pull_request.rb +1 -8
- data/lib/omg_pull_request/configuration.rb +4 -4
- data/lib/omg_pull_request/notifications.rb +1 -1
- data/lib/omg_pull_request/test_runner.rb +20 -3
- data/lib/omg_pull_request/test_runner/base.rb +7 -7
- data/lib/omg_pull_request/version.rb +1 -1
- data/test/integrations/runner_test.rb +13 -3
- data/test/test_helper.rb +10 -0
- data/test/units/omg_pull_request/github_wrapper_test.rb +1 -1
- data/test/units/omg_pull_request/lolcommits_test.rb +1 -1
- data/test/units/omg_pull_request/notifications_test.rb +4 -0
- data/test/units/omg_pull_request/prowl_test.rb +2 -2
- data/test/units/omg_pull_request/storage/gist_test.rb +2 -2
- metadata +16 -16
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omg_pull_request (0.1
|
4
|
+
omg_pull_request (0.2.1)
|
5
5
|
activesupport (>= 3.2.6)
|
6
6
|
aws-s3 (>= 0.6.3)
|
7
7
|
faraday (>= 0.8.4)
|
@@ -32,7 +32,7 @@ GEM
|
|
32
32
|
oauth2
|
33
33
|
hashie (1.2.0)
|
34
34
|
httpauth (0.1)
|
35
|
-
i18n (0.6.
|
35
|
+
i18n (0.6.1)
|
36
36
|
jwt (0.1.5)
|
37
37
|
multi_json (>= 1.0)
|
38
38
|
macaddr (1.6.1)
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
metaclass (0.0.1)
|
41
41
|
mime-types (1.19)
|
42
42
|
minitest (3.3.0)
|
43
|
-
mocha (0.
|
43
|
+
mocha (0.12.3)
|
44
44
|
metaclass (~> 0.0.1)
|
45
45
|
multi_json (1.3.6)
|
46
46
|
multipart-post (1.1.5)
|
data/bin/omg_pull_request
CHANGED
@@ -3,11 +3,13 @@
|
|
3
3
|
require 'omg_pull_request'
|
4
4
|
|
5
5
|
include OmgPullRequest
|
6
|
+
|
6
7
|
locale_dir = File.expand_path("../../locales", __FILE__)
|
8
|
+
configuration = Configuration.new
|
7
9
|
I18n.load_path = [
|
8
10
|
File.join(locale_dir, "omg.yml"),
|
9
11
|
File.join(locale_dir, "en.yml")
|
10
12
|
]
|
11
|
-
I18n.locale =
|
13
|
+
I18n.locale = configuration.locale if configuration.locale
|
12
14
|
|
13
|
-
TestRunner.start_daemon
|
15
|
+
TestRunner.start_daemon(configuration)
|
data/lib/omg_pull_request.rb
CHANGED
@@ -25,12 +25,5 @@ require 'omg_pull_request/lolcommits'
|
|
25
25
|
require 'omg_pull_request/version'
|
26
26
|
|
27
27
|
module OmgPullRequest
|
28
|
-
|
29
|
-
CONTEXT = Context.new
|
30
|
-
GITHUB_WRAPPER = GithubWrapper.new(:configuration => CONFIGURATION)
|
31
|
-
|
32
|
-
STORE = CONFIGURATION.storage_class.new(:configuration => CONFIGURATION,
|
33
|
-
:github_wrapper => GITHUB_WRAPPER)
|
28
|
+
CONTEXT = Context.new
|
34
29
|
end
|
35
|
-
|
36
|
-
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module OmgPullRequest
|
2
2
|
class Configuration
|
3
|
-
attr_accessor
|
3
|
+
attr_accessor :config, :local_repo
|
4
4
|
|
5
5
|
def initialize(attributes={})
|
6
6
|
attributes.each do |attr, value|
|
7
7
|
self.send("#{attr}=", value)
|
8
8
|
end
|
9
9
|
|
10
|
-
if File.exists?(self.config_file)
|
10
|
+
if config.blank? && File.exists?(self.config_file)
|
11
11
|
@config = YAML.load(File.open(self.config_file))
|
12
12
|
end
|
13
13
|
end
|
@@ -21,7 +21,7 @@ module OmgPullRequest
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def local_repo
|
24
|
-
self.config['local_repo'] || Dir.pwd
|
24
|
+
@local_repo ||= ((self.config || Hash.new)['local_repo'] || Dir.pwd)
|
25
25
|
end
|
26
26
|
|
27
27
|
def database_yml
|
@@ -38,7 +38,7 @@ module OmgPullRequest
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def omg_dir
|
41
|
-
File.join(
|
41
|
+
File.join(local_repo, 'test/omg_pull_request')
|
42
42
|
end
|
43
43
|
|
44
44
|
def runner_class
|
@@ -1,10 +1,25 @@
|
|
1
1
|
module OmgPullRequest
|
2
2
|
module TestRunner
|
3
|
-
|
3
|
+
|
4
|
+
def self.start_daemon(configuration=Configuration.new, daemonize=true)
|
5
|
+
github_wrapper = GithubWrapper.new(
|
6
|
+
:configuration => configuration
|
7
|
+
)
|
8
|
+
|
9
|
+
store = configuration.storage_class.new(
|
10
|
+
:configuration => configuration,
|
11
|
+
:github_wrapper => github_wrapper
|
12
|
+
)
|
13
|
+
|
4
14
|
while(true)
|
5
15
|
begin
|
6
|
-
|
7
|
-
runner =
|
16
|
+
github_wrapper.pull_requests.each do |pr|
|
17
|
+
runner = configuration.runner_class.new(
|
18
|
+
:configuration => configuration,
|
19
|
+
:pull_request => pr,
|
20
|
+
:github_wrapper => github_wrapper,
|
21
|
+
:store => store
|
22
|
+
)
|
8
23
|
next if CONTEXT.ran?(runner.request_sha)
|
9
24
|
CONTEXT.ran(runner.request_sha)
|
10
25
|
|
@@ -15,8 +30,10 @@ module OmgPullRequest
|
|
15
30
|
puts "An Error Occured: #{ex.inspect}\n#{ex.backtrace}"
|
16
31
|
end
|
17
32
|
|
33
|
+
return if daemonize == false
|
18
34
|
sleep(60)
|
19
35
|
end
|
20
36
|
end
|
37
|
+
|
21
38
|
end
|
22
39
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module OmgPullRequest
|
2
2
|
module TestRunner
|
3
3
|
class Base
|
4
|
-
attr_accessor :success, :runtime, :pull_request, :configuration
|
4
|
+
attr_accessor :success, :runtime, :pull_request, :configuration, :github_wrapper, :store
|
5
5
|
include Notifications
|
6
6
|
|
7
7
|
def initialize(attributes={})
|
@@ -27,7 +27,7 @@ module OmgPullRequest
|
|
27
27
|
return
|
28
28
|
end
|
29
29
|
|
30
|
-
Bundler.
|
30
|
+
Bundler.with_clean_env do
|
31
31
|
setup
|
32
32
|
|
33
33
|
t = Time.now
|
@@ -77,23 +77,23 @@ module OmgPullRequest
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def logger
|
80
|
-
@logger ||= TestLogger.new(:store =>
|
80
|
+
@logger ||= TestLogger.new(:store => self.store)
|
81
81
|
end
|
82
82
|
|
83
83
|
def prowl_client
|
84
|
-
@prowl_client ||= Prowl.new(:configuration =>
|
84
|
+
@prowl_client ||= Prowl.new(:configuration => self.configuration, :logger => logger, :runner => self, :github_wrapper => self.github_wrapper)
|
85
85
|
end
|
86
86
|
|
87
87
|
def lolcommits_client
|
88
|
-
@lolcommits ||= Lolcommits.new(:configuration =>
|
88
|
+
@lolcommits ||= Lolcommits.new(:configuration => self.configuration, :github_wrapper => self.github_wrapper, :runner => self, :context => CONTEXT)
|
89
89
|
end
|
90
90
|
|
91
91
|
def git_client
|
92
|
-
@git_client ||= GitClient.new(:logger => logger, :configuration =>
|
92
|
+
@git_client ||= GitClient.new(:logger => logger, :configuration => self.configuration)
|
93
93
|
end
|
94
94
|
|
95
95
|
def notifier
|
96
|
-
@notifier ||= Notifier.new(:runner => self, :github_wrapper =>
|
96
|
+
@notifier ||= Notifier.new(:runner => self, :github_wrapper => self.configuration)
|
97
97
|
end
|
98
98
|
|
99
99
|
def log(message)
|
@@ -130,11 +130,21 @@ class RunnerTest < MiniTest::Unit::TestCase
|
|
130
130
|
}
|
131
131
|
}
|
132
132
|
}
|
133
|
+
config = OmgPullRequest::Configuration.new(:config => configuration)
|
134
|
+
|
135
|
+
github_wrapper = OmgPullRequest::GithubWrapper.new(
|
136
|
+
:configuration => config
|
137
|
+
)
|
138
|
+
store = config.storage_class.new(
|
139
|
+
:configuration => config,
|
140
|
+
:github_wrapper => github_wrapper
|
141
|
+
)
|
133
142
|
|
134
|
-
OmgPullRequest::CONFIGURATION.config = configuration
|
135
143
|
OmgPullRequest::TestRunner::Rails.new(
|
136
|
-
:
|
137
|
-
:
|
144
|
+
:github_wrapper => github_wrapper,
|
145
|
+
:configuration => config,
|
146
|
+
:pull_request => pull_request,
|
147
|
+
:store => store
|
138
148
|
)
|
139
149
|
end
|
140
150
|
|
data/test/test_helper.rb
CHANGED
@@ -21,6 +21,16 @@ end
|
|
21
21
|
|
22
22
|
FakeWeb.allow_net_connect = false
|
23
23
|
|
24
|
+
MOCK_CONFIGURATION = OmgPullRequest::Configuration.new
|
25
|
+
MOCK_GITHUB_WRAPPER = OmgPullRequest::GithubWrapper.new(
|
26
|
+
:configuration => MOCK_CONFIGURATION
|
27
|
+
)
|
28
|
+
|
29
|
+
MOCK_STORE = MOCK_CONFIGURATION.storage_class.new(
|
30
|
+
:configuration => MOCK_CONFIGURATION,
|
31
|
+
:github_wrapper => MOCK_GITHUB_WRAPPER
|
32
|
+
)
|
33
|
+
|
24
34
|
def fakeweb_get_pull_request_commits
|
25
35
|
FakeWeb.register_uri(:get,
|
26
36
|
"https://omg:pull_request@api.github.com/repos/kenmazaika/pictures/pulls/10/commits",
|
@@ -35,7 +35,7 @@ module OmgPullRequest
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def lolcommits_client
|
38
|
-
@lolcommits_client ||= Lolcommits.new(:context => CONTEXT, :github_wrapper =>
|
38
|
+
@lolcommits_client ||= Lolcommits.new(:context => CONTEXT, :github_wrapper => MOCK_GITHUB_WRAPPER,
|
39
39
|
:runner => TestRunner::Base.new(:pull_request => MockPullRequest.new))
|
40
40
|
end
|
41
41
|
end
|
@@ -43,9 +43,9 @@ module OmgPullRequest
|
|
43
43
|
def prowl_client
|
44
44
|
runner = TestRunner::Base.new(:pull_request => MockPullRequest.new)
|
45
45
|
runner.expects(:git_client).returns(MockGitClient.new).at_least(0)
|
46
|
-
@prowl_client ||= OmgPullRequest::Prowl.new(:configuration =>
|
46
|
+
@prowl_client ||= OmgPullRequest::Prowl.new(:configuration => MOCK_CONFIGURATION,
|
47
47
|
:runner => runner,
|
48
|
-
:github_wrapper =>
|
48
|
+
:github_wrapper => MOCK_GITHUB_WRAPPER)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omg_pull_request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,11 +12,11 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-
|
15
|
+
date: 2012-09-09 00:00:00.000000000Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: aws-s3
|
19
|
-
requirement: &
|
19
|
+
requirement: &70109182790380 !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
22
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: 0.6.3
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70109182790380
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: faraday
|
30
|
-
requirement: &
|
30
|
+
requirement: &70109182789880 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: 0.8.4
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *70109182789880
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: github_api
|
41
|
-
requirement: &
|
41
|
+
requirement: &70109182789420 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ! '>='
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
version: 0.6.5
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
|
-
version_requirements: *
|
49
|
+
version_requirements: *70109182789420
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: uuid
|
52
|
-
requirement: &
|
52
|
+
requirement: &70109182788960 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ! '>='
|
@@ -57,10 +57,10 @@ dependencies:
|
|
57
57
|
version: 2.3.5
|
58
58
|
type: :runtime
|
59
59
|
prerelease: false
|
60
|
-
version_requirements: *
|
60
|
+
version_requirements: *70109182788960
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
|
-
requirement: &
|
63
|
+
requirement: &70109182788500 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ! '>='
|
@@ -68,10 +68,10 @@ dependencies:
|
|
68
68
|
version: 0.9.2.2
|
69
69
|
type: :runtime
|
70
70
|
prerelease: false
|
71
|
-
version_requirements: *
|
71
|
+
version_requirements: *70109182788500
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: activesupport
|
74
|
-
requirement: &
|
74
|
+
requirement: &70109182788040 !ruby/object:Gem::Requirement
|
75
75
|
none: false
|
76
76
|
requirements:
|
77
77
|
- - ! '>='
|
@@ -79,10 +79,10 @@ dependencies:
|
|
79
79
|
version: 3.2.6
|
80
80
|
type: :runtime
|
81
81
|
prerelease: false
|
82
|
-
version_requirements: *
|
82
|
+
version_requirements: *70109182788040
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: i18n
|
85
|
-
requirement: &
|
85
|
+
requirement: &70109182787580 !ruby/object:Gem::Requirement
|
86
86
|
none: false
|
87
87
|
requirements:
|
88
88
|
- - ! '>='
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
version: 0.6.0
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
|
-
version_requirements: *
|
93
|
+
version_requirements: *70109182787580
|
94
94
|
description: Have tests run automatically for your Github Pull Request
|
95
95
|
email:
|
96
96
|
- kenmazaika@gmail.com
|