txgh 5.3.4 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/txgh/resource_deleter.rb +50 -0
  3. data/lib/txgh/version.rb +1 -1
  4. data/lib/txgh.rb +1 -6
  5. data/spec/resource_deleter_spec.rb +48 -0
  6. data/spec/spec_helper.rb +0 -8
  7. data/txgh.gemspec +1 -5
  8. metadata +6 -113
  9. data/lib/ext/zipline/output_stream.rb +0 -62
  10. data/lib/txgh/app.rb +0 -140
  11. data/lib/txgh/github_request_auth.rb +0 -28
  12. data/lib/txgh/handlers/download_handler.rb +0 -87
  13. data/lib/txgh/handlers/github/delete_handler.rb +0 -65
  14. data/lib/txgh/handlers/github/handler.rb +0 -20
  15. data/lib/txgh/handlers/github/ping_handler.rb +0 -18
  16. data/lib/txgh/handlers/github/push_handler.rb +0 -124
  17. data/lib/txgh/handlers/github/request_handler.rb +0 -113
  18. data/lib/txgh/handlers/github.rb +0 -11
  19. data/lib/txgh/handlers/response.rb +0 -17
  20. data/lib/txgh/handlers/stream_response.rb +0 -39
  21. data/lib/txgh/handlers/tgz_stream_response.rb +0 -41
  22. data/lib/txgh/handlers/transifex/hook_handler.rb +0 -94
  23. data/lib/txgh/handlers/transifex/request_handler.rb +0 -78
  24. data/lib/txgh/handlers/transifex.rb +0 -8
  25. data/lib/txgh/handlers/triggers/handler.rb +0 -52
  26. data/lib/txgh/handlers/triggers/pull_handler.rb +0 -20
  27. data/lib/txgh/handlers/triggers/push_handler.rb +0 -20
  28. data/lib/txgh/handlers/triggers.rb +0 -9
  29. data/lib/txgh/handlers/zip_stream_response.rb +0 -21
  30. data/lib/txgh/handlers.rb +0 -12
  31. data/lib/txgh/transifex_request_auth.rb +0 -53
  32. data/spec/app_spec.rb +0 -347
  33. data/spec/github_request_auth_spec.rb +0 -39
  34. data/spec/handlers/download_handler_spec.rb +0 -91
  35. data/spec/handlers/github/delete_handler_spec.rb +0 -71
  36. data/spec/handlers/github/ping_handler_spec.rb +0 -16
  37. data/spec/handlers/github/push_handler_spec.rb +0 -106
  38. data/spec/handlers/tgz_stream_response_spec.rb +0 -59
  39. data/spec/handlers/transifex/hook_handler_spec.rb +0 -136
  40. data/spec/handlers/zip_stream_response_spec.rb +0 -58
  41. data/spec/helpers/github_payload_builder.rb +0 -141
  42. data/spec/helpers/integration_setup.rb +0 -47
  43. data/spec/integration/cassettes/github_l10n_hook_endpoint.yml +0 -536
  44. data/spec/integration/cassettes/pull.yml +0 -47
  45. data/spec/integration/cassettes/push.yml +0 -544
  46. data/spec/integration/cassettes/transifex_hook_endpoint.yml +0 -221
  47. data/spec/integration/config/tx.config +0 -10
  48. data/spec/integration/hooks_spec.rb +0 -159
  49. data/spec/integration/payloads/github_postbody.json +0 -161
  50. data/spec/integration/payloads/github_postbody_l10n.json +0 -136
  51. data/spec/integration/payloads/github_postbody_release.json +0 -136
  52. data/spec/integration/triggers_spec.rb +0 -45
  53. data/spec/transifex_request_auth_spec.rb +0 -39
