sbsm 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7ac06f79c0abab4400ca3e02cc81f14812efc908
4
+ data.tar.gz: 99c20d773e6423627a4b419b51f6368844bf09fe
5
+ SHA512:
6
+ metadata.gz: e4ab8c7aba17a75a17e395e7e199fc2cc146e93562b1a232138bd77ac5855ffc192dc97e6685c093b3132476583eeb8c8e704d0a0d1337faa52b46b9f16a64fb
7
+ data.tar.gz: 3d7c7e67fd3df13b56f5889b6de8d1654abb4b6aca2262aa19c3045d80b1257153f8c460e6dc9958aa05f1bde1d35d80f24c6218edc10f4071d85cb860359390
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
1
  .bundle/
2
2
  vendor/
3
+ pkg/
4
+ coverage/
data/.travis.yml CHANGED
@@ -1,29 +1,26 @@
1
1
  ---
2
2
  language: ruby
3
+
3
4
  notifications:
4
5
  email:
5
6
  - ngiger@ywesee.com
7
+
8
+ cache: bundler
9
+
10
+ sudo: false
11
+
12
+ before_install:
13
+ - gem --version
14
+
15
+ script: bundle exec test/suite.rb
16
+
6
17
  bundler_args: --without debugger
18
+
7
19
  rvm:
8
20
  - ruby-head
9
- - 2.0.0
10
- - 1.9.3
11
- - 1.9.2
12
- - 1.8.7
13
- - rbx-19mode
14
- - rbx-18mode
15
- - jruby-head
16
- - jruby-19mode
17
- - jruby-18mode
18
- - ree
21
+ - 2.1.7
22
+ - 2.2.3
23
+ - 2.3.0
19
24
  matrix:
20
25
  allow_failures:
21
- - rvm: 2.0.0 # rmail chokes lib/rmail/address.rb:694: invalid multibyte escape
22
- - rvm: 1.8.7 # GMT instead of UTC for some time info. Some fields have different order
23
26
  - rvm: ruby-head
24
- - rvm: rbx-19mode
25
- - rvm: rbx-18mode
26
- - rvm: jruby-head
27
- - rvm: jruby-19mode
28
- - rvm: jruby-18mode
29
- - rvm: ree
data/Gemfile CHANGED
@@ -1,25 +1,12 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'hoe'
4
- gem 'mail', '>=2.2.7'
5
- gem 'hpricot'
6
- # gem 'rockit', '0.3.8' Cannot find version 0.3.8 is this really needed?
7
-
8
- group :development, :test do
9
- gem 'rake'
10
- gem "minitest"
11
- gem "minitest-reporters"
12
- gem 'hoe-travis'
13
- gem 'simplecov'
14
- gem 'test-unit'
15
- end
16
-
17
- group :development do
18
- gem 'racc'
19
- gem 'travis-lint'
20
- end
3
+ gemspec
21
4
 
22
5
  group :debugger do
23
- gem 'pry'
24
- gem 'pry-debugger'
25
- end
6
+ if RUBY_VERSION.match(/^1/)
7
+ gem 'pry-debugger'
8
+ else
9
+ gem 'pry-byebug'
10
+ gem 'pry-doc'
11
+ end
12
+ end
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 1.2.7 / 10.05.2016
2
+
3
+ * Migration to Ruby 2.x works now
4
+ * Removed C-Interface
5
+ * Only Ruby >= 1.9 is supported
6
+
1
7
  === 1.2.6 / 02.07.2014
2
8
 
3
9
  * Revert "Tried migrating to ruby 2.1.2"
@@ -10,6 +16,16 @@
10
16
  * Use Mail instead of (outdated, last release in 2008) RMail for verification of e-mail addresses
11
17
  * updated Rakefile so I can release the gem
12
18
  Updated Manifest.txt
19
+ === 1.2.5 / 25.04.2016
20
+
21
+ * Made it suitable to work with ydim-html
22
+ * Port to Ruby 2.3.0. Removed dependency to rockit and hoe.
23
+ * Prepared for travis
24
+
25
+ === 1.2.5 / 25.11.2014
26
+
27
+ * Port to Ruby 2.1.2
28
+ * Prepared for travis
13
29
 
14
30
  === 1.2.4 / 05.03.2014
15
31
 
@@ -1,22 +1,20 @@
1
- = sbsm
1
+ # sbsm
2
2
 
