worochi 0.0.7 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/worochi/agent/{sample.rb → #example.rb} +2 -14
  3. data/lib/worochi/agent/dropbox.rb +3 -13
  4. data/lib/worochi/agent/github.rb +8 -23
  5. data/lib/worochi/agent.rb +46 -18
  6. data/lib/worochi/config/#example.yml +35 -0
  7. data/lib/worochi/config/dropbox.yml +14 -0
  8. data/lib/worochi/config/github.yml +17 -0
  9. data/lib/worochi/config.rb +9 -84
  10. data/lib/worochi/configurator.rb +120 -0
  11. data/lib/worochi/helper/github_helper.rb +111 -0
  12. data/lib/worochi/helper.rb +28 -7
  13. data/lib/worochi/item.rb +5 -3
  14. data/lib/worochi/log.rb +8 -14
  15. data/lib/worochi/oauth.rb +69 -0
  16. data/lib/worochi/version.rb +1 -1
  17. data/lib/worochi.rb +20 -3
  18. data/spec/cassettes/Worochi/_push/pushes_with_agents.yml +512 -0
  19. data/spec/cassettes/Worochi_Agent_Dropbox/_push_item/pushes_it_chunked_if_size_exceeds_limit.yml +1049 -0
  20. data/spec/cassettes/Worochi_Agent_Dropbox/_push_item_chunked/raises_an_error.yml +44 -0
  21. data/spec/cassettes/Worochi_Agent_Dropbox/_push_items/pushes_multiple_items.yml +165 -0
  22. data/spec/cassettes/Worochi_Agent_Dropbox/it_should_behave_like_a_service_agent/_files/raises_error_on_invalid_path.yml +38 -0
  23. data/spec/cassettes/Worochi_Agent_Dropbox/it_should_behave_like_a_service_agent/_files_and_folders/shows_detailed_listing.yml +79 -0
  24. data/spec/cassettes/Worochi_Agent_Dropbox/it_should_behave_like_a_service_agent/_files_and_folders/shows_detailed_listing_including_the_required_fields.yml +79 -0
  25. data/spec/cassettes/Worochi_Agent_Github/_list/works_with_absolute_paths.yml +12 -12
  26. data/spec/cassettes/Worochi_Agent_Github/_repos/lists_the_repos.yml +207 -0
  27. data/spec/cassettes/Worochi_Agent_Github/_source_branch/retrieves_the_master_branch_correctly.yml +6 -6
  28. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_files/accepts_a_different_relative_path.yml +12 -12
  29. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_files/contains_file1.yml +12 -12
  30. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_files/does_not_contain_folder1.yml +12 -12
  31. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_files/raises_error_on_invalid_path.yml +133 -0
  32. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_files_and_folders/contains_folder1_and_file1.yml +24 -24
  33. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_files_and_folders/shows_detailed_listing_including_the_required_fields.yml +133 -0
  34. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_folders/accepts_a_different_relative_path.yml +12 -12
  35. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_folders/contains_folder1.yml +12 -12
  36. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_folders/does_not_contain_file1.yml +12 -12
  37. data/spec/cassettes/Worochi_Agent_Github/{_push_all → modifies_the_repo/_push_all}/pushes_a_list_of_items_to_create_a_new_commit.yml +80 -80
  38. data/spec/cassettes/Worochi_Agent_Github/{_push_all → modifies_the_repo/_push_all}/pushes_the_file_to_the_right_place.yml +60 -60
  39. data/spec/cassettes/Worochi_Agent_Github/modifies_the_repo/_push_blob/pushes_the_blob_even_when_it_is_larger_than_block_size.yml +181 -0
  40. data/spec/cassettes/Worochi_Agent_Github/modifies_the_repo/_push_item/pushes_a_single_item_and_makes_a_commit.yml +687 -0
  41. data/spec/cassettes/Worochi_Agent_Github/modifies_the_repo/_stream_blob/streams_the_file_as_an_Base64_JSON_field.yml +181 -0
  42. data/spec/cassettes/Worochi_OAuth/_flow_end/rejects_bad_code.yml +56 -0
  43. data/spec/{helper.rb → spec_helper.rb} +14 -1
  44. data/spec/support/aws_uri_matcher.rb +1 -1
  45. data/spec/support/shared_exampes_for_agents.rb +13 -2
  46. data/spec/support/test_files.rb +4 -4
  47. data/spec/worochi/agent/dropbox_spec.rb +29 -3
  48. data/spec/worochi/agent/github_spec.rb +54 -26
  49. data/spec/worochi/agent_spec.rb +34 -1
  50. data/spec/worochi/config_spec.rb +46 -30
  51. data/spec/worochi/helper/github_helper_spec.rb +94 -0
  52. data/spec/worochi/helper_spec.rb +15 -3
  53. data/spec/worochi/item_spec.rb +9 -6
  54. data/spec/worochi/log_spec.rb +30 -0
  55. data/spec/worochi/oauth_spec.rb +33 -0
  56. data/spec/worochi_spec.rb +25 -1
  57. data/worochi.gemspec +5 -1
  58. metadata +104 -11
  59. data/lib/worochi/helper/github.rb +0 -100
  60. data/spec/worochi/helper/github_spec.rb +0 -57
@@ -1,57 +0,0 @@
1
- require 'helper'
2
-
3
- describe Worochi::Helper::Github do
4
- describe Worochi::Helper::Github::StreamIO do
5
-
6
- let(:size) { 114 }
7
- let(:stream) do
8
- item = Worochi::Item.open_single(local.source)
9
- Worochi::Helper::Github::StreamIO.new(item)
10
- end
11
-
12
- after do
13
- stream.rewind
14
- end
15
-
16
- describe '.new' do
17
- it 'initializes' do
18
- item = Worochi::Item.open_single(local.source)
19
- s = Worochi::Helper::Github::StreamIO.new(item)
20
- expect(s.class).to be(Worochi::Helper::Github::StreamIO)
21
- end
22
- end
23
-
24
- describe '#size' do
25
- it 'returns the encoded size' do
26
- expect(stream.size).to eq(size)
27
- end
28
- end
29
-
30
- describe '#read' do
31
- it 'encodes a file correctly' do
32
- checksum = '0bda09766257c6e8d33557cf4d1e1718e82540d46b53d288fc13198e7126f2bc'
33
- content = stream.read
34
- expect(Digest::SHA2.hexdigest(content)).to eq(checksum)
35
- expect(content.size).to eq(size)
36
- end
37
-
38
- it 'reads partial lengths' do
39
- part = stream.read(6)
40
- expect(part).to eq('{"cont')
41
- expect(part.size).to eq(6)
42
-
43
- part = stream.read(15)
44
- expect(part).to eq('ent":"VGhpcyBpc')
45
- expect(part.size).to eq(15)
46
- end
47
- end
48
-
49
- describe '#rewind' do
50
- it 'rewinds the stream' do
51
- expect(stream.read(20)).to eq('{"content":"VGhpcyBp')
52
- stream.rewind
53
- expect(stream.read(20)).to eq('{"content":"VGhpcyBp')
54
- end
55
- end
56
- end
57
- end