radiospieler 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.document +5 -0
  2. data/Gemfile +26 -0
  3. data/Gemfile.lock +63 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +19 -0
  6. data/Rakefile +45 -0
  7. data/VERSION +1 -0
  8. data/app.tmproj +93 -0
  9. data/config/app.yml +5 -0
  10. data/lib/core-extensions/array_ext.rb +5 -0
  11. data/lib/core-extensions/benchmark-logger.rb +31 -0
  12. data/lib/core-extensions/cgi_ext.rb +9 -0
  13. data/lib/core-extensions/hash_ext.rb +24 -0
  14. data/lib/core-extensions/object_ext.rb +8 -0
  15. data/lib/core-extensions/string_ext.rb +59 -0
  16. data/lib/core-extensions/string_without_accents.rb +92 -0
  17. data/lib/core-extensions/tls.rb +16 -0
  18. data/lib/core-extensions/uids.rb +16 -0
  19. data/lib/core-extensions/uri_ext.rb +10 -0
  20. data/lib/extensions/bitly.rb +34 -0
  21. data/lib/extensions/http.rb +60 -0
  22. data/lib/radiospieler.rb +13 -0
  23. data/lib/radiospieler/radiospieler.rb +13 -0
  24. data/lib/radiospieler/radiospieler/cache.rb +77 -0
  25. data/lib/radiospieler/radiospieler/config.rb +58 -0
  26. data/lib/radiospieler/radiospieler/logger.rb +26 -0
  27. data/lib/radiospieler/radiospieler/root.rb +36 -0
  28. data/script/watchr +28 -0
  29. data/test/app_test.rb +56 -0
  30. data/test/array_ext_test.rb +37 -0
  31. data/test/bitlify_test.rb +28 -0
  32. data/test/cache_test.rb +15 -0
  33. data/test/cgi_ext_test.rb +19 -0
  34. data/test/config.yml +8 -0
  35. data/test/config_test.rb +16 -0
  36. data/test/fixtures-vcr/bitly_limit_exceeded.yml +43 -0
  37. data/test/fixtures-vcr/bitly_ok.yml +46 -0
  38. data/test/fixtures-vcr/http_test.yml +389 -0
  39. data/test/hash_ext_test.rb +15 -0
  40. data/test/helper.rb +29 -0
  41. data/test/http_test.rb +18 -0
  42. data/test/string_ext_test.rb +26 -0
  43. data/test/tls_test.rb +35 -0
  44. data/test/uid_test.rb +17 -0
  45. metadata +226 -0
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ require 'helper'
4
+
5
+ class HashExtTest < Test::Unit::TestCase
6
+ def test_stringify
7
+ assert_equal({}, {}.stringify_keys)
8
+ assert_equal({ "a" => "a", "b" => "b", "1" => 1 }, { :a => "a", "b" => "b", 1 => 1 }.stringify_keys)
9
+ end
10
+
11
+ def test_symbolize
12
+ assert_equal({}, {}.symbolize_keys)
13
+ assert_equal({ :a => "a", :b => "b", 1 => 1 }, { :a => "a", "b" => "b", 1 => 1 }.symbolize_keys)
14
+ end
15
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+
11
+ require 'ruby-debug'
12
+ require 'simplecov'
13
+ require 'test/unit'
14
+ SimpleCov.start do
15
+ add_filter "test/*"
16
+ end
17
+
18
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
19
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
20
+
21
+ require 'radiospieler'
22
+ require 'micro_sql'
23
+ App.env = "test"
24
+
25
+ App.logger.level = Logger::ERROR
26
+ MicroSql.logger = App.logger
27
+
28
+ class Test::Unit::TestCase
29
+ end
data/test/http_test.rb ADDED
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+
3
+ require 'helper'
4
+ require 'vcr'
5
+
6
+ VCR.configure do |c|
7
+ c.cassette_library_dir = "#{File.dirname(__FILE__)}/fixtures-vcr"
8
+ c.hook_into :webmock
9
+ end
10
+
11
+ class HttpTest < Test::Unit::TestCase
12
+ def test_get
13
+ VCR.use_cassette('http_test') do
14
+ google = Http.get("http://google.de")
15
+ assert google.starts_with?("<!doctype html>")
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ require 'helper'
4
+
5
+ class StringExtTest < Test::Unit::TestCase
6
+ def test_html_decode
7
+ assert_equal("a", "a".unhtml)
8
+ assert_equal("ä", "&auml;".unhtml)
9
+ end
10
+
11
+ def test_sortkey
12
+ assert_equal("actual", "actual".sortkey)
13
+ assert_equal("schreck003012", "der schreck 3/12".sortkey)
14
+ end
15
+
16
+ def test_starts_ends_with
17
+ s = "foo bar baz"
18
+ assert s.starts_with?("foo")
19
+ assert !s.starts_with?("baz")
20
+ assert !s.ends_with?("foo")
21
+ assert s.ends_with?("baz")
22
+
23
+ assert s.starts_with?("")
24
+ assert s.ends_with?("")
25
+ end
26
+ end
data/test/tls_test.rb ADDED
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ require 'helper'
4
+
5
+ class TlsTest < Test::Unit::TestCase
6
+ thread_local_attribute :tester
7
+ thread_local_attribute :dynamic do "dynamic" end
8
+ thread_local_attribute :dynamic2 do "dynamic2" end
9
+
10
+ def test_get_and_set
11
+ assert_equal(nil, TlsTest.tester)
12
+ TlsTest.tester = 1
13
+ assert_equal(1, TlsTest.tester)
14
+
15
+ assert_equal("dynamic", TlsTest.dynamic)
16
+ end
17
+
18
+ def test_thread_locality
19
+ Thread.new {
20
+ assert_equal(nil, TlsTest.tester)
21
+ TlsTest.tester = 1
22
+ assert_equal(1, TlsTest.tester)
23
+
24
+ assert_equal("dynamic", TlsTest.dynamic)
25
+ }.join
26
+
27
+ Thread.new {
28
+ assert_equal(nil, TlsTest.tester)
29
+ TlsTest.tester = 1
30
+ assert_equal(1, TlsTest.tester)
31
+
32
+ assert_equal("dynamic", TlsTest.dynamic)
33
+ }.join
34
+ end
35
+ end
data/test/uid_test.rb ADDED
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ require 'helper'
4
+
5
+ class UidTest < Test::Unit::TestCase
6
+ def test_string_uids
7
+ assert_equal(578656804, "actual".crc32)
8
+ assert_equal("5157e3c765af93679ea07052f30f0a6e", "actual".md5)
9
+ assert_equal(1989069975706612581, "actual".uid64)
10
+ end
11
+
12
+ def test_hash_uids
13
+ assert_equal(2929690870, {1=>1}.crc32)
14
+ assert_equal("d0bd571dc19c083d82f023c9666c5574", {1=>1}.md5)
15
+ assert_equal(3616698580463597365, {1=>1}.uid64)
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,226 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: radiospieler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - radiospiel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: pg
16
+ requirement: &70278898758980 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70278898758980
25
+ - !ruby/object:Gem::Dependency
26
+ name: sqlite3
27
+ requirement: &70278898757820 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70278898757820
36
+ - !ruby/object:Gem::Dependency
37
+ name: redis
38
+ requirement: &70278898756340 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70278898756340
47
+ - !ruby/object:Gem::Dependency
48
+ name: micro_sql
49
+ requirement: &70278898754320 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70278898754320
58
+ - !ruby/object:Gem::Dependency
59
+ name: htmlentities
60
+ requirement: &70278898753620 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70278898753620
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: &70278898753140 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70278898753140
80
+ - !ruby/object:Gem::Dependency
81
+ name: jeweler
82
+ requirement: &70278898752400 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70278898752400
91
+ - !ruby/object:Gem::Dependency
92
+ name: vcr
93
+ requirement: &70278898751400 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70278898751400
102
+ - !ruby/object:Gem::Dependency
103
+ name: webmock
104
+ requirement: &70278898750540 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *70278898750540
113
+ - !ruby/object:Gem::Dependency
114
+ name: psych
115
+ requirement: &70278898749860 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *70278898749860
124
+ - !ruby/object:Gem::Dependency
125
+ name: simplecov
126
+ requirement: &70278898748920 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: *70278898748920
135
+ - !ruby/object:Gem::Dependency
136
+ name: ruby-debug19
137
+ requirement: &70278898748160 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ type: :development
144
+ prerelease: false
145
+ version_requirements: *70278898748160
146
+ description: Some basics that your application could benefit from.
147
+ email: eno@open-lab.org
148
+ executables: []
149
+ extensions: []
150
+ extra_rdoc_files:
151
+ - LICENSE.txt
152
+ - README.rdoc
153
+ files:
154
+ - .document
155
+ - Gemfile
156
+ - Gemfile.lock
157
+ - LICENSE.txt
158
+ - README.rdoc
159
+ - Rakefile
160
+ - VERSION
161
+ - app.tmproj
162
+ - config/app.yml
163
+ - lib/core-extensions/array_ext.rb
164
+ - lib/core-extensions/benchmark-logger.rb
165
+ - lib/core-extensions/cgi_ext.rb
166
+ - lib/core-extensions/hash_ext.rb
167
+ - lib/core-extensions/object_ext.rb
168
+ - lib/core-extensions/string_ext.rb
169
+ - lib/core-extensions/string_without_accents.rb
170
+ - lib/core-extensions/tls.rb
171
+ - lib/core-extensions/uids.rb
172
+ - lib/core-extensions/uri_ext.rb
173
+ - lib/extensions/bitly.rb
174
+ - lib/extensions/http.rb
175
+ - lib/radiospieler.rb
176
+ - lib/radiospieler/radiospieler.rb
177
+ - lib/radiospieler/radiospieler/cache.rb
178
+ - lib/radiospieler/radiospieler/config.rb
179
+ - lib/radiospieler/radiospieler/logger.rb
180
+ - lib/radiospieler/radiospieler/root.rb
181
+ - script/watchr
182
+ - test/app_test.rb
183
+ - test/array_ext_test.rb
184
+ - test/bitlify_test.rb
185
+ - test/cache_test.rb
186
+ - test/cgi_ext_test.rb
187
+ - test/config.yml
188
+ - test/config_test.rb
189
+ - test/fixtures-vcr/bitly_limit_exceeded.yml
190
+ - test/fixtures-vcr/bitly_ok.yml
191
+ - test/fixtures-vcr/http_test.yml
192
+ - test/hash_ext_test.rb
193
+ - test/helper.rb
194
+ - test/http_test.rb
195
+ - test/string_ext_test.rb
196
+ - test/tls_test.rb
197
+ - test/uid_test.rb
198
+ homepage: http://github.com/radiospiel/radiospieler
199
+ licenses:
200
+ - MIT
201
+ post_install_message:
202
+ rdoc_options: []
203
+ require_paths:
204
+ - lib
205
+ required_ruby_version: !ruby/object:Gem::Requirement
206
+ none: false
207
+ requirements:
208
+ - - ! '>='
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ segments:
212
+ - 0
213
+ hash: -1058781715600460096
214
+ required_rubygems_version: !ruby/object:Gem::Requirement
215
+ none: false
216
+ requirements:
217
+ - - ! '>='
218
+ - !ruby/object:Gem::Version
219
+ version: '0'
220
+ requirements: []
221
+ rubyforge_project:
222
+ rubygems_version: 1.8.17
223
+ signing_key:
224
+ specification_version: 3
225
+ summary: Application base code
226
+ test_files: []