3
- * http://scm.ywesee.com/?p=sbsm/.git;a=summary
3
+ * https://github.com/zdavatz/sbsm
4
4
 
5
- == DESCRIPTION:
5
+ ## DESCRIPTION:
6
6
 
7
7
  Application framework for state based session management
8
8
 
9
- == FEATURES/PROBLEMS:
9
+ ## FEATURES/PROBLEMS:
10
10
 
11
11
  * Could be replaced by Ramaze one day. But lets see.
12
12
 
13
- == REQUIREMENTS:
13
+ ## REQUIREMENTS:
14
14
 
15
- * Ruby 1.8
16
- * Ruby 1.9
17
- * Ruby 2.0
15
+ * Ruby 2.3
18
16
 
19
- == INSTALL:
17
+ ## INSTALL:
20
18
 
21
19
  * gem install sbsm
22
20
 
@@ -24,19 +22,22 @@ or
24
22
 
25
23
  De-Compress archive and enter its top directory. Then type:
26
24
 
27
- * ruby setup.rb config
28
- * ruby setup.rb setup
29
- * su
30
- * ruby setup.rb install
25
+ * gem install bundler
26
+ * bundle exec rake install:local
31
27
 
32
28
  You can also install files into your favorite directory by supplying setup.rb some options. Try "ruby setup.rb --help".
33
29
 
34
- == DEVELOPERS:
30
+ ## TESTING
31
+
32
+ * bundle exec test/suite.rb
33
+
34
+ ## DEVELOPERS:
35
35
 
36
36
  * Masaomi Hatakeyama
37
37
  * Zeno Davatz
38
38
  * Hannes Wyss (upto Version 1.0)
39
+ * Niklaus Giger (Port to Ruby 2.3.0)
39
40
 
40
- == LICENSE:
41
+ ## LICENSE:
41
42
 
42
43
  * GPLv2.1
data/Rakefile CHANGED
@@ -1,31 +1,21 @@
1
- # -*- ruby -*-
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'sbsm/version'
6
+ require "bundler/gem_tasks"
7
+ require 'rspec/core/rake_task'
2
8
 
3
- require 'rubygems'
4
- require 'hoe'
9
+ RSpec::Core::RakeTask.new(:spec)
5
10
 
6
- # Hoe.plugin :compiler
7
- # Hoe.plugin :cucumberfeatures
8
- # Hoe.plugin :gem_prelude_sucks
9
- # Hoe.plugin :inline
10
- # Hoe.plugin :inline
11
- # Hoe.plugin :manifest
12
- # Hoe.plugin :newgem
13
- # Hoe.plugin :racc
14
- # Hoe.plugin :rubyforge
15
- # Hoe.plugin :rubyforge
16
- # Hoe.plugin :website
11
+ # dependencies are now declared in sbsm.gemspec
17
12
 
18
- Hoe.spec 'sbsm' do
19
- # HEY! If you fill these out in ~/.hoe_template/Rakefile.erb then
20
- # you'll never have to touch them again!
21
- # (delete this comment too, of course)
22
-
23
- license('GPL v2.1')
24
- developer('Masaomi Hatakeyama, Zeno R.R. Davatz', 'mhatakeyama@ywesee.com, zdavatz@ywesee.com')
25
- test_globs = [ "#{File.dirname(__FILE__)}/test/test_*.rb" ]
13
+ desc 'Offer a gem task like hoe'
14
+ task :gem => :build do
15
+ Rake::Task[:build].invoke
26
16
  end
27
17
 
28
- #require 'minitest/reporters'
29
- #MiniTest::Reporters.use!
18
+ task :spec => :clean
30
19
 
31
- # vim: syntax=ruby
20
+ require 'rake/clean'
21
+ CLEAN.include FileList['pkg/*.gem']
data/lib/sbsm/cgi.rb CHANGED
@@ -75,6 +75,7 @@ class CGI
75
75
  pretty
76
76
  end
77
77
  def CGI::escapeHTML(string)
