audio-feed-manager 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +27 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +4 -0
  5. data/Guardfile +17 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +86 -0
  8. data/Rakefile +2 -0
  9. data/audio-feed-manager.gemspec +32 -0
  10. data/bin/afm +5 -0
  11. data/lib/audio-feed-manager.rb +1 -0
  12. data/lib/audio_feed_manager/application.rb +39 -0
  13. data/lib/audio_feed_manager/audio_file.rb +9 -0
  14. data/lib/audio_feed_manager/audio_file_adder.rb +14 -0
  15. data/lib/audio_feed_manager/audio_file_repository.rb +42 -0
  16. data/lib/audio_feed_manager/cli/add_audio_file.rb +39 -0
  17. data/lib/audio_feed_manager/cli/add_feed.rb +20 -0
  18. data/lib/audio_feed_manager/cli/arguments.rb +27 -0
  19. data/lib/audio_feed_manager/cli/arguments_parser.rb +67 -0
  20. data/lib/audio_feed_manager/cli/arguments_specification.rb +103 -0
  21. data/lib/audio_feed_manager/cli/command.rb +23 -0
  22. data/lib/audio_feed_manager/cli/commands_list.rb +120 -0
  23. data/lib/audio_feed_manager/cli/get_feed_url.rb +20 -0
  24. data/lib/audio_feed_manager/cli/initialize_project.rb +44 -0
  25. data/lib/audio_feed_manager/cli/list_feeds.rb +38 -0
  26. data/lib/audio_feed_manager/cli/publish.rb +21 -0
  27. data/lib/audio_feed_manager/cli/show_feed.rb +44 -0
  28. data/lib/audio_feed_manager/cli/update_feed_rss.rb +19 -0
  29. data/lib/audio_feed_manager/cli.rb +19 -0
  30. data/lib/audio_feed_manager/config.rb +5 -0
  31. data/lib/audio_feed_manager/config_repository.rb +14 -0
  32. data/lib/audio_feed_manager/console.rb +28 -0
  33. data/lib/audio_feed_manager/directory_lister.rb +9 -0
  34. data/lib/audio_feed_manager/error.rb +4 -0
  35. data/lib/audio_feed_manager/feed.rb +9 -0
  36. data/lib/audio_feed_manager/feed_items_repository.rb +30 -0
  37. data/lib/audio_feed_manager/feed_repository.rb +32 -0
  38. data/lib/audio_feed_manager/feed_syncer.rb +20 -0
  39. data/lib/audio_feed_manager/file_storage.rb +20 -0
  40. data/lib/audio_feed_manager/id3_tags.rb +14 -0
  41. data/lib/audio_feed_manager/new_model_creator.rb +15 -0
  42. data/lib/audio_feed_manager/rss_generator.rb +10 -0
  43. data/lib/audio_feed_manager/rss_repository.rb +36 -0
  44. data/lib/audio_feed_manager/s3_gateway.rb +39 -0
  45. data/lib/audio_feed_manager/secret_token_generator.rb +9 -0
  46. data/lib/audio_feed_manager/stop_application.rb +4 -0
  47. data/lib/audio_feed_manager/support/getter_setter_method.rb +18 -0
  48. data/lib/audio_feed_manager/support/hash_constructor.rb +9 -0
  49. data/lib/audio_feed_manager/tags.rb +9 -0
  50. data/lib/audio_feed_manager/unique_id_generator.rb +19 -0
  51. data/lib/audio_feed_manager/url_maker.rb +13 -0
  52. data/lib/audio_feed_manager/version.rb +3 -0
  53. data/lib/audio_feed_manager.rb +57 -0
  54. data/spec/audio_feed_manager/audio_file_adder_spec.rb +49 -0
  55. data/spec/audio_feed_manager/audio_file_repository_spec.rb +58 -0
  56. data/spec/audio_feed_manager/cli/add_audio_file_spec.rb +44 -0
  57. data/spec/audio_feed_manager/cli/add_feed_spec.rb +27 -0
  58. data/spec/audio_feed_manager/cli/arguments_parser_spec.rb +85 -0
  59. data/spec/audio_feed_manager/cli/arguments_specification_spec.rb +51 -0
  60. data/spec/audio_feed_manager/cli/commands_list_spec.rb +91 -0
  61. data/spec/audio_feed_manager/cli/get_feed_url_spec.rb +26 -0
  62. data/spec/audio_feed_manager/cli/initialize_project_spec.rb +47 -0
  63. data/spec/audio_feed_manager/cli/list_feeds_spec.rb +27 -0
  64. data/spec/audio_feed_manager/cli/show_feed_spec.rb +41 -0
  65. data/spec/audio_feed_manager/cli/update_feed_rss_spec.rb +26 -0
  66. data/spec/audio_feed_manager/cli_spec.rb +42 -0
  67. data/spec/audio_feed_manager/directory_lister_spec.rb +23 -0
  68. data/spec/audio_feed_manager/feed_items_repository_spec.rb +34 -0
  69. data/spec/audio_feed_manager/feeds_repository_spec.rb +40 -0
  70. data/spec/audio_feed_manager/file_storage_spec.rb +22 -0
  71. data/spec/audio_feed_manager/id3_tags_spec.rb +26 -0
  72. data/spec/audio_feed_manager/new_model_creator_spec.rb +44 -0
  73. data/spec/audio_feed_manager/rss_repository_spec.rb +34 -0
  74. data/spec/audio_feed_manager/s3_gateway_spec.rb +51 -0
  75. data/spec/audio_feed_manager/secret_token_generator_spec.rb +13 -0
  76. data/spec/audio_feed_manager/support/getter_setter_method_spec.rb +77 -0
  77. data/spec/audio_feed_manager/unique_id_generator_spec.rb +23 -0
  78. data/spec/fixtures/test.mp3 +0 -0
  79. data/spec/fixtures/test.txt +1 -0
  80. data/spec/help_spec.rb +64 -0
  81. data/spec/initializing_spec.rb +12 -0
  82. data/spec/managing_audio_files_spec.rb +21 -0
  83. data/spec/managing_feeds_spec.rb +51 -0
  84. data/spec/publishing_spec.rb +24 -0
  85. data/spec/s3_credentials.yml.sample +5 -0
  86. data/spec/spec_helper.rb +17 -0
  87. data/spec/support/builders.rb +26 -0
  88. data/spec/support/fake_console.rb +13 -0
  89. data/spec/support/fakes.rb +5 -0
  90. data/spec/support/integration_helpers.rb +38 -0
  91. metadata +297 -0
