moneta 0.7.18 → 0.7.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
1
+ if defined?(Encoding) && Encoding.default_external != "UTF-8"
2
+ Encoding.default_external = "UTF-8"
3
+ end
4
+
5
+ describe "The library itself" do
6
+ def check_for_tab_characters(filename)
7
+ failing_lines = []
8
+ File.readlines(filename).each_with_index do |line,number|
9
+ failing_lines << number + 1 if line =~ /\t/
10
+ end
11
+
12
+ unless failing_lines.empty?
13
+ "#{filename} has tab characters on lines #{failing_lines.join(', ')}"
14
+ end
15
+ end
16
+
17
+ def check_for_extra_spaces(filename)
18
+ failing_lines = []
19
+ File.readlines(filename).each_with_index do |line,number|
20
+ next if line =~ /^\s+#.*\s+\n$/
21
+ failing_lines << number + 1 if line =~ /\s+\n$/
22
+ end
23
+
24
+ unless failing_lines.empty?
25
+ "#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}"
26
+ end
27
+ end
28
+
29
+ RSpec::Matchers.define :be_well_formed do
30
+ failure_message_for_should do |actual|
31
+ actual.join("\n")
32
+ end
33
+
34
+ match do |actual|
35
+ actual.empty?
36
+ end
37
+ end
38
+
39
+ it "has no malformed whitespace" do
40
+ exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|kill|LICENSE/
41
+ error_messages = []
42
+ Dir.chdir(File.expand_path("../..", __FILE__)) do
43
+ `git ls-files`.split("\n").each do |filename|
44
+ next if filename =~ exempt
45
+ error_messages << check_for_tab_characters(filename)
46
+ error_messages << check_for_extra_spaces(filename)
47
+ end
48
+ end
49
+ expect(error_messages.compact).to be_well_formed
50
+ end
51
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.18
4
+ version: 0.7.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Mendler
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-29 00:00:00.000000000 Z
13
+ date: 2013-07-05 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: A unified interface to key/value stores
16
16
  email:
@@ -32,7 +32,6 @@ files:
32
32
  - Gemfile
33
33
  - LICENSE
34
34
  - README.md
35
- - Rakefile
36
35
  - SPEC.md
37
36
  - lib/action_dispatch/middleware/session/moneta_store.rb
38
37
  - lib/active_support/cache/moneta_store.rb
@@ -103,6 +102,7 @@ files:
103
102
  - script/install-kyotocabinet
104
103
  - script/kill-travis
105
104
  - script/memusage
105
+ - script/parallel-tests
106
106
  - script/start-services
107
107
  - script/travis-logs
108
108
  - script/upload-bundle
@@ -276,6 +276,7 @@ files:
276
276
  - spec/moneta/weak_create_spec.rb
277
277
  - spec/moneta/weak_increment_spec.rb
278
278
  - spec/monetaspecs.rb
279
+ - spec/quality_spec.rb
279
280
  - spec/rack/cache_moneta_spec.rb
280
281
  - spec/rack/moneta_cookies_spec.rb
281
282
  - spec/rack/moneta_store_spec.rb
@@ -475,6 +476,7 @@ test_files:
475
476
  - spec/moneta/weak_create_spec.rb
476
477
  - spec/moneta/weak_increment_spec.rb
477
478
  - spec/monetaspecs.rb
479
+ - spec/quality_spec.rb
478
480
  - spec/rack/cache_moneta_spec.rb
479
481
  - spec/rack/moneta_cookies_spec.rb
480
482
  - spec/rack/moneta_store_spec.rb
data/Rakefile DELETED
@@ -1,99 +0,0 @@
1
- def rspec(spec)
2
- sh("rspec #{spec}")
3
- true
4
- rescue Exception => ex
5
- if $?.termsig
6
- sig = nil
7
- Signal.list.each do |name, id|
8
- if id == $?.termsig
9
- sig = name
10
- break
11
- end
12
- end
13
- puts "\e[31m########## SIG#{sig} rspec #{spec} ##########\e[0m"
14
- end
15
- false
16
- end
17
-
18
- task :test do
19
- specs = Dir['spec/*/*_spec.rb'].sort
20
-
21
- # Shuffle specs to ensure equal distribution over the test groups
22
- # We have to shuffle with the same seed every time because rake is started
23
- # multiple times!
24
- old_seed = srand(43)
25
- specs.shuffle!
26
- srand(old_seed)
27
-
28
- group = ENV['TEST_GROUP'] || '1/1'
29
-
30
- # FIXME:
31
- #
32
- # * QuickLZ segfaults because of an assertion
33
- # QuickLZ is also not maintained on Github, but on Bitbucket
34
- # and I don't know where the issue tracker is.
35
- #
36
- # * PStore and File increment/locking doesn't work correctly on JRuby
37
- #
38
- unstable = %w(quicklz riak)
39
- unstable += %w(file pstore) if defined?(JRUBY_VERSION)
40
-
41
- unstable_re = /#{unstable.join('|')}/
42
- unstable = specs.select {|s| s =~ unstable_re }
43
- specs -= unstable
44
-
45
- if group =~ /^(\d+)\/(\d+)$/
46
- n = $1.to_i
47
- max = $2.to_i
48
- if n == max
49
- specs = specs[(n-1)*(specs.size/max)..-1]
50
- else
51
- specs = specs[(n-1)*(specs.size/max), specs.size/max]
52
- end
53
- elsif group == 'unstable'
54
- specs = unstable
55
- else
56
- puts "Invalid test group #{group}"
57
- exit 1
58
- end
59
-
60
- # Memcached and Redis specs cannot be used in parallel
61
- # because of flushing and lacking namespaces
62
- parallel = []
63
- %w(memcached redis client shared riak tokyotyrant couch cassandra).each do |name|
64
- serial = specs.select { |s| s.include?(name) }
65
- unless serial.empty?
66
- specs -= serial
67
- parallel << serial
68
- end
69
- end
70
- parallel += specs.map {|s| [s] }
71
-
72
- threads = []
73
- failed = false
74
- parallel.each do |serial|
75
- threads << Thread.new do
76
- begin
77
- serial.each do |spec|
78
- failed = true unless rspec(spec)
79
- end
80
- ensure
81
- threads.delete Thread.current
82
- end
83
- end
84
- sleep 0.1
85
- sleep 0.1 while threads.size >= 5
86
- end
87
- sleep 0.1 until threads.empty?
88
- if failed
89
- fail "\e[31m########## MONETA TESTSUITE FAILED ##########\e[0m"
90
- else
91
- puts "\e[32m########## MONETA TESTSUITE SUCCEDED ##########\e[0m"
92
- end
93
- end
94
-
95
- task :benchmarks do
96
- ruby("script/benchmarks #{ENV['CONFIG']}")
97
- end
98
-
99
- task :default => :test