gisele-vm 0.6.0

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.
Files changed (185) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/Gemfile +18 -0
  3. data/Gemfile.lock +46 -0
  4. data/LICENCE.md +22 -0
  5. data/Manifest.txt +15 -0
  6. data/README.md +10 -0
  7. data/Rakefile +11 -0
  8. data/bin/gvm +9 -0
  9. data/gisele-vm.gemspec +191 -0
  10. data/gisele-vm.noespec +31 -0
  11. data/lib/gisele-vm.rb +4 -0
  12. data/lib/gisele-vm/loader.rb +5 -0
  13. data/lib/gisele-vm/version.rb +16 -0
  14. data/lib/gisele/compiling.rb +3 -0
  15. data/lib/gisele/compiling/gisele2gts.rb +143 -0
  16. data/lib/gisele/compiling/gts.rb +74 -0
  17. data/lib/gisele/compiling/gts2bytecode.rb +127 -0
  18. data/lib/gisele/vm.rb +87 -0
  19. data/lib/gisele/vm/bytecode.rb +84 -0
  20. data/lib/gisele/vm/bytecode/builder.rb +77 -0
  21. data/lib/gisele/vm/bytecode/grammar.citrus +116 -0
  22. data/lib/gisele/vm/bytecode/grammar.rb +19 -0
  23. data/lib/gisele/vm/bytecode/grammar.sexp.yml +113 -0
  24. data/lib/gisele/vm/bytecode/printer.rb +35 -0
  25. data/lib/gisele/vm/command.rb +140 -0
  26. data/lib/gisele/vm/component.rb +91 -0
  27. data/lib/gisele/vm/console.rb +58 -0
  28. data/lib/gisele/vm/enacter.rb +29 -0
  29. data/lib/gisele/vm/errors.rb +26 -0
  30. data/lib/gisele/vm/event.rb +11 -0
  31. data/lib/gisele/vm/event_manager.rb +65 -0
  32. data/lib/gisele/vm/kernel.rb +58 -0
  33. data/lib/gisele/vm/kernel/macros.gvm +214 -0
  34. data/lib/gisele/vm/kernel/opcodes.rb +212 -0
  35. data/lib/gisele/vm/kernel/runner.rb +63 -0
  36. data/lib/gisele/vm/lifecycle.rb +72 -0
  37. data/lib/gisele/vm/logging.rb +18 -0
  38. data/lib/gisele/vm/null_object.rb +19 -0
  39. data/lib/gisele/vm/prog.rb +63 -0
  40. data/lib/gisele/vm/prog_list.rb +55 -0
  41. data/lib/gisele/vm/prog_list/memory.rb +74 -0
  42. data/lib/gisele/vm/prog_list/sqldb.rb +123 -0
  43. data/lib/gisele/vm/prog_list/storage.rb +31 -0
  44. data/lib/gisele/vm/proxy.rb +14 -0
  45. data/lib/gisele/vm/proxy/client.rb +64 -0
  46. data/lib/gisele/vm/proxy/server.rb +29 -0
  47. data/lib/gisele/vm/registry.rb +57 -0
  48. data/lib/gisele/vm/robustness.rb +31 -0
  49. data/lib/gisele/vm/simulator/resumer.rb +32 -0
  50. data/spec/command/gvm_compile.cmd +1 -0
  51. data/spec/command/gvm_compile.stdout +111 -0
  52. data/spec/command/gvm_gts.cmd +1 -0
  53. data/spec/command/gvm_gts.stdout +101 -0
  54. data/spec/command/gvm_help.cmd +1 -0
  55. data/spec/command/gvm_help.stdout +30 -0
  56. data/spec/command/gvm_version.cmd +1 -0
  57. data/spec/command/gvm_version.stdout +2 -0
  58. data/spec/command/test_command.rb +29 -0
  59. data/spec/fixtures/complete.gis +13 -0
  60. data/spec/fixtures/fake_component.rb +24 -0
  61. data/spec/fixtures/kernel.rb +39 -0
  62. data/spec/fixtures/ts.adl +11 -0
  63. data/spec/fixtures/ts.gts +20 -0
  64. data/spec/fixtures/ts.gvm +19 -0
  65. data/spec/spec_helper.rb +86 -0
  66. data/spec/test_examples.rb +29 -0
  67. data/spec/test_gisele-vm.rb +8 -0
  68. data/spec/unit/bytecode/builder/test_at.rb +56 -0
  69. data/spec/unit/bytecode/builder/test_helpers.rb +36 -0
  70. data/spec/unit/bytecode/builder/test_instruction.rb +35 -0
  71. data/spec/unit/bytecode/builder/test_to_a.rb +53 -0
  72. data/spec/unit/bytecode/bytecode.gvm +1 -0
  73. data/spec/unit/bytecode/grammar/fixtures/comments.gvm +16 -0
  74. data/spec/unit/bytecode/grammar/fixtures/every.gvm +46 -0
  75. data/spec/unit/bytecode/grammar/fixtures/singleblock.gvm +2 -0
  76. data/spec/unit/bytecode/grammar/fixtures/twoblocks.gvm +4 -0
  77. data/spec/unit/bytecode/grammar/fixtures/with_end.gvm +5 -0
  78. data/spec/unit/bytecode/grammar/test_array.rb +24 -0
  79. data/spec/unit/bytecode/grammar/test_block.rb +35 -0
  80. data/spec/unit/bytecode/grammar/test_boolean.rb +20 -0
  81. data/spec/unit/bytecode/grammar/test_constant.rb +20 -0
  82. data/spec/unit/bytecode/grammar/test_eol.rb +20 -0
  83. data/spec/unit/bytecode/grammar/test_eol_comment.rb +36 -0
  84. data/spec/unit/bytecode/grammar/test_file.rb +38 -0
  85. data/spec/unit/bytecode/grammar/test_hash.rb +33 -0
  86. data/spec/unit/bytecode/grammar/test_instruction.rb +32 -0
  87. data/spec/unit/bytecode/grammar/test_int.rb +24 -0
  88. data/spec/unit/bytecode/grammar/test_label.rb +24 -0
  89. data/spec/unit/bytecode/grammar/test_opcode.rb +23 -0
  90. data/spec/unit/bytecode/grammar/test_string.rb +25 -0
  91. data/spec/unit/bytecode/grammar/test_symbol.rb +30 -0
  92. data/spec/unit/bytecode/test_build.rb +36 -0
  93. data/spec/unit/bytecode/test_coerce.rb +41 -0
  94. data/spec/unit/bytecode/test_fetch.rb +20 -0
  95. data/spec/unit/bytecode/test_grammar.rb +30 -0
  96. data/spec/unit/bytecode/test_parse.rb +22 -0
  97. data/spec/unit/bytecode/test_plus.rb +27 -0
  98. data/spec/unit/bytecode/test_to_a.rb +19 -0
  99. data/spec/unit/bytecode/test_to_s.rb +32 -0
  100. data/spec/unit/command/code.gis +3 -0
  101. data/spec/unit/command/test_vm.rb +51 -0
  102. data/spec/unit/compiling/gisele2gts/test_on_par_st.rb +51 -0
  103. data/spec/unit/compiling/gisele2gts/test_on_seq_st.rb +46 -0
  104. data/spec/unit/compiling/gisele2gts/test_on_task_call_st.rb +37 -0
  105. data/spec/unit/compiling/gisele2gts/test_on_task_def.rb +49 -0
  106. data/spec/unit/compiling/gisele2gts/test_on_unit_def.rb +35 -0
  107. data/spec/unit/compiling/gts2bytecode/test_on_end.rb +31 -0
  108. data/spec/unit/compiling/gts2bytecode/test_on_event.rb +37 -0
  109. data/spec/unit/compiling/gts2bytecode/test_on_fork.rb +41 -0
  110. data/spec/unit/compiling/gts2bytecode/test_on_join.rb +42 -0
  111. data/spec/unit/compiling/gts2bytecode/test_on_listen.rb +36 -0
  112. data/spec/unit/compiling/gts2bytecode/test_on_nop.rb +30 -0
  113. data/spec/unit/component/test_component_name.rb +16 -0
  114. data/spec/unit/component/test_logging.rb +36 -0
  115. data/spec/unit/enacter/test_component.rb +11 -0
  116. data/spec/unit/event/test_to_s.rb +12 -0
  117. data/spec/unit/event_manager/test_component.rb +9 -0
  118. data/spec/unit/event_manager/test_subscribe.rb +40 -0
  119. data/spec/unit/event_manager/test_unsubscribe.rb +39 -0
  120. data/spec/unit/kernel/macros/test_fork.rb +37 -0
  121. data/spec/unit/kernel/macros/test_join.rb +43 -0
  122. data/spec/unit/kernel/macros/test_listen.rb +37 -0
  123. data/spec/unit/kernel/macros/test_notify.rb +57 -0
  124. data/spec/unit/kernel/macros/test_react.rb +47 -0
  125. data/spec/unit/kernel/macros/test_schedule_at.rb +30 -0
  126. data/spec/unit/kernel/opcodes/test_op_del.rb +42 -0
  127. data/spec/unit/kernel/opcodes/test_op_event.rb +25 -0
  128. data/spec/unit/kernel/opcodes/test_op_fetch.rb +27 -0
  129. data/spec/unit/kernel/opcodes/test_op_flip.rb +17 -0
  130. data/spec/unit/kernel/opcodes/test_op_fold.rb +29 -0
  131. data/spec/unit/kernel/opcodes/test_op_fork.rb +63 -0
  132. data/spec/unit/kernel/opcodes/test_op_forka.rb +51 -0
  133. data/spec/unit/kernel/opcodes/test_op_get.rb +62 -0
  134. data/spec/unit/kernel/opcodes/test_op_getr.rb +48 -0
  135. data/spec/unit/kernel/opcodes/test_op_ifenil.rb +41 -0
  136. data/spec/unit/kernel/opcodes/test_op_ifezero.rb +32 -0
  137. data/spec/unit/kernel/opcodes/test_op_invoke.rb +34 -0
  138. data/spec/unit/kernel/opcodes/test_op_nop.rb +18 -0
  139. data/spec/unit/kernel/opcodes/test_op_parent.rb +39 -0
  140. data/spec/unit/kernel/opcodes/test_op_pop.rb +22 -0
  141. data/spec/unit/kernel/opcodes/test_op_push.rb +17 -0
  142. data/spec/unit/kernel/opcodes/test_op_save.rb +32 -0
  143. data/spec/unit/kernel/opcodes/test_op_savea.rb +34 -0
  144. data/spec/unit/kernel/opcodes/test_op_self.rb +20 -0
  145. data/spec/unit/kernel/opcodes/test_op_send.rb +20 -0
  146. data/spec/unit/kernel/opcodes/test_op_set.rb +61 -0
  147. data/spec/unit/kernel/opcodes/test_op_then.rb +50 -0
  148. data/spec/unit/kernel/opcodes/test_op_unfold.rb +22 -0
  149. data/spec/unit/kernel/opcodes/test_op_uuid.rb +16 -0
  150. data/spec/unit/kernel/runner/test_pop.rb +26 -0
  151. data/spec/unit/kernel/runner/test_stack.rb +28 -0
  152. data/spec/unit/kernel/test_progress.rb +47 -0
  153. data/spec/unit/kernel/test_resume.rb +53 -0
  154. data/spec/unit/kernel/test_start.rb +36 -0
  155. data/spec/unit/prog/test_to_hash.rb +29 -0
  156. data/spec/unit/prog/test_waitlist_eq.rb +20 -0
  157. data/spec/unit/prog_list/memory/test_component.rb +9 -0
  158. data/spec/unit/prog_list/memory/test_fetch.rb +40 -0
  159. data/spec/unit/prog_list/memory/test_pick.rb +39 -0
  160. data/spec/unit/prog_list/memory/test_save.rb +91 -0
  161. data/spec/unit/prog_list/memory/test_to_relation.rb +17 -0
  162. data/spec/unit/prog_list/sqldb/test_component.rb +11 -0
  163. data/spec/unit/prog_list/sqldb/test_connect.rb +46 -0
  164. data/spec/unit/prog_list/test_memory.rb +9 -0
  165. data/spec/unit/prog_list/test_sqldb.rb +13 -0
  166. data/spec/unit/prog_list/test_storage.rb +51 -0
  167. data/spec/unit/registry/test_component.rb +9 -0
  168. data/spec/unit/registry/test_connect.rb +53 -0
  169. data/spec/unit/registry/test_disconnect.rb +51 -0
  170. data/spec/unit/registry/test_registration.rb +44 -0
  171. data/spec/unit/shared/a_component.rb +49 -0
  172. data/spec/unit/shared/a_storage.rb +114 -0
  173. data/spec/unit/test_logging.rb +46 -0
  174. data/spec/unit/test_prog.rb +57 -0
  175. data/spec/unit/test_prog_list.rb +22 -0
  176. data/spec/unit/vm/test_event_facace.rb +11 -0
  177. data/spec/unit/vm/test_initialize.rb +59 -0
  178. data/spec/unit/vm/test_proglist_facade.rb +21 -0
  179. data/tasks/debug_mail.rake +75 -0
  180. data/tasks/debug_mail.txt +13 -0
  181. data/tasks/gem.rake +73 -0
  182. data/tasks/spec_test.rake +71 -0
  183. data/tasks/unit_test.rake +76 -0
  184. data/tasks/yard.rake +51 -0
  185. metadata +493 -0
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ module Gisele
3
+ class VM
4
+ describe Logging do
5
+ include Logging
6
+
7
+ context 'without logger' do
8
+
9
+ it 'does not fail when logging message' do
10
+ info("something").should be_a(NullObject)
11
+ fatal("an error occured").something_else.should be_a(NullObject)
12
+ end
13
+
14
+ it 'returns false on query methods' do
15
+ if info?
16
+ true.should be_false
17
+ end
18
+ end
19
+
20
+ end # without logger
21
+
22
+ context 'with a logger' do
23
+
24
+ before do
25
+ self.logger = Object.new
26
+ def logger.info?
27
+ true
28
+ end
29
+ def logger.info(msg)
30
+ @msg = msg.upcase
31
+ end
32
+ end
33
+
34
+ it 'delegates logging calls' do
35
+ info("something to log").should eq("SOMETHING TO LOG")
36
+ end
37
+
38
+ it 'delegates query methods' do
39
+ info?.should be_true
40
+ end
41
+
42
+ end # with a logger
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+ class Gisele::VM
3
+ describe Prog do
4
+
5
+ let(:h){
6
+ { :puid => "puid",
7
+ :parent => "parent",
8
+ :root => "root",
9
+ :pc => 12,
10
+ :waitfor => :enacter,
11
+ :waitlist => {:a => true},
12
+ :input => [ :event ] }
13
+ }
14
+
15
+ it 'has defaults' do
16
+ s = Prog.new
17
+ s.puid.should be_nil
18
+ s.parent.should be_nil
19
+ s.root.should be_nil
20
+ s.pc.should eq(:main)
21
+ s.waitfor.should eq(:none)
22
+ s.waitlist.should eq({})
23
+ s.input.should eq([])
24
+ end
25
+
26
+ it 'understands options' do
27
+ s = Prog.new(h)
28
+ s.puid.should eq("puid")
29
+ s.parent.should eq("parent")
30
+ s.root.should eq("root")
31
+ s.pc.should eq(12)
32
+ s.waitfor.should eq(:enacter)
33
+ s.waitlist.should eq({:a => true})
34
+ s.input.should eq([:event])
35
+ end
36
+
37
+ it 'provides a to_hash' do
38
+ s = Prog.new(h)
39
+ s.to_hash.should eq(h)
40
+ end
41
+
42
+ it 'provides value-equal duplication' do
43
+ s = Prog.new(:puid => 12, :waitlist => {:a => true})
44
+ s.dup.object_id.should_not eq(s.object_id)
45
+ s.dup.should eq(s)
46
+ end
47
+
48
+ it 'duplicates deeply' do
49
+ s = Prog.new(h)
50
+ s.dup.waitlist[:b] = false
51
+ s.waitlist.should eq({:a => true})
52
+ s.dup.input << :blih
53
+ s.input.should eq([:event])
54
+ end
55
+
56
+ end
57
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+ module Gisele
3
+ class VM
4
+ describe ProgList do
5
+
6
+ context 'with a ruby memory storage' do
7
+ subject do
8
+ ProgList.new ProgList::Memory.new
9
+ end
10
+ it_should_behave_like "a component"
11
+ end
12
+
13
+ context 'with a sqldb storage' do
14
+ subject do
15
+ ProgList.new ProgList.storage("memory")
16
+ end
17
+ it_should_behave_like "a component"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+ module Gisele
3
+ describe VM, "the event facade" do
4
+
5
+ it 'delegates event calls to it' do
6
+ vm.event(an_event)
7
+ observed_events.should eq([an_event])
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+ module Gisele
3
+ describe VM, "initialize" do
4
+
5
+ after do
6
+ vm.should_not be_running
7
+ vm.status.should eq(:stopped)
8
+ vm.components[0].should be_a(VM::Kernel)
9
+ vm.components[1].should be_a(VM::ProgList)
10
+ vm.components[2].should be_a(VM::EventManager)
11
+ end
12
+
13
+ context 'without block' do
14
+ let(:vm){ VM.new }
15
+
16
+ it 'uses the kernel bytecode' do
17
+ vm.bytecode[:start].should_not be_nil
18
+ end
19
+
20
+ it 'installs a default logger' do
21
+ vm.logger.should be_a(Logger)
22
+ end
23
+
24
+ it 'installs a default event manager' do
25
+ vm.event_manager.should be_a(VM::EventManager)
26
+ end
27
+ end
28
+
29
+ context 'with a block' do
30
+ let(:em) { VM::EventManager.new }
31
+ let(:list){ VM::ProgList.new VM::ProgList.storage("memory") }
32
+ let(:vm){
33
+ VM.new([:gvm, [:block, :hello, [:nop]]]) do |vm|
34
+ vm.proglist = list
35
+ vm.logger = nil
36
+ vm.event_manager = em
37
+ end
38
+ }
39
+
40
+ it 'merges the kernel bytecode and the provided one' do
41
+ vm.bytecode[:hello].should_not be_nil
42
+ vm.bytecode[:start].should_not be_nil
43
+ end
44
+
45
+ it 'installs the provided proglist' do
46
+ vm.proglist.should eq(list)
47
+ end
48
+
49
+ it 'installs the provided logger' do
50
+ vm.logger.should be_nil
51
+ end
52
+
53
+ it 'installs the provided event manager' do
54
+ vm.event_manager.should eq(em)
55
+ end
56
+ end
57
+
58
+ end
59
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+ module Gisele
3
+ describe VM, "the proglist facade" do
4
+
5
+ let(:vm){
6
+ VM.new do |vm|
7
+ vm.proglist = VM::ProgList.memory
8
+ end
9
+ }
10
+
11
+ before do
12
+ vm.connect
13
+ end
14
+
15
+ it 'delegates fetch/save calls to it' do
16
+ puid = vm.save(VM::Prog.new(:pc => :ping))
17
+ vm.fetch(puid).pc.should eq(:ping)
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,75 @@
1
+ # Installs a rake task for debuging the announcement mail.
2
+ #
3
+ # This file installs the 'rake debug_mail' that flushes an announcement mail
4
+ # for your library on the standard output. It is automatically generated
5
+ # by Noe from your .noespec file, and should therefore be configured there,
6
+ # under the variables/rake_tasks/debug_mail entry, as illustrated below:
7
+ #
8
+ # variables:
9
+ # rake_tasks:
10
+ # debug_mail:
11
+ # rx_changelog_sections: /^#/
12
+ # nb_changelog_sections: 1
13
+ # ...
14
+ #
15
+ # If you have specific needs requiring manual intervention on this file,
16
+ # don't forget to set safe-override to false in your noe specification:
17
+ #
18
+ # template-info:
19
+ # manifest:
20
+ # tasks/debug_mail.rake:
21
+ # safe-override: false
22
+ #
23
+ # The mail template used can be found in debug_mail.txt. That file may be
24
+ # changed to tune the mail you want to send. If you do so, don't forget to
25
+ # add a manifest entry in your .noespec file to avoid overriding you
26
+ # changes. The mail template uses wlang, with parentheses for block
27
+ # delimiters.
28
+ #
29
+ # template-info:
30
+ # manifest:
31
+ # tasks/debug_mail.txt:
32
+ # safe-override: false
33
+ #
34
+ desc "Debug the release announcement mail"
35
+ task :debug_mail do
36
+ begin
37
+ require 'wlang'
38
+ rescue LoadError
39
+ abort "wlang is not available. Try 'gem install wlang'"
40
+ end
41
+ require 'yaml'
42
+
43
+ # Check that a .noespec file exists
44
+ noespec_file = File.expand_path('../../gisele-vm.noespec', __FILE__)
45
+ unless File.exists?(noespec_file)
46
+ raise "Unable to find .noespec project file, sorry."
47
+ end
48
+
49
+ # Load it as well as variables and options
50
+ noespec = YAML::load(File.read(noespec_file))
51
+ vars = noespec['variables'] || {}
52
+
53
+ # Changes are taken from CHANGELOG
54
+ logs = Dir[File.expand_path("../../CHANGELOG.*", __FILE__)]
55
+ unless logs.size == 1
56
+ abort "Unable to find a changelog file"
57
+ end
58
+
59
+ # Load interesting changesets
60
+ changes, end_found = [], 0
61
+ File.readlines(logs.first).select{|line|
62
+ if line =~ /^# /
63
+ break if end_found >= 1
64
+ end_found += 1
65
+ end
66
+ changes << line
67
+ }
68
+ vars['changes'] = changes.join
69
+
70
+ # WLang template
71
+ template = File.expand_path('../debug_mail.txt', __FILE__)
72
+
73
+ # Let's go!
74
+ $stdout << WLang::file_instantiate(template, vars, "wlang/active-text")
75
+ end
@@ -0,0 +1,13 @@
1
+ Subject: [ANN] !{lower} !{version} Released
2
+
3
+ !{lower} version !{version} has been released!
4
+
5
+ !{summary}
6
+
7
+ *{links as l}{* <!{l}>}{!{"\n"}}
8
+
9
+ !{description}
10
+
11
+ Changes:
12
+
13
+ !{changes}
@@ -0,0 +1,73 @@
1
+ # Installs rake tasks for gemming and packaging
2
+ #
3
+ # This file installs the 'rake package', 'rake gem' tasks and associates
4
+ # (clobber_package, repackage, ...). It is automatically generated by Noe
5
+ # from your .noespec file, and should therefore be configured there, under
6
+ # the variables/rake_tasks/gem entry, as illustrated below:
7
+ #
8
+ # variables:
9
+ # rake_tasks:
10
+ # gem:
11
+ # package_dir: pkg
12
+ # need_tar: false
13
+ # need_tar_gz: false
14
+ # need_tar_bz2: false
15
+ # need_zip: false
16
+ # ...
17
+ #
18
+ # If you have specific needs requiring manual intervention on this file,
19
+ # don't forget to set safe-override to false in your noe specification:
20
+ #
21
+ # template-info:
22
+ # manifest:
23
+ # tasks/gem.rake:
24
+ # safe-override: false
25
+ #
26
+ begin
27
+ require 'rubygems/package_task'
28
+
29
+ # Dynamically load the gem spec
30
+ gemspec_file = File.expand_path('../../gisele-vm.gemspec', __FILE__)
31
+ gemspec = Kernel.eval(File.read(gemspec_file))
32
+
33
+ Gem::PackageTask.new(gemspec) do |t|
34
+
35
+ # Name of the package
36
+ t.name = gemspec.name
37
+
38
+ # Version of the package
39
+ t.version = gemspec.version
40
+
41
+ # Directory used to store the package files
42
+ t.package_dir = "pkg"
43
+
44
+ # True if a gzipped tar file (tgz) should be produced
45
+ t.need_tar = false
46
+
47
+ # True if a gzipped tar file (tar.gz) should be produced
48
+ t.need_tar_gz = false
49
+
50
+ # True if a bzip2'd tar file (tar.bz2) should be produced
51
+ t.need_tar_bz2 = false
52
+
53
+ # True if a zip file should be produced (default is false)
54
+ t.need_zip = false
55
+
56
+ # List of files to be included in the package.
57
+ t.package_files = gemspec.files
58
+
59
+ # Tar command for gzipped or bzip2ed archives.
60
+ t.tar_command = "tar"
61
+
62
+ # Zip command for zipped archives.
63
+ t.zip_command = "zip"
64
+
65
+ end
66
+ rescue LoadError
67
+ task :gem do
68
+ abort 'rubygems/package_task is not available. You should verify your rubygems installation'
69
+ end
70
+ task :package do
71
+ abort 'rubygems/package_task is not available. You should verify your rubygems installation'
72
+ end
73
+ end
@@ -0,0 +1,71 @@
1
+ # Installs a rake task for for running examples written using rspec.
2
+ #
3
+ # This file installs the 'rake spec_test' (aliased as 'rake spec') as well as
4
+ # extends 'rake test' to run spec tests, if any. It is automatically generated
5
+ # by Noe from your .noespec file, and should therefore be configured there,
6
+ # under the variables/rake_tasks/spec_test entry, as illustrated below:
7
+ #
8
+ # variables:
9
+ # rake_tasks:
10
+ # spec_test:
11
+ # pattern: spec/**/*_spec.rb
12
+ # verbose: true
13
+ # rspec_opts: [--color, --backtrace]
14
+ # ...
15
+ #
16
+ # If you have specific needs requiring manual intervention on this file,
17
+ # don't forget to set safe-override to false in your noe specification:
18
+ #
19
+ # template-info:
20
+ # manifest:
21
+ # tasks/spec_test.rake:
22
+ # safe-override: false
23
+ #
24
+ # This file has been written to conform to RSpec v2.4.0. More information about
25
+ # rspec and options of the rake task defined below can be found on
26
+ # http://relishapp.com/rspec
27
+ #
28
+ begin
29
+ require "rspec/core/rake_task"
30
+ desc "Run RSpec code examples"
31
+ RSpec::Core::RakeTask.new(:spec_test) do |t|
32
+ # Glob pattern to match files.
33
+ t.pattern = "spec/**/test_*.rb"
34
+
35
+ # Whether or not to fail Rake when an error occurs (typically when
36
+ # examples fail).
37
+ t.fail_on_error = true
38
+
39
+ # A message to print to stderr when there are failures.
40
+ t.failure_message = nil
41
+
42
+ # Use verbose output. If this is set to true, the task will print the
43
+ # executed spec command to stdout.
44
+ t.verbose = true
45
+
46
+ # Use rcov for code coverage?
47
+ t.rcov = false
48
+
49
+ # Path to rcov.
50
+ t.rcov_path = "rcov"
51
+
52
+ # Command line options to pass to rcov. See 'rcov --help' about this
53
+ t.rcov_opts = []
54
+
55
+ # Command line options to pass to ruby. See 'ruby --help' about this
56
+ t.ruby_opts = []
57
+
58
+ # Path to rspec
59
+ t.rspec_path = "rspec"
60
+
61
+ # Command line options to pass to rspec. See 'rspec --help' about this
62
+ t.rspec_opts = ["--color", "--backtrace"]
63
+ end
64
+ rescue LoadError => ex
65
+ task :spec_test do
66
+ abort 'rspec is not available. In order to run spec, you must: gem install rspec'
67
+ end
68
+ ensure
69
+ task :spec => [:spec_test]
70
+ task :test => [:spec_test]
71
+ end