@@ -1,136 +0,0 @@
1
- {
2
- "ref": "refs/tags/L10N",
3
- "before": "0000000000000000000000000000000000000000",
4
- "after": "6eebc3eee49e8d46f6dbec16fe3360961bfdd8ed",
5
- "created": true,
6
- "deleted": false,
7
- "forced": true,
8
- "base_ref": "refs/heads/master",
9
- "compare": "https://github.com/txgh-bot/txgh-test-resources/compare/L10N",
10
- "commits": [
11
-
12
- ],
13
- "head_commit": {
14
- "id": "6eebc3eee49e8d46f6dbec16fe3360961bfdd8ed",
15
- "distinct": true,
16
- "message": "10",
17
- "timestamp": "2015-11-19T12:56:33-08:00",
18
- "url": "https://github.com/txgh-bot/txgh-test-resources/commit/6eebc3eee49e8d46f6dbec16fe3360961bfdd8ed",
19
- "author": {
20
- "name": "Txgh Bot",
21
- "email": "txgh.bot@gmail.com",
22
- "username": "txgh-bot"
23
- },
24
- "committer": {
25
- "name": "Txgh Bot",
26
- "email": "txgh.bot@gmail.com",
27
- "username": "txgh-bot"
28
- },
29
- "added": [
30
-
31
- ],
32
- "removed": [
33
-
34
- ],
35
- "modified": [
36
- "sample.po"
37
- ]
38
- },
39
- "repository": {
40
- "id": 41740726,
41
- "name": "txgh-test-resources",
42
- "full_name": "txgh-bot/txgh-test-resources",
43
- "owner": {
44
- "name": "txgh-bot",
45
- "email": "txgh.bot@gmail.com"
46
- },
47
- "private": false,
48
- "html_url": "https://github.com/txgh-bot/txgh-test-resources",
49
- "description": "Translation test repo for txgh",
50
- "fork": false,
51
- "url": "https://github.com/txgh-bot/txgh-test-resources",
52
- "forks_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/forks",
53
- "keys_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/keys{/key_id}",
54
- "collaborators_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/collaborators{/collaborator}",
55
- "teams_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/teams",
56
- "hooks_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/hooks",
57
- "issue_events_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/issues/events{/number}",
58
- "events_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/events",
59
- "assignees_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/assignees{/user}",
60
- "branches_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/branches{/branch}",
61
- "tags_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/tags",
62
- "blobs_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/blobs{/sha}",
63
- "git_tags_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/tags{/sha}",
64
- "git_refs_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/refs{/sha}",
65
- "trees_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/trees{/sha}",
66
- "statuses_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/statuses/{sha}",
67
- "languages_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/languages",
68
- "stargazers_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/stargazers",
69
- "contributors_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/contributors",
70
- "subscribers_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/subscribers",
71
- "subscription_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/subscription",
72
- "commits_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/commits{/sha}",
73
- "git_commits_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/commits{/sha}",
74
- "comments_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/comments{/number}",
75
- "issue_comment_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/issues/comments{/number}",
76
- "contents_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/contents/{+path}",
77
- "compare_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/compare/{base}...{head}",
78
- "merges_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/merges",
79
- "archive_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/{archive_format}{/ref}",
80
- "downloads_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/downloads",
81
- "issues_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/issues{/number}",
82
- "pulls_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/pulls{/number}",
83
- "milestones_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/milestones{/number}",
84
- "notifications_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/notifications{?since,all,participating}",
85
- "labels_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/labels{/name}",
86
- "releases_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/releases{/id}",
87
- "created_at": 1441114620,
88
- "updated_at": "2015-09-01T13:37:00Z",
89
- "pushed_at": 1447966674,
90
- "git_url": "git://github.com/txgh-bot/txgh-test-resources.git",
91
- "ssh_url": "git@github.com:txgh-bot/txgh-test-resources.git",
92
- "clone_url": "https://github.com/txgh-bot/txgh-test-resources.git",
93
- "svn_url": "https://github.com/txgh-bot/txgh-test-resources",
94
- "homepage": null,
95
- "size": 12,
96
- "stargazers_count": 0,
97
- "watchers_count": 0,
98
- "language": null,
99
- "has_issues": true,
100
- "has_downloads": true,
101
- "has_wiki": true,
102
- "has_pages": false,
103
- "forks_count": 0,
104
- "mirror_url": null,
105
- "open_issues_count": 0,
106
- "forks": 0,
107
- "open_issues": 0,
108
- "watchers": 0,
109
- "default_branch": "master",
110
- "stargazers": 0,
111
- "master_branch": "master"
112
- },
113
- "pusher": {
114
- "name": "txgh-bot",
115
- "email": "txgh.bot@gmail.com"
116
- },
117
- "sender": {
118
- "login": "txgh-bot",
119
- "id": 974299,
120
- "avatar_url": "https://avatars.githubusercontent.com/u/974299?v=3",
121
- "gravatar_id": "",
122
- "url": "https://api.github.com/users/txgh-bot",
123
- "html_url": "https://github.com/txgh-bot",
124
- "followers_url": "https://api.github.com/users/txgh-bot/followers",
125
- "following_url": "https://api.github.com/users/txgh-bot/following{/other_user}",
126
- "gists_url": "https://api.github.com/users/txgh-bot/gists{/gist_id}",
127
- "starred_url": "https://api.github.com/users/txgh-bot/starred{/owner}{/repo}",
128
- "subscriptions_url": "https://api.github.com/users/txgh-bot/subscriptions",
129
- "organizations_url": "https://api.github.com/users/txgh-bot/orgs",
130
- "repos_url": "https://api.github.com/users/txgh-bot/repos",
131
- "events_url": "https://api.github.com/users/txgh-bot/events{/privacy}",
132
- "received_events_url": "https://api.github.com/users/txgh-bot/received_events",
133
- "type": "User",
134
- "site_admin": false
135
- }
136
- }
@@ -1,136 +0,0 @@
1
- {
2
- "ref": "refs/tags/v3.0.0",
3
- "before": "0000000000000000000000000000000000000000",
4
- "after": "a779a46381d0d10c8e9dc390da0eaf567465cb39",
5
- "created": true,
6
- "deleted": false,
7
- "forced": true,
8
- "base_ref": "refs/heads/master",
9
- "compare": "https://github.com/txgh-bot/txgh-test-resources/compare/v3.0.0",
10
- "commits": [
11
-
12
- ],
13
- "head_commit": {
14
- "id": "a779a46381d0d10c8e9dc390da0eaf567465cb39",
15
- "distinct": true,
16
- "message": "11",
17
- "timestamp": "2015-11-18T16:18:35-08:00",
18
- "url": "https://github.com/txgh-bot/txgh-test-resources/commit/a779a46381d0d10c8e9dc390da0eaf567465cb39",
19
- "author": {
20
- "name": "Txgh Bot",
21
- "email": "txgh.bot@gmail.com",
22
- "username": "txgh-bot"
23
- },
24
- "committer": {
25
- "name": "Txgh Bot",
26
- "email": "txgh.bot@gmail.com",
27
- "username": "txgh-bot"
28
- },
29
- "added": [
30
-
31
- ],
32
- "removed": [
33
-
34
- ],
35
- "modified": [
36
- "sample.po"
37
- ]
38
- },
39
- "repository": {
40
- "id": 41740726,
41
- "name": "txgh-test-resources",
42
- "full_name": "txgh-bot/txgh-test-resources",
43
- "owner": {
44
- "name": "txgh-bot",
45
- "email": "txgh.bot@gmail.com"
46
- },
47
- "private": false,
48
- "html_url": "https://github.com/txgh-bot/txgh-test-resources",
49
- "description": "Translation test repo for txgh",
50
- "fork": false,
51
- "url": "https://github.com/txgh-bot/txgh-test-resources",
52
- "forks_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/forks",
53
- "keys_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/keys{/key_id}",
54
- "collaborators_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/collaborators{/collaborator}",
55
- "teams_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/teams",
56
- "hooks_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/hooks",
57
- "issue_events_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/issues/events{/number}",
58
- "events_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/events",
59
- "assignees_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/assignees{/user}",
60
- "branches_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/branches{/branch}",
61
- "tags_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/tags",
62
- "blobs_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/blobs{/sha}",
63
- "git_tags_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/tags{/sha}",
64
- "git_refs_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/refs{/sha}",
65
- "trees_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/trees{/sha}",
66
- "statuses_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/statuses/{sha}",
67
- "languages_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/languages",
68
- "stargazers_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/stargazers",
69
- "contributors_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/contributors",
70
- "subscribers_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/subscribers",
71
- "subscription_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/subscription",
72
- "commits_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/commits{/sha}",
73
- "git_commits_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/git/commits{/sha}",
74
- "comments_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/comments{/number}",
75
- "issue_comment_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/issues/comments{/number}",
76
- "contents_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/contents/{+path}",
77
- "compare_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/compare/{base}...{head}",
78
- "merges_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/merges",
79
- "archive_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/{archive_format}{/ref}",
80
- "downloads_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/downloads",
81
- "issues_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/issues{/number}",
82
- "pulls_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/pulls{/number}",
83
- "milestones_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/milestones{/number}",
84
- "notifications_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/notifications{?since,all,participating}",
85
- "labels_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/labels{/name}",
86
- "releases_url": "https://api.github.com/repos/txgh-bot/txgh-test-resources/releases{/id}",
87
- "created_at": 1441114620,
88
- "updated_at": "2015-09-01T13:37:00Z",
89
- "pushed_at": 1447892352,
90
- "git_url": "git://github.com/txgh-bot/txgh-test-resources.git",
91
- "ssh_url": "git@github.com:txgh-bot/txgh-test-resources.git",
92
- "clone_url": "https://github.com/txgh-bot/txgh-test-resources.git",
93
- "svn_url": "https://github.com/txgh-bot/txgh-test-resources",
94
- "homepage": null,
95
- "size": 11,
96
- "stargazers_count": 0,
97
- "watchers_count": 0,
98
- "language": null,
99
- "has_issues": true,
100
- "has_downloads": true,
101
- "has_wiki": true,
102
- "has_pages": false,
103
- "forks_count": 0,
104
- "mirror_url": null,
105
- "open_issues_count": 0,
106
- "forks": 0,
107
- "open_issues": 0,
108
- "watchers": 0,
109
- "default_branch": "master",
110
- "stargazers": 0,
111
- "master_branch": "master"
112
- },
113
- "pusher": {
114
- "name": "txgh-bot",
115
- "email": "txgh.bot@gmail.com"
116
- },
117
- "sender": {
118
- "login": "txgh-bot",
119
- "id": 974299,
120
- "avatar_url": "https://avatars.githubusercontent.com/u/974299?v=3",
121
- "gravatar_id": "",
122
- "url": "https://api.github.com/users/txgh-bot",
123
- "html_url": "https://github.com/txgh-bot",
124
- "followers_url": "https://api.github.com/users/txgh-bot/followers",
125
- "following_url": "https://api.github.com/users/txgh-bot/following{/other_user}",
126
- "gists_url": "https://api.github.com/users/txgh-bot/gists{/gist_id}",
127
- "starred_url": "https://api.github.com/users/txgh-bot/starred{/owner}{/repo}",
128
- "subscriptions_url": "https://api.github.com/users/txgh-bot/subscriptions",
129
- "organizations_url": "https://api.github.com/users/txgh-bot/orgs",
130
- "repos_url": "https://api.github.com/users/txgh-bot/repos",
131
- "events_url": "https://api.github.com/users/txgh-bot/events{/privacy}",
132
- "received_events_url": "https://api.github.com/users/txgh-bot/received_events",
133
- "type": "User",
134
- "site_admin": false
135
- }
136
- }
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'rack/test'
4
- require 'helpers/integration_setup'
5
-
6
- describe 'trigger integration tests', integration: true do
7
- include Rack::Test::Methods
8
- include IntegrationSetup
9
-
10
- def app
11
- @app ||= Txgh::Triggers.new
12
- end
13
-
14
- around(:each) do |example|
15
- Dir.chdir('./spec/integration') do
16
- example.run
17
- end
18
- end
19
-
20
- it 'verifies the pull endpoint works' do
21
- VCR.use_cassette('pull') do
22
- params = {
23
- project_slug: 'test-project-88',
24
- resource_slug: 'samplepo',
25
- branch: 'master'
26
- }
27
-
28
- patch '/pull', params
29
- expect(last_response).to be_ok
30
- end
31
- end
32
-
33
- it 'verifies the push endpoint works' do
34
- VCR.use_cassette('push') do
35
- params = {
36
- project_slug: 'test-project-88',
37
- resource_slug: 'samplepo',
38
- branch: 'master'
39
- }
40
-
41
- patch '/push', params
42
- expect(last_response).to be_ok
43
- end
44
- end
45
- end
@@ -1,39 +0,0 @@
1
- require 'spec_helper'
2
- require 'rack'
3
-
4
- include Txgh
5
-
6
- describe TransifexRequestAuth do
7
- let(:secret) { 'abc123' }
8
- let(:params) { 'param1=value1&param2=value2&param3=123' }
9
- let(:valid_signature) { 'pXucIcivBezpfNgCGTHKYeDve84=' }
10
-
11
- describe '.authentic_request?' do
12
- it 'returns true if the request is signed correctly' do
13
- request = Rack::Request.new(
14
- TransifexRequestAuth::RACK_HEADER => valid_signature,
15
- 'rack.input' => StringIO.new(params)
16
- )
17
-
18
- authentic = TransifexRequestAuth.authentic_request?(request, secret)
19
- expect(authentic).to eq(true)
20
- end
21
-
22
- it 'returns false if the request is not signed correctly' do
23
- request = Rack::Request.new(
24
- TransifexRequestAuth::RACK_HEADER => 'incorrect',
25
- 'rack.input' => StringIO.new(params)
26
- )
27
-
28
- authentic = TransifexRequestAuth.authentic_request?(request, secret)
29
- expect(authentic).to eq(false)
30
- end
31
- end
32
-
33
- describe '.header' do
34
- it 'calculates the signature and formats it as an http header' do
35
- value = TransifexRequestAuth.header_value(params, secret)
36
- expect(value).to eq(valid_signature)
37
- end
38
- end
39
- end