78
- string.to_s.gsub(/&(?![^;]{2,6};)/, '&amp;').gsub(/\"/, '&quot;').gsub(/>/, '&gt;').gsub(/</, '&lt;')
78
+ s = string.to_s.frozen? ? string.to_s : string.to_s.force_encoding('UTF-8')
79
+ s.gsub(/&(?![^;]{2,6};)/, '&amp;').gsub(/\"/, '&quot;').gsub(/>/, '&gt;').gsub(/</, '&lt;')
79
80
  end
80
81
  end
data/lib/sbsm/index.rb CHANGED
@@ -32,15 +32,15 @@ module SBSM
32
32
  def delete(key, value)
33
33
  if (key.size == 0)
34
34
  @values.delete(value)
35
- elsif (child = @children.at(key[0]))
35
+ elsif (child = @children.at(key.chars.first.ord))
36
36
  child.delete(key[1..-1], value)
37
37
  end
38
38
  end
39
39
  def fetch(key)
40
40
  if(key.size == 1)
41
- @values + @children[key[0]].to_a
42
- elsif(key.size > 1 && @children.at(key[0]))
43
- @children.at(key[0])[key[1..-1]]
41
+ @values + @children[key.chars.first.ord].to_a
42
+ elsif(key.size > 1 && @children.at(key.chars.first.ord))
43
+ @children.at(key.chars.first.ord)[key[1..-1]]
44
44
  else
45
45
  []
46
46
  end
@@ -53,8 +53,8 @@ module SBSM
53
53
  if(key.size == 0)
54
54
  @values += values
55
55
  else
56
- @children[key[0]] ||= self.class.new
57
- @children.at(key[0]).store(key[1..-1], *values)
56
+ @children[key.chars.first.ord] ||= self.class.new
57
+ @children.at(key.chars.first.ord).store(key[1..-1], *values)
58
58
  end
59
59
  end
60
60
  def to_a
@@ -11,7 +11,8 @@ require 'yaml'
11
11
  module SBSM
12
12
  class AbstractTransHandler
13
13
  attr_reader :parser_name
14
- CONFIG_PATH = '../etc/trans_handler.yml'
14
+ CONFIG_PATH = '../etc/trans_handler.yml'
15
+
15
16
  @@empty_check ||= nil
16
17
  @@lang_check ||= nil
17
18
  @@uri_parser ||= nil
@@ -27,7 +28,7 @@ module SBSM
27
28
  def config(request)
28
29
  config = Hash.new { {} }
29
30
  begin
30
- path = File.expand_path(CONFIG_PATH, request.server.document_root.untaint)
31
+ path = File.expand_path(CONFIG_PATH.untaint, request.server.document_root.untaint)
31
32
  path.untaint
32
33
  config.update(YAML.load(File.read(path)))
33
34
  config
@@ -78,7 +79,7 @@ module SBSM
78
79
  ast.children_names.each { |name|
79
80
  case name
80
81
  when'language', 'flavor', 'event', 'zone'
81
- values.add(name, ast.send(name).value)
82
+ # values.add(name, ast.send(name).value)
82
83
  when 'variables'
83
84
  ast.variables.each { |pair|
84
85
  key = pair.key.value
@@ -133,16 +134,4 @@ module SBSM
133
134
  super('uri')
134
135
  end
135
136
  end
136
- class FlavoredTransHandler < AbstractTransHandler
137
- include Singleton
138
- def initialize
139
- super('flavored_uri')
140
- end
141
- end
142
- class ZoneTransHandler < AbstractTransHandler
143
- include Singleton
144
- def initialize
145
- super('zone_uri')
146
- end
147
- end
148
137
  end
@@ -0,0 +1,3 @@
1
+ module SBSM
2
+ VERSION = '1.2.7'
3
+ end
data/sbsm.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sbsm/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sbsm"
8
+ spec.version = SBSM::VERSION
9
+ spec.author = "Masaomi Hatakeyama, Zeno R.R. Davatz"
10
+ spec.email = "mhatakeyama@ywesee.com, zdavatz@ywesee.com"
11
+ spec.description = "Application framework for state based session management"
12
+ spec.summary = "Application framework for state based session management from ywesee"
13
+ spec.homepage = "https://github.com/zdavatz/sbsm"
14
+ spec.license = "GPL-v2"
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ # We fix the version of the spec to newer versions only in the third position
21
+ # hoping that these version fix only security/severe bugs
22
+ # Consulted the Gemfile.lock to get
23
+ spec.add_dependency 'rack'
24
+ spec.add_dependency 'mail'
25
+ spec.add_dependency 'hpricot'
26
+
27
+ spec.add_development_dependency "bundler"
28
+ spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "rspec"
30
+ spec.add_development_dependency "flexmock"
31
+ spec.add_development_dependency "minitest"
32
+ spec.add_development_dependency "rdoc"
33
+ spec.add_development_dependency "simplecov"
34
+ spec.add_development_dependency "watir"
35
+ spec.add_development_dependency "watir-webdriver"
36
+ # gem 'page-object'
37
+
38
+ end
39
+
data/test/suite.rb ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # TestSuite -- ydim -- 27.01.2005 -- hwyss@ywesee.com
3
+ require 'simplecov'
4
+
5
+ $: << File.dirname(File.expand_path(__FILE__))
6
+ SimpleCov.start
7
+
8
+ Dir.foreach(File.dirname(__FILE__)) do |file|
9
+ if /^test_.*\.rb$/o.match(file)
10
+ require file
11
+ end
12
+ end
@@ -27,10 +27,10 @@
27
27
  $: << File.dirname(__FILE__)
28
28
  $: << File.expand_path('../lib', File.dirname(__FILE__))
29
29
 
30
- require 'test/unit'
30
+ require 'minitest/autorun'
31
31
  require 'sbsm/drbserver'
32
32
 
33
- class TestDRbServer < Test::Unit::TestCase
33
+ class TestDRbServer < Minitest::Test
34
34
  class DRbServer < ::SBSM::DRbServer
35
35
  attr_reader :sessions
36
36
  CAP_MAX_THRESHOLD = 3
@@ -45,7 +45,7 @@ class TestDRbServer < Test::Unit::TestCase
45
45
  assert_equal({'test1'=>ses1}, @server.sessions)
46
46
  ses2 = @server['test2']
47
47
  assert_instance_of(SBSM::Session, ses2)
48
- assert_not_equal(ses1, ses2)
48
+ refute_equal(ses1, ses2)
49
49
  expected = {
50
50
  'test1' => ses1,
51
51
  'test2' => ses2,
@@ -53,8 +53,8 @@ class TestDRbServer < Test::Unit::TestCase
53
53
  assert_equal(expected, @server.sessions)
54
54
  ses3 = @server['test3']
55
55
  assert_instance_of(SBSM::Session, ses3)
56
- assert_not_equal(ses1, ses3)
57
- assert_not_equal(ses2, ses3)
56
+ refute_equal(ses1, ses3)
57
+ refute_equal(ses2, ses3)
58
58
  expected = {
59
59
  'test1' => ses1,
60
60
  'test2' => ses2,
@@ -63,8 +63,8 @@ class TestDRbServer < Test::Unit::TestCase
63
63
  assert_equal(expected, @server.sessions)
64
64
  ses4 = @server['test4']
65
65
  assert_instance_of(SBSM::Session, ses4)
66
- assert_not_equal(ses1, ses4)
67
- assert_not_equal(ses2, ses4)
66
+ refute_equal(ses1, ses4)
67
+ refute_equal(ses2, ses4)
68
68
  expected = {
69
69
  'test2' => ses2,
70
70
  'test3' => ses3,
data/test/test_index.rb CHANGED
@@ -21,72 +21,66 @@
21
21
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zürich, Switzerland
22
22
  # hwyss@ywesee.com
23
23
  #
24
- # TestIndex -- sbsm -- 04.03.2003 -- hwyss@ywesee.com
24
+ # TestIndex -- sbsm -- 04.03.2003 -- hwyss@ywesee.com
25
25
 
26
26
  $: << File.dirname(__FILE__)
27
27
  $: << File.expand_path("../lib", File.dirname(__FILE__))
28
28
 
29
- require 'test/unit'
29
+ require 'minitest/autorun'
30
30
  require 'sbsm/index'
31
31
 
32
32
  module SBSM
33
- class Index
34
- attr_accessor :values, :children
35
- end
33
+ class Index
34
+ attr_accessor :values, :children
35
+ end
36
36
  end
37
37
 
38
- class TestIndex < Test::Unit::TestCase
39
- def setup
40
- @index = SBSM::Index.new
41
- o2 = SBSM::Index.new
42
- o2.values = ['bar']
43
- o1 = SBSM::Index.new
44
- omit("Could not find any checkout which did not have: TypeError: can't convert String into Integer")
45
- o1.children[?o] = o2
46
- f = SBSM::Index.new
47
- f.children[?o] = o1
48
- r = SBSM::Index.new
49
- r.values = ['foo']
50
- a = SBSM::Index.new
51
- a.children[?r] = r
52
- b = SBSM::Index.new
53
- b.children[?a] = a
54
- @index.children[?b] = b
55
- @index.children[?f] = f
56
- end
57
- def test_to_a
58
- assert_equal(['foo', 'bar'], @index.to_a)
59
- end
60
- def test_fetch1
61
- assert_equal(['bar'], @index.fetch('foo'))
62
- end
63
- def test_fetch2
64
- assert_equal([], @index.fetch('Foo'))
65
- end
66
- def test_fetch3
67
- @index.store('bar', ['foobar', 'babar'])
68
- assert_equal(['foo', ['foobar', 'babar']], @index['ba'])
69
- end
70
- def test_store1
71
- @index.store('bar', 'babar')
72
- assert_equal(['foo', 'babar'], @index.children[?b].children[?a].children[?r].values)
73
- assert_equal(['foo', 'babar'], @index['ba'])
74
- end
75
- def test_store2
76
- @index.store('bar', 'foobar', 'babar')
77
- assert_equal(['foo', 'foobar', 'babar'], @index.children[?b].children[?a].children[?r].values)
78
- assert_equal(['foo', 'foobar', 'babar'], @index['ba'])
79
- end
80
- def test_store3
81
- @index.store('bar', ['foobar', 'babar'])
82
- assert_equal(['foo', ['foobar', 'babar']], @index.children[?b].children[?a].children[?r].values)
83
- end
84
- def test_replace
85
- @index.replace('foo', 'muh', 'bar')
86
- assert_equal(['bar'], @index.children[?m].children[?u].children[?h].values)
87
- end
88
- def test_delete
89
- @index.delete('foo', 'bar')
90
- assert_equal([], @index.children[?f].children[?o].children[?o].values)
91
- end
38
+ class TestIndex < Minitest::Test
39
+ def setup
40
+ @index = SBSM::Index.new
41
+ @index.store('foo', 'bar')
42
+ @index.store('bar', 'foo')
43
+ assert_equal(['bar'], @index['foo'])
44
+ assert_equal(['foo'], @index['bar'])
45
+ end
46
+ def test_to_a
47
+ assert_equal(['foo', 'bar'], @index.to_a)
48
+ end
49
+ def test_fetch1
50
+ assert_equal(['bar'], @index.fetch('foo'))
51
+ end
52
+ def test_fetch2
53
+ assert_equal([], @index.fetch('Foo'))
54
+ end
55
+ def test_fetch3
56
+ @index.store('bar', ['foobar', 'babar'])
57
+ assert_equal(['foo', ['foobar', 'babar']], @index['ba'])
58
+ end
59
+ def test_store1
60
+ # store(key, *values)
61
+ @index.store('bar', 'babar')
62
+ assert_equal(['foo', 'babar'], @index['bar'])
63
+ assert_equal(['foo', 'babar'], @index.children['b'.ord].children['a'.ord].children['r'.ord].values)
64
+ assert_equal(['foo', 'babar'], @index['ba'])
65
+ end
66
+ def test_store2
67
+ @index.store('bar', 'foobar', 'babar')
68
+ assert_equal(['foo', 'foobar', 'babar'], @index.children['b'.ord].children['a'.ord].children['r'.ord].values)
69
+ assert_equal(['foo', 'foobar', 'babar'], @index['ba'])
70
+ end
71
+ def test_store3
72
+ @index.store('bar', ['foobar', 'babar'])
73
+ assert_equal(['foo', ['foobar', 'babar']], @index.children['b'.ord].children['a'.ord].children['r'.ord].values)
74
+ end
75
+ def test_replace
76
+ # replace(oldkey, newkey, value)
77
+ @index.replace('foo', 'muh', 'bar')
78
+ assert_equal(['bar'], @index['muh'])
79
+ assert_equal(['bar'], @index.children['m'.ord].children['u'.ord].children['h'.ord].values)
80
+ end
81
+ def test_delete
82
+ @index.delete('foo', 'bar')
83
+ assert_equal([], @index.children['f'.ord].children['o'.ord].children['o'.ord].values)
84
+ assert_equal([], @index['foo'])
85
+ end
92
86
  end