pione 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/.gitignore +0 -1
  2. data/.travis.yml +3 -0
  3. data/History.txt +15 -0
  4. data/Rakefile +4 -0
  5. data/doc/man/pione-action-list.md +23 -0
  6. data/doc/man/pione-action.md +37 -0
  7. data/doc/man/pione-clean.md +56 -0
  8. data/doc/man/pione-compiler.md +39 -0
  9. data/doc/man/pione-update-package-info.md +38 -0
  10. data/example/DeferredChoice/DeferredChoice.pione +6 -4
  11. data/example/DeferredChoice/pione-package.json +15 -0
  12. data/example/FeatureExample/FeatureExample.pione +2 -0
  13. data/example/FeatureExample/pione-package.json +15 -0
  14. data/example/LoopByTouch/LoopByTouch.pione +2 -0
  15. data/example/LoopByTouch/pione-package.json +18 -0
  16. data/example/LucasNumber/LucasNumber.pione +6 -4
  17. data/example/LucasNumber/pione-package.json +15 -0
  18. data/example/MakePair/MakePair.pione +2 -0
  19. data/example/MakePair/pione-package.json +17 -0
  20. data/example/MakePair/scenario/case1/Scenario.pione +1 -0
  21. data/example/MakePair/scenario/case1/pione-scenario.json +47 -0
  22. data/example/MakePair/scenario/case2/Scenario.pione +1 -0
  23. data/example/MakePair/scenario/case2/pione-scenario.json +22 -0
  24. data/example/MakePair/scenario/case3/Scenario.pione +1 -0
  25. data/example/MakePair/scenario/case3/pione-scenario.json +43 -0
  26. data/example/OddSelector/OddSelector.pione +2 -0
  27. data/example/OddSelector/pione-package.json +15 -0
  28. data/example/OddSelector/scenario/Scenario.pione +1 -0
  29. data/example/OddSelector/{data → scenario/input}/1.i +0 -0
  30. data/example/OddSelector/{data → scenario/input}/10.i +0 -0
  31. data/example/OddSelector/{data → scenario/input}/2.i +0 -0
  32. data/example/OddSelector/{data → scenario/input}/3.i +0 -0
  33. data/example/OddSelector/{data → scenario/input}/4.i +0 -0
  34. data/example/OddSelector/{data → scenario/input}/5.i +0 -0
  35. data/example/OddSelector/{data → scenario/input}/6.i +0 -0
  36. data/example/OddSelector/{data → scenario/input}/7.i +0 -0
  37. data/example/OddSelector/{data → scenario/input}/8.i +0 -0
  38. data/example/OddSelector/{data → scenario/input}/9.i +0 -0
  39. data/example/OddSelector/scenario/output/1.res +0 -0
  40. data/example/OddSelector/scenario/output/3.res +0 -0
  41. data/example/OddSelector/scenario/output/5.res +0 -0
  42. data/example/OddSelector/scenario/output/7.res +0 -0
  43. data/example/OddSelector/scenario/output/9.res +0 -0
  44. data/example/OddSelector/scenario/pione-scenario.json +23 -0
  45. data/example/PegasusWMS/Merge/Merge.pione +3 -1
  46. data/example/PegasusWMS/Merge/pione-package.json +15 -0
  47. data/example/PegasusWMS/Pipeline/Pipeline.pione +2 -0
  48. data/example/PegasusWMS/Pipeline/pione-package.json +15 -0
  49. data/example/PegasusWMS/Split/Split.pione +2 -0
  50. data/example/PegasusWMS/Split/pione-package.json +15 -0
  51. data/example/{AbstractRule/AbstractRule.pione → SelectRuleByParam/SelectRuleByParam.pione} +4 -2
  52. data/example/SelectRuleByParam/pione-package.json +17 -0
  53. data/example/SelectRuleByParam/scenario/a/Scenario.pione +2 -0
  54. data/example/{AbstractRule → SelectRuleByParam}/scenario/a/output/message.txt +0 -0
  55. data/example/SelectRuleByParam/scenario/a/pione-scenario.json +10 -0
  56. data/example/SelectRuleByParam/scenario/b/Scenario.pione +2 -0
  57. data/example/{AbstractRule → SelectRuleByParam}/scenario/b/output/message.txt +0 -0
  58. data/example/SelectRuleByParam/scenario/b/pione-scenario.json +10 -0
  59. data/example/SelectRuleByParam/scenario/c/Scenario.pione +2 -0
  60. data/example/{AbstractRule → SelectRuleByParam}/scenario/c/output/message.txt +0 -0
  61. data/example/SelectRuleByParam/scenario/c/pione-scenario.json +10 -0
  62. data/example/Sum/Sum.pione +23 -21
  63. data/example/Sum/pione-package.json +15 -0
  64. data/example/Sum/scenario/Scenario.pione +1 -0
  65. data/example/Sum/{input → scenario/input}/list.txt +0 -0
  66. data/example/Sum/scenario/output/sum.txt +6 -0
  67. data/example/Sum/scenario/pione-scenario.json +10 -0
  68. data/lib/pione/agent/agent-exception.rb +11 -0
  69. data/lib/pione/agent/process-manager.rb +19 -7
  70. data/lib/pione/agent/task-worker.rb +2 -2
  71. data/lib/pione/command/option.rb +0 -1
  72. data/lib/pione/command/pione-action-list.rb +49 -0
  73. data/lib/pione/command/pione-action.rb +83 -0
  74. data/lib/pione/command/pione-client.rb +34 -10
  75. data/lib/pione/command/pione-compiler.rb +19 -1
  76. data/lib/pione/command/pione-package.rb +2 -0
  77. data/lib/pione/command/pione-task-worker.rb +3 -1
  78. data/lib/pione/command/pione-update-package-info.rb +53 -0
  79. data/lib/pione/command.rb +6 -4
  80. data/lib/pione/global/tuple-space-notifier-variable.rb +1 -1
  81. data/lib/pione/lang/environment.rb +47 -16
  82. data/lib/pione/lang/parameters.rb +6 -0
  83. data/lib/pione/literate-action/document.rb +25 -0
  84. data/lib/pione/literate-action/handler.rb +24 -0
  85. data/lib/pione/literate-action/parser.rb +54 -0
  86. data/lib/pione/literate-action.rb +10 -0
  87. data/lib/pione/location/data-location.rb +11 -3
  88. data/lib/pione/location/dropbox-location.rb +2 -0
  89. data/lib/pione/location/local-location.rb +4 -0
  90. data/lib/pione/package/package-exception.rb +17 -1
  91. data/lib/pione/package/package-handler.rb +13 -4
  92. data/lib/pione/package/scenario-handler.rb +9 -3
  93. data/lib/pione/package/scenario-info.rb +4 -3
  94. data/lib/pione/package/scenario-scanner.rb +11 -7
  95. data/lib/pione/rule-engine/basic-handler.rb +1 -1
  96. data/lib/pione/rule-engine/flow-handler.rb +6 -5
  97. data/lib/pione/test-helper/command-helper.rb +44 -1
  98. data/lib/pione/test-helper/internet-connectivity.rb +10 -0
  99. data/lib/pione/test-helper.rb +11 -10
  100. data/lib/pione/util/digest.rb +1 -1
  101. data/lib/pione/util/id.rb +1 -1
  102. data/lib/pione/util/indentation.rb +1 -1
  103. data/lib/pione/util/last-time.rb +20 -0
  104. data/lib/pione/util/misc.rb +7 -1
  105. data/lib/pione/util/pnml-compiler.rb +84 -13
  106. data/lib/pione/util.rb +1 -0
  107. data/lib/pione/version.rb +1 -1
  108. data/lib/pione.rb +17 -15
  109. data/man/pione-action-list.1 +23 -0
  110. data/man/pione-action.1 +45 -0
  111. data/man/pione-compiler.1 +48 -0
  112. data/man/pione-update-package-info.1 +43 -0
  113. data/pione.gemspec +1 -0
  114. data/test/command/spec_pione-action-list.rb +15 -0
  115. data/test/command/spec_pione-action.rb +24 -0
  116. data/test/command/spec_pione-client.rb +189 -0
  117. data/test/command/spec_pione-compiler.rb +28 -1
  118. data/test/command/spec_pione-update-package-info.rb +66 -0
  119. data/test/lang/data/literal-parser.yml +1 -0
  120. data/test/lang/spec_environment.rb +19 -0
  121. data/test/literate-action/data/D1.md +25 -0
  122. data/test/literate-action/data/HelloWorld.md +11 -0
  123. data/test/literate-action/spec_document.rb +20 -0
  124. data/test/literate-action/spec_handler.rb +28 -0
  125. data/test/literate-action/spec_parser.rb +51 -0
  126. data/test/package/spec_scenario-info.rb +2 -2
  127. data/test/package/spec_scenario-scanner.rb +3 -3
  128. data/test/util/data/pnml/Sequence.pnml +135 -135
  129. data/test/util/spec_pnml-compiler.rb +20 -9
  130. metadata +102 -39
  131. data/example/AbstractRule/package.yml +0 -7
  132. data/example/AbstractRule/scenario/a/scenario.yml +0 -4
  133. data/example/AbstractRule/scenario/b/scenario.yml +0 -4
  134. data/example/AbstractRule/scenario/c/scenario.yml +0 -4
  135. data/example/HelloWorld/package.yml +0 -6
  136. data/example/HelloWorld/scenario/scenario.yml +0 -3
  137. data/example/MakePair/package.yml +0 -8
  138. data/example/MakePair/scenario/case1/scenario.yml +0 -42
  139. data/example/MakePair/scenario/case2/scenario.yml +0 -17
  140. data/example/MakePair/scenario/case3/scenario.yml +0 -39
  141. data/example/PegasusWMS/Merge/package.yml +0 -2
  142. data/example/PegasusWMS/Pipeline/package.yml +0 -2
  143. data/example/PegasusWMS/Split/package.yml +0 -2
  144. data/example/SyntaxError/call_rule_error.pione +0 -6
  145. data/example/SyntaxError/feature_line_error.pione +0 -7
  146. data/example/SyntaxError/flow_block_error.pione +0 -5
  147. data/example/SyntaxError/input_line_error.pione +0 -6
  148. data/example/SyntaxError/invalid_rule_name.pione +0 -6
  149. data/example/SyntaxError/output_line_error.pione +0 -6
  150. data/example/SyntaxError/param_line_error.pione +0 -7
  151. data/example/SyntaxError/variable-binding-error.pione +0 -11
