police-dataflow 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ rescue Bundler::BundlerError => e
7
7
  $stderr.puts "Run `bundle install` to install missing gems"
8
8
  exit e.status_code
9
9
  end
10
- require 'minitest/unit'
10
+ require 'minitest/autorun'
11
11
  require 'minitest/spec'
12
12
 
13
13
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -20,4 +20,4 @@ end
20
20
  Dir[File.expand_path('helpers/**/*.rb', File.dirname(__FILE__))].
21
21
  each { |h| require h }
22
22
 
23
- MiniTest::Unit.autorun
23
+ MiniTest.autorun
@@ -0,0 +1,22 @@
1
+ # Label that tests the hook-based proxying implementation.
2
+ class HooksFlowFixture < Police::DataFlow::Label
3
+ def self.sticky?
4
+ false
5
+ end
6
+
7
+ def self.return_hook(method_name)
8
+ :generic_return_hook
9
+ end
10
+
11
+ def self.yield_args_hook(method_name)
12
+ :generic_yield_args_hook
13
+ end
14
+
15
+ def generic_return_hook(value, receiver, *args)
16
+ Police::DataFlow.label value, self
17
+ end
18
+
19
+ def generic_yield_args_hook(receiver, yield_args, *args)
20
+ yield_args.map! { |arg| Police::DataFlow.label arg, self }
21
+ end
22
+ end # class HooksFlowFixture
@@ -1,13 +1,13 @@
1
- # Label that tests the no-autoflow behavior.
1
+ # Label that tests the noop proxying implementation.
2
2
  class NoFlowFixture < Police::DataFlow::Label
3
- def self.autoflow?
3
+ def self.sticky?
4
4
  false
5
5
  end
6
-
6
+
7
7
  def self.return_hook(method_name)
8
8
  nil
9
9
  end
10
-
10
+
11
11
  def self.yield_args_hook(filter_name)
12
12
  nil
13
13
  end
@@ -1,23 +1,23 @@
1
1
  class ProxyingFixture
2
2
  # Zero arguments.
3
3
  def length; end
4
-
4
+
5
5
  # One argument.
6
6
  def ==(other)
7
7
  '== proxied'
8
8
  end
9
-
9
+
10
10
  # Reserved method proxying test.
11
11
  def !=(other)
12
12
  '!= proxied'
13
13
  end
14
-
14
+
15
15
  # Two arguments.
16
16
  def add(arg1, arg2)
17
17
  "#{arg1}, #{arg2}"
18
18
  end
19
19
  protected :add
20
-
20
+
21
21
  # Variable args.
22
22
  def route(*rest)
23
23
  if block_given?
@@ -33,11 +33,15 @@ class ProxyingFixture
33
33
  # Two fixed + variable args.
34
34
  def log(arg1, arg2, *rest); end
35
35
  private :log
36
-
36
+
37
37
  # Magic methods: magic_* methods return their name and args
38
- def method_missing(name, *args)
38
+ def method_missing(name, *args, &block)
39
39
  if name[0, 6] == 'magic_'
40
- [name[6..-1]] + args
40
+ if block
41
+ [name[6..-1], yield(*args)]
42
+ else
43
+ [name[6..-1]] + args
44
+ end
41
45
  else
42
46
  super
43
47
  end
@@ -0,0 +1,14 @@
1
+ # Label that tests autoflow proxying implementation.
2
+ class StickyFixture < Police::DataFlow::Label
3
+ def self.sticky?
4
+ true
5
+ end
6
+
7
+ def self.return_hook(method_name)
8
+ nil
9
+ end
10
+
11
+ def self.yield_args_hook(method_name)
12
+ nil
13
+ end
14
+ end # class StickyFixture
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: police-dataflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Victor Costan
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-03-28 00:00:00.000000000 Z
11
+ date: 2013-09-24 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Pure Ruby implementtion of data flow label propagation.
15
14
  email: victor@costan.us
@@ -29,48 +28,49 @@ files:
29
28
  - lib/police-dataflow.rb
30
29
  - lib/police/dataflow.rb
31
30
  - lib/police/dataflow/core_extensions.rb
32
- - lib/police/dataflow/guarding.rb
31
+ - lib/police/dataflow/gate_profiles/ruby1.9.3
32
+ - lib/police/dataflow/gating.rb
33
33
  - lib/police/dataflow/label.rb
34
34
  - lib/police/dataflow/labeling.rb
35
35
  - lib/police/dataflow/proxies.rb
36
36
  - lib/police/dataflow/proxy_base.rb
37
+ - lib/police/dataflow/proxy_numeric.rb
37
38
  - lib/police/dataflow/proxying.rb
38
39
  - police-dataflow.gemspec
40
+ - tasks/info.rake
39
41
  - test/dataflow/core_extensions_test.rb
40
42
  - test/dataflow/labeling_test.rb
41
43
  - test/dataflow/proxies_test.rb
42
44
  - test/dataflow/proxy_base_test.rb
45
+ - test/dataflow/proxy_numeric_test.rb
43
46
  - test/dataflow/proxying_test.rb
44
47
  - test/helper.rb
45
- - test/helpers/auto_flow_fixture.rb
48
+ - test/helpers/hooks_flow_fixture.rb
46
49
  - test/helpers/no_flow_fixture.rb
47
50
  - test/helpers/proxying_fixture.rb
51
+ - test/helpers/sticky_fixture.rb
48
52
  homepage: http://github.com/csail/police
49
53
  licenses:
50
54
  - MIT
55
+ metadata: {}
51
56
  post_install_message:
52
57
  rdoc_options: []
53
58
  require_paths:
54
59
  - lib
55
60
  required_ruby_version: !ruby/object:Gem::Requirement
56
- none: false
57
61
  requirements:
58
62
  - - ! '>='
59
63
  - !ruby/object:Gem::Version
60
64
  version: '0'
61
- segments:
62
- - 0
63
- hash: -2247175555396933840
64
65
  required_rubygems_version: !ruby/object:Gem::Requirement
65
- none: false
66
66
  requirements:
67
67
  - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  requirements: []
71
71
  rubyforge_project:
72
- rubygems_version: 1.8.21
72
+ rubygems_version: 2.0.7
73
73
  signing_key:
74
- specification_version: 3
74
+ specification_version: 4
75
75
  summary: Data flow label propagation
76
76
  test_files: []
@@ -1,16 +0,0 @@
1
- module Police
2
-
3
- module DataFlow
4
- # TODO(pwnall): spec
5
- def self.guard
6
-
7
- end
8
-
9
- # Guarding logic.
10
- module Guarding
11
-
12
- end # namespace Police::DataFlow::Guarding
13
-
14
- end # namespace Police::DataFlow
15
-
16
- end # namespace Police
@@ -1,6 +0,0 @@
1
- # Label that tests the autoflow behavior.
2
- class AutoFlowFixture < Police::DataFlow::Label
3
- def self.autoflow?
4
- true
5
- end
6
- end # class AutoFlowFixture