@@ -0,0 +1,26 @@
1
+ module Builders
2
+ def next_id
3
+ $next_id ||= 0
4
+ $next_id += 1
5
+ end
6
+
7
+ def build_feed(attrs = {})
8
+ id = next_id
9
+ AudioFeedManager::Feed.new({
10
+ id: "feeds/#{id}",
11
+ title: "Feed #{id}",
12
+ secret_token: "secret_#{id}",
13
+ }.merge(attrs))
14
+ end
15
+
16
+ def build_audio_file(attrs = {})
17
+ id = next_id
18
+ AudioFeedManager::AudioFile.new({
19
+ id: "audio_files/#{id}",
20
+ title: "Audio File #{id}",
21
+ author: "Author #{id}",
22
+ extension: ".mp3",
23
+ secret_token: "secret_#{id}",
24
+ }.merge(attrs))
25
+ end
26
+ end
@@ -0,0 +1,13 @@
1
+ class FakeConsole < AudioFeedManager::Console
2
+ def initialize
3
+ @stdout = @stderr = @stream = StringIO.new
4
+ end
5
+
6
+ def out
7
+ @stream.string
8
+ end
9
+
10
+ def die(error)
11
+ fail(error)
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ Bogus.fakes do
2
+ fake(:help, as: :instance, class: proc{AudioFeedManager::CommandsList})
3
+ fake(:storage, as: :instance, class: proc{AudioFeedManager::FileStorage})
4
+ fake(:rss_repository, as: :instance, class: proc{AudioFeedManager::RSSRepository})
5
+ end
@@ -0,0 +1,38 @@
1
+ module IntegrationHelpers
2
+ S3_CONFIG = YAML.load_file(File.expand_path("../../s3_credentials.yml", __FILE__))
3
+
4
+ def s3_config
5
+ S3_CONFIG
6
+ end
7
+
8
+ def init_project(dir = "/tmp/project-#{SecureRandom.hex}")
9
+ input = StringIO.new([S3_CONFIG["access_key"],
10
+ S3_CONFIG["secret_key"],
11
+ S3_CONFIG["region"],
12
+ S3_CONFIG["bucket"]].join("\n"))
13
+ AudioFeedManager.run(stdin: input, stdout: StringIO.new, argv: ["init", dir])
14
+ dir
15
+ end
16
+
17
+ def add_feed(dir)
18
+ AudioFeedManager.run(
19
+ pwd: dir,
20
+ stdin: StringIO.new("some description"),
21
+ stdout: StringIO.new,
22
+ argv: ["feeds", "add", "Hello World!"]
23
+ )
24
+ AudioFeedManager::Feed.new(id: "feeds/hello-world")
25
+ end
26
+
27
+ def add_audio_file(dir, feed)
28
+ AudioFeedManager.run(
29
+ pwd: dir,
30
+ stdout: StringIO.new,
31
+ argv: ["audio", "add", feed.id, fixture_file("test.mp3")]
32
+ )
33
+ end
34
+
35
+ def fixture_file(name)
36
+ File.expand_path("../../fixtures/#{name}", __FILE__)
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,297 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: audio-feed-manager
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Adam Pohorecki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bogus
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-ctags-bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: dependor
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: id3tag
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: aws-sdk
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '2'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '2'
139
+ description: A CLI tool for managing audio RSS feeds
140
+ email:
141
+ - adam@gunpowderlabs.com
142
+ executables:
143
+ - afm
144
+ extensions: []
145
+ extra_rdoc_files: []
146
+ files:
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - Gemfile
150
+ - Guardfile
151
+ - LICENSE.txt
152
+ - README.md
153
+ - Rakefile
154
+ - audio-feed-manager.gemspec
155
+ - bin/afm
156
+ - lib/audio-feed-manager.rb
157
+ - lib/audio_feed_manager.rb
158
+ - lib/audio_feed_manager/application.rb
159
+ - lib/audio_feed_manager/audio_file.rb
160
+ - lib/audio_feed_manager/audio_file_adder.rb
161
+ - lib/audio_feed_manager/audio_file_repository.rb
162
+ - lib/audio_feed_manager/cli.rb
163
+ - lib/audio_feed_manager/cli/add_audio_file.rb
164
+ - lib/audio_feed_manager/cli/add_feed.rb
165
+ - lib/audio_feed_manager/cli/arguments.rb
166
+ - lib/audio_feed_manager/cli/arguments_parser.rb
167
+ - lib/audio_feed_manager/cli/arguments_specification.rb
168
+ - lib/audio_feed_manager/cli/command.rb
169
+ - lib/audio_feed_manager/cli/commands_list.rb
170
+ - lib/audio_feed_manager/cli/get_feed_url.rb
171
+ - lib/audio_feed_manager/cli/initialize_project.rb
172
+ - lib/audio_feed_manager/cli/list_feeds.rb
173
+ - lib/audio_feed_manager/cli/publish.rb
174
+ - lib/audio_feed_manager/cli/show_feed.rb
175
+ - lib/audio_feed_manager/cli/update_feed_rss.rb
176
+ - lib/audio_feed_manager/config.rb
177
+ - lib/audio_feed_manager/config_repository.rb
178
+ - lib/audio_feed_manager/console.rb
179
+ - lib/audio_feed_manager/directory_lister.rb
180
+ - lib/audio_feed_manager/error.rb
181
+ - lib/audio_feed_manager/feed.rb
182
+ - lib/audio_feed_manager/feed_items_repository.rb
183
+ - lib/audio_feed_manager/feed_repository.rb
184
+ - lib/audio_feed_manager/feed_syncer.rb
185
+ - lib/audio_feed_manager/file_storage.rb
186
+ - lib/audio_feed_manager/id3_tags.rb
187
+ - lib/audio_feed_manager/new_model_creator.rb
188
+ - lib/audio_feed_manager/rss_generator.rb
189
+ - lib/audio_feed_manager/rss_repository.rb
190
+ - lib/audio_feed_manager/s3_gateway.rb
191
+ - lib/audio_feed_manager/secret_token_generator.rb
192
+ - lib/audio_feed_manager/stop_application.rb
193
+ - lib/audio_feed_manager/support/getter_setter_method.rb
194
+ - lib/audio_feed_manager/support/hash_constructor.rb
195
+ - lib/audio_feed_manager/tags.rb
196
+ - lib/audio_feed_manager/unique_id_generator.rb
197
+ - lib/audio_feed_manager/url_maker.rb
198
+ - lib/audio_feed_manager/version.rb
199
+ - spec/audio_feed_manager/audio_file_adder_spec.rb
200
+ - spec/audio_feed_manager/audio_file_repository_spec.rb
201
+ - spec/audio_feed_manager/cli/add_audio_file_spec.rb
202
+ - spec/audio_feed_manager/cli/add_feed_spec.rb
203
+ - spec/audio_feed_manager/cli/arguments_parser_spec.rb
204
+ - spec/audio_feed_manager/cli/arguments_specification_spec.rb
205
+ - spec/audio_feed_manager/cli/commands_list_spec.rb
206
+ - spec/audio_feed_manager/cli/get_feed_url_spec.rb
207
+ - spec/audio_feed_manager/cli/initialize_project_spec.rb
208
+ - spec/audio_feed_manager/cli/list_feeds_spec.rb
209
+ - spec/audio_feed_manager/cli/show_feed_spec.rb
210
+ - spec/audio_feed_manager/cli/update_feed_rss_spec.rb
211
+ - spec/audio_feed_manager/cli_spec.rb
212
+ - spec/audio_feed_manager/directory_lister_spec.rb
213
+ - spec/audio_feed_manager/feed_items_repository_spec.rb
214
+ - spec/audio_feed_manager/feeds_repository_spec.rb
215
+ - spec/audio_feed_manager/file_storage_spec.rb
216
+ - spec/audio_feed_manager/id3_tags_spec.rb
217
+ - spec/audio_feed_manager/new_model_creator_spec.rb
218
+ - spec/audio_feed_manager/rss_repository_spec.rb
219
+ - spec/audio_feed_manager/s3_gateway_spec.rb
220
+ - spec/audio_feed_manager/secret_token_generator_spec.rb
221
+ - spec/audio_feed_manager/support/getter_setter_method_spec.rb
222
+ - spec/audio_feed_manager/unique_id_generator_spec.rb
223
+ - spec/fixtures/test.mp3
224
+ - spec/fixtures/test.txt
225
+ - spec/help_spec.rb
226
+ - spec/initializing_spec.rb
227
+ - spec/managing_audio_files_spec.rb
228
+ - spec/managing_feeds_spec.rb
229
+ - spec/publishing_spec.rb
230
+ - spec/s3_credentials.yml.sample
231
+ - spec/spec_helper.rb
232
+ - spec/support/builders.rb
233
+ - spec/support/fake_console.rb
234
+ - spec/support/fakes.rb
235
+ - spec/support/integration_helpers.rb
236
+ homepage: https://github.com/gunpowderlabs/audio-feed-manager
237
+ licenses:
238
+ - MIT
239
+ metadata: {}
240
+ post_install_message:
241
+ rdoc_options: []
242
+ require_paths:
243
+ - lib
244
+ required_ruby_version: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - ">="
247
+ - !ruby/object:Gem::Version
248
+ version: '0'
249
+ required_rubygems_version: !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - ">="
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ requirements: []
255
+ rubyforge_project:
256
+ rubygems_version: 2.4.6
257
+ signing_key:
258
+ specification_version: 4
259
+ summary: A CLI tool for managing audio RSS feeds
260
+ test_files:
261
+ - spec/audio_feed_manager/audio_file_adder_spec.rb
262
+ - spec/audio_feed_manager/audio_file_repository_spec.rb
263
+ - spec/audio_feed_manager/cli/add_audio_file_spec.rb
264
+ - spec/audio_feed_manager/cli/add_feed_spec.rb
265
+ - spec/audio_feed_manager/cli/arguments_parser_spec.rb
266
+ - spec/audio_feed_manager/cli/arguments_specification_spec.rb
267
+ - spec/audio_feed_manager/cli/commands_list_spec.rb
268
+ - spec/audio_feed_manager/cli/get_feed_url_spec.rb
269
+ - spec/audio_feed_manager/cli/initialize_project_spec.rb
270
+ - spec/audio_feed_manager/cli/list_feeds_spec.rb
271
+ - spec/audio_feed_manager/cli/show_feed_spec.rb
272
+ - spec/audio_feed_manager/cli/update_feed_rss_spec.rb
273
+ - spec/audio_feed_manager/cli_spec.rb
274
+ - spec/audio_feed_manager/directory_lister_spec.rb
275
+ - spec/audio_feed_manager/feed_items_repository_spec.rb
276
+ - spec/audio_feed_manager/feeds_repository_spec.rb
277
+ - spec/audio_feed_manager/file_storage_spec.rb
278
+ - spec/audio_feed_manager/id3_tags_spec.rb
279
+ - spec/audio_feed_manager/new_model_creator_spec.rb
280
+ - spec/audio_feed_manager/rss_repository_spec.rb
281
+ - spec/audio_feed_manager/s3_gateway_spec.rb
282
+ - spec/audio_feed_manager/secret_token_generator_spec.rb
283
+ - spec/audio_feed_manager/support/getter_setter_method_spec.rb
284
+ - spec/audio_feed_manager/unique_id_generator_spec.rb
285
+ - spec/fixtures/test.mp3
286
+ - spec/fixtures/test.txt
287
+ - spec/help_spec.rb
288
+ - spec/initializing_spec.rb
289
+ - spec/managing_audio_files_spec.rb
290
+ - spec/managing_feeds_spec.rb
291
+ - spec/publishing_spec.rb
292
+ - spec/s3_credentials.yml.sample
293
+ - spec/spec_helper.rb
294
+ - spec/support/builders.rb
295
+ - spec/support/fake_console.rb
296
+ - spec/support/fakes.rb
297
+ - spec/support/integration_helpers.rb