@@ -12,7 +12,7 @@ module Pione
12
12
  def self.cut(text)
13
13
  line = text.lines.to_a.first
14
14
  n = line.length - line.lstrip.length
15
- n > 0 ? text.gsub(/^\s{0,#{n}}/m, "") : text
15
+ n > 0 ? text.gsub(/^[ ]{0,#{n}}/m, "") : text
16
16
  end
17
17
  end
18
18
  end
@@ -0,0 +1,20 @@
1
+ module Pione
2
+ module Util
3
+ module LastTime
4
+ # Return last time of data locations. The criteria of last time is
5
+ # location's mtime and ctime.
6
+ def self.get(locations)
7
+ locations.inject(nil) do |last_time, location|
8
+ mtime = location.mtime # mtime should be supported
9
+ ctime = location.ctime rescue nil # ctime may be not supported
10
+
11
+ # get newer time
12
+ this_time = [mtime, ctime].max
13
+
14
+ # compare
15
+ (last_time.nil? or last_time < this_time) ? this_time : last_time
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -34,9 +34,15 @@ module Pione
34
34
 
35
35
  def parse_features(textual_features)
36
36
  stree = Lang::DocumentParser.new.expr.parse(textual_features)
37
- opt = {package_name: "*feature*", filename: "*feature*"}
37
+ opt = {package_name: "*Feature*", filename: "*Feature*"}
38
38
  Lang::DocumentTransformer.new.apply(stree, opt)
39
39
  end
40
+
41
+ def parse_param_set(textual_param_set)
42
+ stree = Lang::DocumentParser.new.parameter_set.parse(textual_param_set)
43
+ opt = {package_name: "*ParamSet*", filename: "*ParamSet*"}
44
+ params = Lang::DocumentTransformer.new.apply(stree, opt)
45
+ end
40
46
  end
41
47
 
42
48
  extend Misc
@@ -1,8 +1,11 @@
1
1
  module Pione
2
2
  module Util
3
3
  class PNMLCompiler
4
- def initialize(src)
4
+ def initialize(src, name, editor, tag)
5
5
  @src = src
6
+ @name = name
7
+ @editor = editor
8
+ @tag = tag
6
9
  end
7
10
 
8
11
  # Compile PNML file into PIONE document as a string.
@@ -12,8 +15,18 @@ module Pione
12
15
  io_table = make_io_table(doc)
13
16
  input_table = make_input_table(doc, rule_table, io_table)
14
17
  output_table = make_output_table(doc, rule_table, io_table)
15
- rules = make_flow_rules(rule_table, input_table, output_table)
16
- return textize_flow_rules(rules)
18
+
19
+ annotations = []
20
+ if @name
21
+ annotations << ".@ PackageName :: \"%s\"" % @name
22
+ annotations << ".@ Editor :: \"%s\"" % @editor if @editor
23
+ annotations << ".@ Tag :: \"%s\"" % @tag if @tag
24
+ end
25
+
26
+ main_rule = textize_main_rule(*make_main_rule(rule_table, input_table, output_table))
27
+ other_rules = textize_flow_rules(make_flow_rules(rule_table, input_table, output_table))
28
+
29
+ [*annotations, "", main_rule, *other_rules].join("\n")
17
30
  end
18
31
 
19
32
  private
@@ -22,8 +35,11 @@ module Pione
22
35
  def make_rule_table(doc)
23
36
  rule_table = Hash.new
24
37
  REXML::XPath.each(doc, "/pnml/net/transition") do |elt|
38
+ # transition id
25
39
  id = elt.attribute("id").value
40
+ # transition name
26
41
  name = REXML::XPath.first(elt, "name/text").texts.map{|text| text.value}.join("")
42
+ # rule table (id -> name)
27
43
  rule_table[id] = name
28
44
  end
29
45
  return rule_table
@@ -33,8 +49,11 @@ module Pione
33
49
  def make_io_table(doc)
34
50
  io_table = Hash.new {|h, k| h[k] = []}
35
51
  REXML::XPath.each(doc, "/pnml/net/place") do |elt|
52
+ # place id
36
53
  id = elt.attribute("id").value
54
+ # place name
37
55
  name = REXML::XPath.first(elt, "name/text").texts.map{|text| text.value}.join("")
56
+ # palce table (id -> names)
38
57
  io_table[id] << name
39
58
  end
40
59
  return io_table
@@ -44,10 +63,12 @@ module Pione
44
63
  def make_input_table(doc, rule_table, io_table)
45
64
  input_table = Hash.new {|h, k| h[k] = []}
46
65
  REXML::XPath.each(doc, "/pnml/net/arc") do |elt|
47
- source = elt.attribute("source").value
48
- target = elt.attribute("target").value
49
- name = REXML::XPath.first(elt, "inscription/text").texts.map{|text| text.value}.join("")
50
- input_table[rule_table[target]] << io_table[source]
66
+ source = elt.attribute("source").value # source place(data) id
67
+ target = elt.attribute("target").value # target transition(rule) id
68
+ if rule_table.has_key?(target)
69
+ name = REXML::XPath.first(elt, "inscription/text").texts.map{|text| text.value}.join("")
70
+ input_table[rule_table[target]] += io_table[source]
71
+ end
51
72
  end
52
73
  return input_table
53
74
  end
@@ -59,11 +80,54 @@ module Pione
59
80
  source = elt.attribute("source").value
60
81
  target = elt.attribute("target").value
61
82
  name = REXML::XPath.first(elt, "inscription/text").texts.map{|text| text.value}.join("")
62
- output_table[rule_table[source]] << io_table[target]
83
+ output_table[rule_table[source]] += io_table[target]
63
84
  end
64
85
  return output_table
65
86
  end
66
87
 
88
+ # Make a main rule.
89
+ def make_main_rule(rule_table, input_table, output_table)
90
+ inputs = find_main_inputs(input_table, output_table)
91
+ outputs = find_main_outputs(output_table)
92
+ constituents = find_constituents(rule_table)
93
+ return [inputs, outputs, constituents]
94
+ end
95
+
96
+ def find_main_inputs(input_table, output_table)
97
+ input_table.values.each_with_object([]) do |names, main_inputs|
98
+ inputs = names.select do |name|
99
+ not(output_table.values.flatten.include?(name))
100
+ end
101
+ main_inputs.concat(inputs)
102
+ end
103
+ end
104
+
105
+ def find_main_outputs(output_table)
106
+ output_table.values.each_with_object([]) do |names, main_outputs|
107
+ main_outputs.concat(names.select{|name| main_output?(name)})
108
+ end
109
+ end
110
+
111
+ def find_constituents(rule_table)
112
+ rule_table.values.compact.sort
113
+ end
114
+
115
+ MAIN_RULE_TEMPLATE = <<-RULE
116
+ Rule Main
117
+ %s
118
+ Flow
119
+ %s
120
+ End
121
+ RULE
122
+
123
+ def textize_main_rule(inputs, outputs, constituents)
124
+ i = inputs.map {|name| "input %s" % normalize_data_name(name)}
125
+ o = outputs.map {|name| "output %s" % normalize_data_name(name)}
126
+ conds = (i + o).join("\n ")
127
+ rules = constituents.map {|c| "rule %s" % c}.join("\n ")
128
+ Indentation.cut(MAIN_RULE_TEMPLATE) % [conds, rules]
129
+ end
130
+
67
131
  # Make flow rules from rule table, input table, and output table.
68
132
  def make_flow_rules(rule_table, input_table, output_table)
69
133
  rules = Array.new
@@ -79,18 +143,25 @@ module Pione
79
143
  Rule %s
80
144
  %s
81
145
  %s
82
- Action
83
- cp {$I[1]} {$O[1]}
84
146
  End
85
147
  RULE
86
148
 
87
149
  # Textize flow rules.
88
150
  def textize_flow_rules(rules)
89
151
  rules.map do |rule|
90
- inputs = rule[1].map {|name| "input '%s'" % name}.join("\n ")
91
- outputs = rule[2].map {|name| "output '%s'" % name}.join("\n ")
152
+ inputs = rule[1].map {|name| "input %s" % normalize_data_name(name)}.join("\n ")
153
+ outputs = rule[2].map {|name| "output %s.touch" % normalize_data_name(name)}.join("\n ")
92
154
  Indentation.cut(FLOW_RULE_TEMPLATE) % [rule[0], inputs, outputs]
93
- end.join("\n\n")
155
+ end
156
+ end
157
+
158
+ def main_output?(name)
159
+ name[0] == ">"
160
+ end
161
+
162
+ # Normalize the data name.
163
+ def normalize_data_name(name)
164
+ main_output?(name) ? name[1..-1] : name
94
165
  end
95
166
  end
96
167
  end
data/lib/pione/util.rb CHANGED
@@ -24,4 +24,5 @@ require 'pione/util/embeded-expr-expander' # expand text embeded PIONE express
24
24
  require 'pione/util/free-thread-generator' # generate threads free from thread group
25
25
  require 'pione/util/parslet-extension' # parslet extension
26
26
  require 'pione/util/pnml-compiler' # toy compiler from PNML to PIONE
27
+ require 'pione/util/last-time' # get last time of locations
27
28
 
data/lib/pione/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Pione
2
2
  # version of pione
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
data/lib/pione.rb CHANGED
@@ -70,6 +70,7 @@ require 'zip/filesystem'
70
70
  require 'retriable'
71
71
  require 'childprocess'
72
72
  require 'lettercase/core_ext'
73
+ require 'kramdown'
73
74
 
74
75
  # configuration for childprcess
75
76
  ChildProcess.posix_spawn = true
@@ -78,21 +79,22 @@ ChildProcess.posix_spawn = true
78
79
  # load pione
79
80
  #
80
81
 
81
- require 'pione/version' # PIONE version information
82
- require 'pione/util' # various helper functions
83
- require 'pione/patch' # patches for libraries
84
- require 'pione/location' # location system for data and package
85
- require 'pione/log' # log and format
86
- require 'pione/global' # global variable manager
87
- require 'pione/system' # PIONE system functions
88
- require 'pione/relay' # relay connection
89
- require 'pione/package' # package system
90
- require 'pione/lang' # PIONE languge
91
- require 'pione/tuple-space' # tuple space functions
92
- require 'pione/rule-engine' # rule processing behaviors
93
- require 'pione/agent' # agent system
94
- require 'pione/front' # command front interface
95
- require 'pione/command' # command definitions
82
+ require 'pione/version' # PIONE version information
83
+ require 'pione/util' # various helper functions
84
+ require 'pione/patch' # patches for libraries
85
+ require 'pione/location' # location system for data and package
86
+ require 'pione/log' # log and format
87
+ require 'pione/global' # global variable manager
88
+ require 'pione/system' # PIONE system functions
89
+ require 'pione/relay' # relay connection
90
+ require 'pione/package' # package system
91
+ require 'pione/lang' # PIONE languge
92
+ require 'pione/tuple-space' # tuple space functions
93
+ require 'pione/rule-engine' # rule processing behaviors
94
+ require 'pione/agent' # agent system
95
+ require 'pione/front' # command front interface
96
+ require 'pione/command' # command definitions
97
+ require 'pione/literate-action' # literate action
96
98
 
97
99
  #
98
100
  # other settings
@@ -0,0 +1,23 @@
1
+ .TH pione\-action\-list 1 "" "PIONE User Manual"
2
+ .SH NAME
3
+ .PP
4
+ pione\-action\-list \- execute an action in literate action document.
5
+ .SH SYNOPSIS
6
+ .PP
7
+ \f[B]pione action:list\f[] [options] location
8
+ .SH DESCRIPTION
9
+ .PP
10
+ \f[B]action:list\f[] command lists action names in literate action
11
+ document.
12
+ .SH EXAMPLES
13
+ .TP
14
+ .B pione action:list HelloWorld.md
15
+ List all action names of \f[C]HelloWorld.md\f[].
16
+ .RS
17
+ .RE
18
+ .SH REPORTING BUGS
19
+ .PP
20
+ Report bugs or feature requests to PIONE\[aq]s issue
21
+ tracker(https://github.com/pione/pione/issues).
22
+ .SH AUTHORS
23
+ Keita Yamaguchi.
@@ -0,0 +1,45 @@
1
+ .TH pione\-action 1 "" "PIONE User Manual"
2
+ .SH NAME
3
+ .PP
4
+ pione\-action \- execute an action in literate action document.
5
+ .SH SYNOPSIS
6
+ .PP
7
+ \f[B]pione action\f[] [options] location action_name
8
+ .SH DESCRIPTION
9
+ .PP
10
+ \f[B]action\f[] command execute or show an action in literate action
11
+ document.
12
+ .SH OPTIONS
13
+ .TP
14
+ .B \-\-show
15
+ Show an action instead of execution.
16
+ .RS
17
+ .RE
18
+ .TP
19
+ .B \-d, \-\-directory PATH
20
+ Execute an action in the directory.
21
+ .RS
22
+ .RE
23
+ .SH EXAMPLES
24
+ .TP
25
+ .B pione action HelloWorld.md SayHello
26
+ Execute \f[C]SayHello\f[] action of \f[C]HelloWorld.md\f[] in current
27
+ directory.
28
+ .RS
29
+ .RE
30
+ .TP
31
+ .B pione action \-d /tmp HelloWorld.md SayHello
32
+ Execute \f[C]SayHello\f[] action of \f[C]HelloWorld.md\f[] in /tmp.
33
+ .RS
34
+ .RE
35
+ .TP
36
+ .B pione action HelloWorld.md SayHello \-\-show
37
+ Show \f[C]SayHello\f[] action of \f[C]HelloWorld.md\f[].
38
+ .RS
39
+ .RE
40
+ .SH REPORTING BUGS
41
+ .PP
42
+ Report bugs or feature requests to PIONE\[aq]s issue
43
+ tracker(https://github.com/pione/pione/issues).
44
+ .SH AUTHORS
45
+ Keita Yamaguchi.
@@ -0,0 +1,48 @@
1
+ .TH pione\-compiler 1 "" "PIONE User Manual"
2
+ .SH NAME
3
+ .PP
4
+ pione\-compiler \- compile to PIONE file.
5
+ .SH SYNOPSIS
6
+ .PP
7
+ \f[B]pione\-compiler\f[] [options] file
8
+ .SH DESCRIPTION
9
+ .PP
10
+ pione\-compiler compiles from PNML(Petri Net Markup Language) to PIONE
11
+ document.
12
+ Source PNML file should be written in a manner of PIONE\[aq]s special
13
+ notations.
14
+ Target PIONE document is printed out to STDOUT.
15
+ .SH OPTIONS
16
+ .TP
17
+ .B \-\-name=\f[I]NAME\f[]
18
+ Set the package name.
19
+ .RS
20
+ .RE
21
+ .TP
22
+ .B \-\-editor=\f[I]NAME\f[]
23
+ Set the package editor.
24
+ .RS
25
+ .RE
26
+ .TP
27
+ .B \-\-tag=\f[I]NAME\f[]
28
+ Set the package tag.
29
+ .RS
30
+ .RE
31
+ .SH EXAMPLES
32
+ .TP
33
+ .B pione\-compiler Sequence.pnml
34
+ Compile from Sequence.pnml to PIONE document.
35
+ .RS
36
+ .RE
37
+ .TP
38
+ .B pione\-compiler \-\-name=Sequence Sequence.pnml
39
+ Compile from Sequence.pnml to PIONE document with package name
40
+ "Sequence".
41
+ .RS
42
+ .RE
43
+ .SH REPORTING BUGS
44
+ .PP
45
+ Report bugs or feature requests to PIONE\[aq]s issue
46
+ tracker(https://github.com/pione/pione/issues).
47
+ .SH AUTHORS
48
+ Keita Yamaguchi.
@@ -0,0 +1,43 @@
1
+ .TH pione\-update\-package\-info 1 "" "PIONE User Manual"
2
+ .SH NAME
3
+ .PP
4
+ pione\-update\-package\-info \- update PIONE\[aq]s package information
5
+ files.
6
+ .SH SYNOPSIS
7
+ .PP
8
+ \f[B]pione update\-package\-info\f[] [options] pacakge\-location
9
+ .SH DESCRIPTION
10
+ .PP
11
+ pione\-update\-package\-info updates PIONE\[aq]s package information
12
+ files.
13
+ PIONE tries to update package information files automatically, but you
14
+ should update it by this command when you add new files or do some
15
+ operations.
16
+ .SS NOTE
17
+ .PP
18
+ This command tries to update files from criterion of file timestamps.
19
+ If files are not updated by PIONE\[aq]s mistake, you need to set
20
+ \f[C]\-\-force\f[] option.
21
+ .SH OPTIONS
22
+ .TP
23
+ .B \-\-force
24
+ Update all package information files ignoring the update criterion.
25
+ .RS
26
+ .RE
27
+ .SH EXAMPLES
28
+ .TP
29
+ .B pione update\-package\-info example/HelloWorld
30
+ Update some package information files in the path of example/HelloWorld.
31
+ .RS
32
+ .RE
33
+ .TP
34
+ .B pione update\-package\-info \-\-force example/HelloWorld
35
+ Update all package information files in the path of example/HelloWorld.
36
+ .RS
37
+ .RE
38
+ .SH REPORTING BUGS
39
+ .PP
40
+ Report bugs or feature requests to PIONE\[aq]s issue
41
+ tracker(https://github.com/pione/pione/issues).
42
+ .SH AUTHORS
43
+ Keita Yamaguchi.
data/pione.gemspec CHANGED
@@ -52,6 +52,7 @@ Gem::Specification.new do |gem|
52
52
  gem.add_runtime_dependency "childprocess", "~> 0.3.9"
53
53
  gem.add_runtime_dependency "lettercase", "~> 0.0.3"
54
54
  gem.add_runtime_dependency "rubyzip", "~> 1.0.0"
55
+ gem.add_runtime_dependency "kramdown", "~> 1.2.0"
55
56
 
56
57
  # for locations
57
58
  gem.add_runtime_dependency "dropbox-sdk", "~> 1.5.1"
@@ -0,0 +1,15 @@
1
+ require 'pione/test-helper'
2
+
3
+ TestHelper.scope do |this|
4
+ this::DIR = Location[File.dirname(__FILE__)] + ".." + "literate-action" + "data"
5
+
6
+ describe Pione::Command::PioneActionList do
7
+ it "should show action names" do
8
+ args = [(this::DIR + "D1.md").path.to_s]
9
+ res = TestHelper::Command.succeed do
10
+ Pione::Command::PioneActionList.run(args)
11
+ end
12
+ res.stdout.string.chomp.should == "Name1\nName2"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,24 @@
1
+ require 'pione/test-helper'
2
+
3
+ TestHelper.scope do |this|
4
+ this::DIR = Location[File.dirname(__FILE__)] + ".." + "literate-action" + "data"
5
+
6
+ describe Pione::Command::PioneAction do
7
+ it "should execute action" do
8
+ base = Location[Temppath.mkdir]
9
+ args = [(this::DIR + "HelloWorld.md").path.to_s, "SayHello", "-d", base.path.to_s]
10
+ TestHelper::Command.succeed do
11
+ Pione::Command::PioneAction.run(args)
12
+ end
13
+ (base + "message.txt").read.chomp.should == "Hello, world!"
14
+ end
15
+
16
+ it "should show action content" do
17
+ args = [(this::DIR + "HelloWorld.md").path.to_s, "SayHello", "--show"]
18
+ res = TestHelper::Command.succeed do
19
+ Pione::Command::PioneAction.run(args)
20
+ end
21
+ res.stdout.string.chomp.should == "echo \"Hello, world!\" > message.txt"
22
+ end
23
+ end
24
+ end
@@ -63,5 +63,194 @@ TestHelper.scope do |this|
63
63
  end
64
64
  res.stdout.string.size.should > 0
65
65
  end
66
+
67
+ describe "example/Fib" do
68
+ TestHelper::PioneClientRunner.test(self) do |runner|
69
+ runner.title = "should get a result with no parameters (default fib(3))"
70
+ runner.args = ["example/Fib/Fib.pione", *runner.default_arguments]
71
+ runner.run do |base|
72
+ (base + "result.txt").should.exist
73
+ (base + "result.txt").read.should.start_with "2"
74
+ end
75
+ end
76
+
77
+ # FIXME: this test is unstable... maybe there are bugs
78
+
79
+ # it "should get a result of fib(10)" do
80
+ # path = Temppath.create
81
+ # args = ["example/Fib/Fib.pione", "-o", path.to_s, "--params", "{NUM: 10}"]
82
+ # res = TestHelper::Command.succeed do
83
+ # Pione::Command::PioneClient.run(args)
84
+ # end
85
+ # Location[path + "result.txt"].should.exist
86
+ # Location[path + "result.txt"].read.should.start_with "55"
87
+ # end
88
+ end
89
+
90
+ describe "example/PegasusWMS/Merge" do
91
+ TestHelper::PioneClientRunner.test(self) do |runner|
92
+ runner.title = "should get a result of example/PegasusWMS/Merge"
93
+ runner.args = ["example/PegasusWMS/Merge/", *runner.default_arguments]
94
+ runner.run do |base|
95
+ (base + "binaries.txt").should.exist
96
+ (base + "binaries.txt").size.should > 0
97
+ end
98
+ end
99
+ end
100
+
101
+ describe "example/PegasusWMS/Pipeline" do
102
+ if TestHelper::InternetConnectivity.ok?
103
+ TestHelper::PioneClientRunner.test(self) do |runner|
104
+ runner.title = "should get a result of example/PegasusWMS/Pipeline"
105
+ runner.args = ["example/PegasusWMS/Pipeline/", *runner.default_arguments]
106
+ runner.run do |base|
107
+ (base + "count.txt").should.exist
108
+ (base + "count.txt").size.should > 0
109
+ end
110
+ end
111
+ else
112
+ puts " * ignored because of no internet connection"
113
+ end
114
+ end
115
+
116
+ describe "example/PegasusWMS/Split" do
117
+ if TestHelper::InternetConnectivity.ok?
118
+ TestHelper::PioneClientRunner.test(self) do |runner|
119
+ runner.title = "should get a result of example/PegasusWMS/Split"
120
+ runner.args = ["example/PegasusWMS/Split/", *runner.default_arguments]
121
+ runner.run do |base|
122
+ (base + "count.txt.a").should.exist
123
+ (base + "count.txt.a").size.should > 0
124
+ (base + "count.txt.b").should.exist
125
+ (base + "count.txt.b").size.should > 0
126
+ (base + "count.txt.c").should.exist
127
+ (base + "count.txt.c").size.should > 0
128
+ (base + "count.txt.d").should.exist
129
+ (base + "count.txt.d").size.should > 0
130
+ end
131
+ end
132
+ else
133
+ puts " * ignored because of no internet connection"
134
+ end
135
+ end
136
+
137
+ describe "example/OddSelector" do
138
+ TestHelper::PioneClientRunner.test(self) do |runner|
139
+ runner.title = "should get a result of example/OddSelector"
140
+ runner.args = ["example/OddSelector", "--rehearse", *runner.default_arguments]
141
+ runner.run do |base|
142
+ (base + "1.res").should.exist
143
+ (base + "2.res").should.not.exist
144
+ (base + "3.res").should.exist
145
+ (base + "4.res").should.not.exist
146
+ (base + "5.res").should.exist
147
+ (base + "6.res").should.not.exist
148
+ (base + "7.res").should.exist
149
+ (base + "8.res").should.not.exist
150
+ (base + "9.res").should.exist
151
+ (base + "10.res").should.not.exist
152
+ end
153
+ end
154
+ end
155
+
156
+ describe "example/SerialProcessing" do
157
+ TestHelper::PioneClientRunner.test(self) do |runner|
158
+ runner.title = "should get a result of example/SerialProcessing"
159
+ runner.args = ["example/SerialProcessing", "--rehearse", *runner.default_arguments]
160
+ runner.run do |base|
161
+ (base + "1.a").should.exist
162
+ (base + "2.a").should.exist
163
+ (base + "3.a").should.exist
164
+ (base + "4.a").should.exist
165
+ (base + "1.b").should.exist
166
+ (base + "2.b").should.exist
167
+ (base + "3.b").should.exist
168
+ (base + "4.b").should.exist
169
+ (base + "1.a").mtime.should < (base + "2.a").mtime
170
+ (base + "2.a").mtime.should < (base + "3.a").mtime
171
+ (base + "3.a").mtime.should < (base + "4.a").mtime
172
+ (base + "4.a").mtime.should < (base + "1.b").mtime
173
+ (base + "1.b").mtime.should < (base + "2.b").mtime
174
+ (base + "2.b").mtime.should < (base + "3.b").mtime
175
+ (base + "3.b").mtime.should < (base + "4.b").mtime
176
+ end
177
+ end
178
+ end
179
+
180
+ describe "example/MakePair" do
181
+ TestHelper::PioneClientRunner.test(self) do |runner|
182
+ runner.title = "should get a result of example/MakePair"
183
+ runner.args = ["example/MakePair", "--rehearse", "case1", *runner.default_arguments]
184
+ runner.run do |base|
185
+ 1.upto(5) do |i|
186
+ 1.upto(5) do |ii|
187
+ comb = (base + "comb-%s-%s.pair" % [i, ii])
188
+ i < ii ? comb.should.exist : comb.should.not.exist
189
+ perm = (base + "perm-%s-%s.pair" % [i, ii])
190
+ i != ii ? perm.should.exist : perm.should.not.exist
191
+ succ = (base + "succ-%s-%s.pair" % [i, ii])
192
+ ii - i == 1 ? succ.should.exist : succ.should.not.exist
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end
198
+
199
+ describe "example/SelectRuleByParam" do
200
+ TestHelper::PioneClientRunner.test(self) do |runner|
201
+ runner.title = "should get a result of scenario a of example/SelectRuleByParam"
202
+ runner.args = ["example/SelectRuleByParam", "--rehearse", "Select A", *runner.default_arguments]
203
+ runner.run do |base|
204
+ (base + "message.txt").should.exist
205
+ (base + "message.txt").read.chomp.should == "This is rule A."
206
+ end
207
+ end
208
+
209
+ TestHelper::PioneClientRunner.test(self) do |runner|
210
+ runner.title = "should get a result of scenario b of example/SelectRuleByParam"
211
+ runner.args = ["example/SelectRuleByParam", "--rehearse", "Select B", *runner.default_arguments]
212
+ runner.run do |base|
213
+ (base + "message.txt").should.exist
214
+ (base + "message.txt").read.chomp.should == "This is rule B."
215
+ end
216
+ end
217
+
218
+ TestHelper::PioneClientRunner.test(self) do |runner|
219
+ runner.title = "should get a result of scenario c of example/SelectRuleByParam"
220
+ runner.args = ["example/SelectRuleByParam", "--rehearse", "Select C", *runner.default_arguments]
221
+ runner.run do |base|
222
+ (base + "message.txt").should.exist
223
+ (base + "message.txt").read.chomp.should == "This is rule C."
224
+ end
225
+ end
226
+ end
227
+
228
+ describe "example/FeatureExample" do
229
+ TestHelper::PioneClientRunner.test(self) do |runner|
230
+ runner.title = "should get a result of example/FeatureExample"
231
+ runner.args = ["example/FeatureExample", "--feature", "^X", *runner.default_arguments]
232
+ runner.run do |base|
233
+ (base + "message.txt").should.exist
234
+ (base + "message.txt").read.chomp.should == "I can take the task."
235
+ end
236
+ end
237
+
238
+ TestHelper::PioneClientRunner.test(self) do |runner|
239
+ runner.title = "should timeout with feature `*` in processing example/FeatureExample"
240
+ runner.args = ["example/FeatureExample", "--feature", "*", *runner.default_arguments]
241
+ runner.timeout(5)
242
+ end
243
+ end
244
+
245
+ describe "example/Sum" do
246
+ TestHelper::PioneClientRunner.test(self) do |runner|
247
+ runner.title = "should get a result of example/Sum"
248
+ runner.args = ["example/Sum", "--rehearse", *runner.default_arguments]
249
+ runner.run do |base|
250
+ (base + "sum.txt").should.exist
251
+ end
252
+ end
253
+ end
254
+
66
255
  end
67
256
  end