aws-flow-core 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ ##
2
+ # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License").
5
+ # You may not use this file except in compliance with the License.
6
+ # A copy of the License is located at
7
+ #
8
+ # http://aws.amazon.com/apache2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is distributed
11
+ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
+ # express or implied. See the License for the specific language governing
13
+ # permissions and limitations under the License.
14
+ ##
15
+
16
+ #!/usr/bin/ruby -wKU
17
+
18
+ def require_all(path)
19
+ Dir[File.join(File.dirname(__FILE__), path, "*.rb")].each {|f| require f}
20
+ end
21
+
22
+ require_all('rubyflow/')
@@ -0,0 +1,63 @@
1
+ ##
2
+ # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License").
5
+ # You may not use this file except in compliance with the License.
6
+ # A copy of the License is located at
7
+ #
8
+ # http://aws.amazon.com/apache2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is distributed
11
+ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
+ # express or implied. See the License for the specific language governing
13
+ # permissions and limitations under the License.
14
+ ##
15
+
16
+ describe SimpleDFA do
17
+ before(:each) do
18
+ class Tester
19
+ attr_accessor :trace
20
+
21
+ extend SimpleDFA
22
+ init(:start_state)
23
+
24
+ def initialize
25
+ @trace = []
26
+ end
27
+
28
+ add_transition(:start_state, :a) do |t|
29
+ t.trace << :start_to_second
30
+ t.current_state = :second_state
31
+ end
32
+ add_transition(:second_state, :b) do |t|
33
+ t.trace << :second_to_third
34
+ t.current_state = :third_state
35
+ end
36
+ add_transition(:third_state, :c) do |t|
37
+ t.trace << :third_to_start
38
+ t.current_state = :start_state
39
+ end
40
+ end
41
+ @this_dfa = Tester.new
42
+
43
+ end
44
+
45
+ it "ensures that consume works as expected" do
46
+ @this_dfa.consume(:a)
47
+ @this_dfa.trace.should == [:start_to_second]
48
+ @this_dfa.current_state.should == :second_state
49
+ end
50
+
51
+ it "ensures that define_general defines general transitions for a state" do
52
+ class Tester
53
+ define_general(:start_state) {|t| t.current_state = :new_state }
54
+ end
55
+ @this_dfa.consume(:c)
56
+ @this_dfa.current_state.should == :new_state
57
+ end
58
+
59
+ it "ensures that uncovered_transitions raises on those transitions" do
60
+ expect { @this_dfa.consume(:b) }.to raise_error
61
+ end
62
+
63
+ end
@@ -0,0 +1,36 @@
1
+ ##
2
+ # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License").
5
+ # You may not use this file except in compliance with the License.
6
+ # A copy of the License is located at
7
+ #
8
+ # http://aws.amazon.com/apache2.0
9
+ #
10
+ # or in the "license" file accompanying this file. This file is distributed
11
+ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
+ # express or implied. See the License for the specific language governing
13
+ # permissions and limitations under the License.
14
+ ##
15
+
16
+ require 'rubygems'
17
+
18
+ require 'aws/flow'
19
+
20
+ include AWS::Flow::Core
21
+
22
+ Spec::DSL::Main.class_eval do
23
+ if method_defined? :context
24
+ undef :context
25
+ end
26
+ end
27
+
28
+ def constantize(camel_case_word)
29
+ names = camel_case_word.split('::')
30
+ names.shift if names.empty? || names.first.empty?
31
+ constant = Object
32
+ names.each do |name|
33
+ constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
34
+ end
35
+ constant
36
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws-flow-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael Steger
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-01 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Library to provide all the base asynchronous constructs that aws-flow
15
+ uses
16
+ email: ''
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - Gemfile
22
+ - LICENSE.TXT
23
+ - NOTICE.TXT
24
+ - Rakefile
25
+ - aws-flow-core.gemspec
26
+ - lib/aws/flow.rb
27
+ - lib/aws/flow/async_backtrace.rb
28
+ - lib/aws/flow/async_scope.rb
29
+ - lib/aws/flow/begin_rescue_ensure.rb
30
+ - lib/aws/flow/fiber.rb
31
+ - lib/aws/flow/flow_utils.rb
32
+ - lib/aws/flow/future.rb
33
+ - lib/aws/flow/implementation.rb
34
+ - lib/aws/flow/simple_dfa.rb
35
+ - lib/aws/flow/tasks.rb
36
+ - test/aws/async_backtrace_spec.rb
37
+ - test/aws/async_scope_spec.rb
38
+ - test/aws/begin_rescue_ensure_spec.rb
39
+ - test/aws/external_task_spec.rb
40
+ - test/aws/factories.rb
41
+ - test/aws/fiber_condition_variable_spec.rb
42
+ - test/aws/fiber_spec.rb
43
+ - test/aws/flow_spec.rb
44
+ - test/aws/future_spec.rb
45
+ - test/aws/rubyflow.rb
46
+ - test/aws/simple_dfa_spec.rb
47
+ - test/aws/spec_helper.rb
48
+ homepage:
49
+ licenses: []
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ - lib/aws/
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 1.8.25
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: AWS Flow Core
73
+ test_files:
74
+ - test/aws/async_backtrace_spec.rb
75
+ - test/aws/async_scope_spec.rb
76
+ - test/aws/begin_rescue_ensure_spec.rb
77
+ - test/aws/external_task_spec.rb
78
+ - test/aws/factories.rb
79
+ - test/aws/fiber_condition_variable_spec.rb
80
+ - test/aws/fiber_spec.rb
81
+ - test/aws/flow_spec.rb
82
+ - test/aws/future_spec.rb
83
+ - test/aws/rubyflow.rb
84
+ - test/aws/simple_dfa_spec.rb
85
+ - test/aws/spec_helper.rb