sfplanner 0.1.4 → 0.1.5

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.
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  *.gem
2
2
  *.swp
3
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+
3
+ gemfile:
4
+ - Gemfile
5
+
6
+ rvm:
7
+ - 1.9.2
8
+ - 1.9.3
9
+ - 2.0.0
10
+
11
+ notifications:
12
+ - email: false
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  SFPlanner
2
2
  =========
3
3
  - Author: Herry (herry13@gmail.com)
4
- - [Version](https://github.com/herry13/sfplanner/blob/master/VERSION)
5
4
  - License: [BSD](https://github.com/herry13/sfp-ruby/blob/master/LICENSE)
6
5
 
6
+ [![Build Status](https://travis-ci.org/herry13/sfplanner.png?branch=master)](https://travis-ci.org/herry13/sfplanner)
7
7
  [![Gem Version](https://badge.fury.io/rb/sfplanner.png)](http://badge.fury.io/rb/sfplanner)
8
8
 
9
9
  A Ruby script and library of SFP planner, which solves a planning task written in [SFP language](https://github.com/herry13/nuri/wiki/SFP-language).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ def sfplanner
2
+ File.dirname(__FILE__) + '/bin/sfplanner'
3
+ end
4
+
5
+ def testfiles
6
+ dir = File.dirname(__FILE__) + '/test'
7
+ File.read("#{dir}/files").split("\n").map { |x| "#{dir}/#{x}" }
8
+ end
9
+
10
+ task :default => :test
11
+
12
+ namespace :test do
13
+ testfiles.each do |file|
14
+ sh("#{sfplanner} #{file}")
15
+ end
16
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/sfplanner.gemspec CHANGED
@@ -17,5 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.homepage = 'https://github.com/herry13/sfplanner'
18
18
  s.rubyforge_project = 'sfplanner'
19
19
 
20
- s.add_dependency 'sfp', '~> 0.3.12'
20
+ s.add_dependency 'sfp', '~> 0.3.17'
21
+
22
+ s.add_development_dependency 'rake'
21
23
  end
data/test/files ADDED
@@ -0,0 +1,5 @@
1
+ test1.sfp
2
+ test2.sfp
3
+ test3.sfp
4
+ test4.sfp
5
+ test6.sfp
data/test/test1.inc ADDED
@@ -0,0 +1,9 @@
1
+ class S {
2
+ foo is true
3
+ procedure change {
4
+ conditions { }
5
+ effects {
6
+ this.foo is false
7
+ }
8
+ }
9
+ }
data/test/test1.sfp ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env sfp
2
+
3
+ include "test1.inc"
4
+
5
+ initial state {
6
+ a isa S
7
+ b isa S
8
+ }
9
+
10
+ goal constraint {
11
+ a.foo is false
12
+ b.foo is false
13
+ }
data/test/test2.sfp ADDED
@@ -0,0 +1,20 @@
1
+ schema S {
2
+ foo is true
3
+ procedure change {
4
+ conditions {
5
+ }
6
+ effects {
7
+ this.foo is false
8
+ }
9
+ }
10
+ }
11
+
12
+ initial state {
13
+ a isa S
14
+ b isa S
15
+ }
16
+
17
+ goal constraint {
18
+ a.foo is false
19
+ b.foo is false
20
+ }
data/test/test3.inc ADDED
@@ -0,0 +1,40 @@
1
+ class Service {
2
+ installed is false
3
+ running is false
4
+
5
+ procedure install {
6
+ conditions {
7
+ this.installed is false
8
+ }
9
+ effects {
10
+ this.installed is true
11
+ }
12
+ }
13
+ procedure uninstall {
14
+ conditions {
15
+ this.installed is true
16
+ }
17
+ effects {
18
+ this.installed is false
19
+ }
20
+ }
21
+
22
+ procedure start {
23
+ conditions {
24
+ this.installed is true
25
+ this.running is false
26
+ }
27
+ effects {
28
+ this.running is true
29
+ }
30
+ }
31
+ procedure stop {
32
+ conditions {
33
+ this.installed is true
34
+ this.running is true
35
+ }
36
+ effects {
37
+ this.running is false
38
+ }
39
+ }
40
+ }
data/test/test3.sfp ADDED
@@ -0,0 +1,17 @@
1
+ include "test3.inc"
2
+
3
+ // generate all possible states with constraint solver
4
+ initial state {
5
+ s1 isa Service
6
+ s2 isa Service
7
+ s3 isa Service
8
+ }
9
+ goal constraint {
10
+ s1.running
11
+ s2.running
12
+ s3.running
13
+ }
14
+ global constraint {
15
+ if s1.running then s2.running
16
+ if s2.running then s3.running
17
+ }
data/test/test4.inc ADDED
@@ -0,0 +1,28 @@
1
+ schema Service {
2
+ running is false
3
+ procedure start {
4
+ conditions {
5
+ this.running is false
6
+ }
7
+ effects {
8
+ this.running is true
9
+ }
10
+ }
11
+ procedure stop {
12
+ conditions {
13
+ this.running is true
14
+ }
15
+ effects {
16
+ this.running is false
17
+ }
18
+ }
19
+ }
20
+ schema Client {
21
+ refer isref Service
22
+ procedure redirect(s isref Service) {
23
+ conditions { }
24
+ effects {
25
+ this.refer is s
26
+ }
27
+ }
28
+ }
data/test/test4.sfp ADDED
@@ -0,0 +1,22 @@
1
+ include "test4.inc"
2
+
3
+ initial state {
4
+ a isa Service {
5
+ running is true
6
+ }
7
+
8
+ b isa Service // with "running" is false
9
+
10
+ pc isa Client {
11
+ refer is a
12
+ }
13
+ }
14
+
15
+ goal constraint {
16
+ pc.refer is b
17
+ a.running is false
18
+ }
19
+
20
+ global constraint {
21
+ pc.refer.running is true
22
+ }
data/test/test6.inc ADDED
@@ -0,0 +1,9 @@
1
+ schema Service
2
+ schema Client {
3
+ refer isref Service
4
+ sub redirect ( s: Service) {
5
+ effect {
6
+ this.refer = s
7
+ }
8
+ }
9
+ }
data/test/test6.sfp ADDED
@@ -0,0 +1,12 @@
1
+ include "test6.inc"
2
+
3
+ initial state {
4
+ s1 isa Service
5
+ s2 isa Service
6
+ pc isa Client {
7
+ refer is s1
8
+ }
9
+ }
10
+ goal constraint {
11
+ pc.refer is s2
12
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfplanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,15 +13,26 @@ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sfp
16
- requirement: &16262980 !ruby/object:Gem::Requirement
16
+ requirement: &18815260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.3.12
21
+ version: 0.3.17
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16262980
24
+ version_requirements: *18815260
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &18814780 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *18814780
25
36
  description: A Ruby gem that provides a Ruby API and a script to the SFP planner.
26
37
  This planner can automatically generate a plan that solves a planning problem written
27
38
  in SFP language.
@@ -33,8 +44,11 @@ extensions: []
33
44
  extra_rdoc_files: []
34
45
  files:
35
46
  - .gitignore
47
+ - .travis.yml
48
+ - Gemfile
36
49
  - LICENSE
37
50
  - README.md
51
+ - Rakefile
38
52
  - VERSION
39
53
  - bin/sfplanner
40
54
  - bin/sfw2graph
@@ -47,6 +61,16 @@ files:
47
61
  - lib/sfplanner/planner.rb
48
62
  - lib/sfplanner/sas.rb
49
63
  - sfplanner.gemspec
64
+ - test/files
65
+ - test/test1.inc
66
+ - test/test1.sfp
67
+ - test/test2.sfp
68
+ - test/test3.inc
69
+ - test/test3.sfp
70
+ - test/test4.inc
71
+ - test/test4.sfp
72
+ - test/test6.inc
73
+ - test/test6.sfp
50
74
  homepage: https://github.com/herry13/sfplanner
51
75
  licenses:
52
76
  - BSD