carps 0.2.1

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 (157) hide show
  1. data/COPYING +674 -0
  2. data/GEM_DESCRIPTION +10 -0
  3. data/History.txt +4 -0
  4. data/Manifest.txt +156 -0
  5. data/PostInstall.txt +20 -0
  6. data/README.rdoc +141 -0
  7. data/Rakefile +28 -0
  8. data/bin/carps +123 -0
  9. data/bin/carps_init +29 -0
  10. data/bin/carps_ipc_test +44 -0
  11. data/bin/carps_mod_saver_test +71 -0
  12. data/bin/carps_mod_test +62 -0
  13. data/config/website.yml +2 -0
  14. data/features/character_sheet.feature +40 -0
  15. data/features/crash.feature +15 -0
  16. data/features/crypt.feature +22 -0
  17. data/features/dice.feature +173 -0
  18. data/features/dm.feature +36 -0
  19. data/features/dmll.feature +51 -0
  20. data/features/edit.feature +10 -0
  21. data/features/email.feature +29 -0
  22. data/features/interface.feature +17 -0
  23. data/features/ipc.feature +10 -0
  24. data/features/mailbox.feature +33 -0
  25. data/features/mod.feature +31 -0
  26. data/features/parser.feature +9 -0
  27. data/features/persistent_protocol.feature +14 -0
  28. data/features/player.feature +22 -0
  29. data/features/player_turn.feature +29 -0
  30. data/features/random.feature +15 -0
  31. data/features/rule.feature +19 -0
  32. data/features/safety.feature +13 -0
  33. data/features/sessions.feature +16 -0
  34. data/features/start_dm.feature +18 -0
  35. data/features/start_player.feature +8 -0
  36. data/features/step_definitions/common_steps.rb +170 -0
  37. data/features/steps/character_sheet.rb +89 -0
  38. data/features/steps/crash.rb +27 -0
  39. data/features/steps/crypt.rb +166 -0
  40. data/features/steps/dice.rb +91 -0
  41. data/features/steps/dm.rb +147 -0
  42. data/features/steps/dmll.rb +47 -0
  43. data/features/steps/edit.rb +7 -0
  44. data/features/steps/email.rb +108 -0
  45. data/features/steps/general.rb +5 -0
  46. data/features/steps/interface.rb +64 -0
  47. data/features/steps/ipc.rb +22 -0
  48. data/features/steps/mailbox.rb +126 -0
  49. data/features/steps/mod.rb +25 -0
  50. data/features/steps/parser.rb +23 -0
  51. data/features/steps/persistent_protocol.rb +29 -0
  52. data/features/steps/player.rb +82 -0
  53. data/features/steps/player_turn.rb +56 -0
  54. data/features/steps/random.rb +47 -0
  55. data/features/steps/rule.rb +53 -0
  56. data/features/steps/safety.rb +17 -0
  57. data/features/steps/sessions.rb +37 -0
  58. data/features/steps/start_dm.rb +46 -0
  59. data/features/steps/start_player.rb +65 -0
  60. data/features/steps/timeout.rb +32 -0
  61. data/features/steps/type_verification.rb +36 -0
  62. data/features/steps/wizard.rb +123 -0
  63. data/features/support/common.rb +29 -0
  64. data/features/support/env.rb +14 -0
  65. data/features/support/matchers.rb +11 -0
  66. data/features/timeout.feature +11 -0
  67. data/features/type_verification.feature +48 -0
  68. data/features/wizard.feature +50 -0
  69. data/lib/carps/crypt/accept_handshake.rb +40 -0
  70. data/lib/carps/crypt/default_messages.rb +29 -0
  71. data/lib/carps/crypt/handshake.rb +41 -0
  72. data/lib/carps/crypt/mailbox.rb +265 -0
  73. data/lib/carps/crypt/mailer.rb +220 -0
  74. data/lib/carps/crypt/peer.rb +123 -0
  75. data/lib/carps/crypt/public_key.rb +60 -0
  76. data/lib/carps/crypt.rb +23 -0
  77. data/lib/carps/email/config.rb +122 -0
  78. data/lib/carps/email/imap.rb +156 -0
  79. data/lib/carps/email/smtp.rb +119 -0
  80. data/lib/carps/email/string.rb +30 -0
  81. data/lib/carps/email.rb +21 -0
  82. data/lib/carps/mod/action.rb +36 -0
  83. data/lib/carps/mod/answers.rb +76 -0
  84. data/lib/carps/mod/client_turn.rb +88 -0
  85. data/lib/carps/mod/dice.rb +360 -0
  86. data/lib/carps/mod/dm/interface.rb +160 -0
  87. data/lib/carps/mod/dm/mod.rb +409 -0
  88. data/lib/carps/mod/dm/reporter.rb +112 -0
  89. data/lib/carps/mod/dm/resource.rb +88 -0
  90. data/lib/carps/mod/dm/room.rb +33 -0
  91. data/lib/carps/mod/interface.rb +73 -0
  92. data/lib/carps/mod/launch.rb +108 -0
  93. data/lib/carps/mod/mod.rb +52 -0
  94. data/lib/carps/mod/player/interface.rb +76 -0
  95. data/lib/carps/mod/player/mod.rb +109 -0
  96. data/lib/carps/mod/question.rb +63 -0
  97. data/lib/carps/mod/rule.rb +112 -0
  98. data/lib/carps/mod/sheet/character.rb +82 -0
  99. data/lib/carps/mod/sheet/editor.rb +97 -0
  100. data/lib/carps/mod/sheet/new_sheet.rb +71 -0
  101. data/lib/carps/mod/sheet/schema.rb +84 -0
  102. data/lib/carps/mod/sheet/type.rb +161 -0
  103. data/lib/carps/mod/sheet/verifier.rb +41 -0
  104. data/lib/carps/mod/status_report.rb +51 -0
  105. data/lib/carps/mod.rb +40 -0
  106. data/lib/carps/protocol/keyword.rb +104 -0
  107. data/lib/carps/protocol/message.rb +138 -0
  108. data/lib/carps/protocol.rb +19 -0
  109. data/lib/carps/service/client_parser.rb +34 -0
  110. data/lib/carps/service/dm/config.rb +76 -0
  111. data/lib/carps/service/dm/mailer.rb +70 -0
  112. data/lib/carps/service/dm/new_game.rb +101 -0
  113. data/lib/carps/service/dm/start.rb +47 -0
  114. data/lib/carps/service/game.rb +101 -0
  115. data/lib/carps/service/interface.rb +174 -0
  116. data/lib/carps/service/invite.rb +79 -0
  117. data/lib/carps/service/mod.rb +43 -0
  118. data/lib/carps/service/player/config.rb +78 -0
  119. data/lib/carps/service/player/mailer.rb +49 -0
  120. data/lib/carps/service/player/start.rb +60 -0
  121. data/lib/carps/service/server_parser.rb +33 -0
  122. data/lib/carps/service/session.rb +96 -0
  123. data/lib/carps/service/start/config.rb +71 -0
  124. data/lib/carps/service/start/interface.rb +101 -0
  125. data/lib/carps/service/start/mailer.rb +46 -0
  126. data/lib/carps/service.rb +35 -0
  127. data/lib/carps/test.rb +34 -0
  128. data/lib/carps/ui/colour.rb +28 -0
  129. data/lib/carps/ui/error.rb +39 -0
  130. data/lib/carps/ui/highlight.rb +32 -0
  131. data/lib/carps/ui/question.rb +63 -0
  132. data/lib/carps/ui/warn.rb +37 -0
  133. data/lib/carps/ui.rb +21 -0
  134. data/lib/carps/util/config.rb +162 -0
  135. data/lib/carps/util/editor.rb +147 -0
  136. data/lib/carps/util/error.rb +75 -0
  137. data/lib/carps/util/files.rb +48 -0
  138. data/lib/carps/util/init.rb +93 -0
  139. data/lib/carps/util/process.rb +150 -0
  140. data/lib/carps/util/timeout.rb +31 -0
  141. data/lib/carps/util/windows.rb +29 -0
  142. data/lib/carps/util.rb +24 -0
  143. data/lib/carps/wizard/dm.rb +41 -0
  144. data/lib/carps/wizard/player.rb +40 -0
  145. data/lib/carps/wizard/steps.rb +494 -0
  146. data/lib/carps/wizard/wizard.rb +126 -0
  147. data/lib/carps/wizard.rb +21 -0
  148. data/lib/carps.rb +45 -0
  149. data/permission +16 -0
  150. data/script/console +10 -0
  151. data/script/destroy +14 -0
  152. data/script/generate +14 -0
  153. data/tasks/readme_site.rake +28 -0
  154. data/test/test_carps.rb +11 -0
  155. data/test/test_helper.rb +3 -0
  156. data/website/index.html +271 -0
  157. metadata +304 -0
@@ -0,0 +1,17 @@
1
+ require "carps/ui"
2
+
3
+ Given /^\$SAFE is (\d+)$/ do |level|
4
+ $SAFE = level.to_i
5
+ end
6
+
7
+ Then /^allow checking a file exists in response to user input$/ do
8
+ File.exists?(question "Enter file name to check existense of")
9
+ end
10
+
11
+ Then /^disallow eval in response to user input$/ do
12
+ begin
13
+ eval(question "Enter arbitrary ruby statement")
14
+ rescue InsecureOperation => e
15
+ puts "Recovered from Insecure Operation"
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ require "carps/service/session"
2
+
3
+ class ValidSessionMessage
4
+
5
+ def session
6
+ "killingjoke"
7
+ end
8
+
9
+ end
10
+
11
+ class InvalidSessionMessage
12
+
13
+ def session
14
+ "simplyred"
15
+ end
16
+
17
+ end
18
+
19
+ Given /^a session manager$/ do
20
+ $session = SessionManager.new
21
+ $session.session = "killingjoke"
22
+ end
23
+
24
+ Then /^accept a message meant for this session$/ do
25
+ now = $session.belong? ValidSessionMessage.new
26
+ unless now
27
+ raise StandardError, "SessionManager did not accept valid message."
28
+ end
29
+ end
30
+
31
+ Then /^deny a message intended for another session$/ do
32
+ now = $session.belong? InvalidSessionMessage.new
33
+ if now
34
+ raise StandardError, "SessionManager accepted invalid message."
35
+ end
36
+ end
37
+
@@ -0,0 +1,46 @@
1
+ require "carps/service/dm/config"
2
+ require "carps/service/dm/start"
3
+
4
+ require "carps/service/session"
5
+
6
+ class MockDmStartMailer
7
+ def address
8
+ "howdy"
9
+ end
10
+ end
11
+
12
+ class MockGame
13
+
14
+ def start mailer
15
+ puts "Starting game..."
16
+ end
17
+
18
+ def resume mailer
19
+ puts "Resuming game..."
20
+ end
21
+ end
22
+
23
+ class MockConfig < DM::GameConfig
24
+ def spawn
25
+ MockGame.new
26
+ end
27
+ end
28
+
29
+ Then /^host a new game called (.+) with resource (.+) and mod (.+)$/ do |game_name, campaign, mod_name|
30
+ $game = DM::GameConfig.new game_name, mod_name, campaign, "A game about things", "session12345", "dungeon_master@email.com"
31
+ end
32
+
33
+ Then /^save the game as (.+)$/ do |filename|
34
+ $game.save
35
+ end
36
+
37
+ Then /^the dm resumes a previous game called (.+)$/ do |filename|
38
+ $game = DM::GameConfig.load "games/" + filename
39
+ end
40
+
41
+ Then /^present the start game interface to the dm$/ do
42
+ begin
43
+ DM::StartInterface.start_game_interface MockDmStartMailer.new, MockConfig, $session
44
+ rescue SystemExit
45
+ end
46
+ end
@@ -0,0 +1,65 @@
1
+ require "carps/service"
2
+
3
+ require "carps/protocol"
4
+
5
+ class MockPlayerGame
6
+ def join_game mailer
7
+ puts "Joining game."
8
+ end
9
+
10
+ def resume mailer
11
+ puts "Resuming game"
12
+ end
13
+
14
+ end
15
+
16
+ class MockPlayerConfig < Player::GameConfig
17
+ def spawn
18
+ MockPlayerGame.new
19
+ end
20
+ end
21
+
22
+ class PlayerStartMailer
23
+
24
+ def read klass, from=nil
25
+ msg = nil
26
+ until msg
27
+ msg = check
28
+ sleep 1
29
+ end
30
+ msg
31
+ end
32
+
33
+ def check klass, from=nil
34
+ if @mail
35
+ mail = @mail
36
+ @mail = nil
37
+ return mail
38
+ end
39
+ end
40
+
41
+
42
+ def send to, message
43
+ puts "Sending message to #{to}:"
44
+ puts message
45
+ end
46
+
47
+ def invite
48
+ @mail = CARPS::Invite.new "the dm", "test", "the description", "the session"
49
+ end
50
+ end
51
+
52
+ Given /^a mailer stub for the player start interface$/ do
53
+ $mailer = PlayerStartMailer.new
54
+ end
55
+
56
+ When /^an invite is sent to the player$/ do
57
+ $mailer.invite
58
+ end
59
+
60
+ Then /^present the start game interface to the player$/ do
61
+ begin
62
+ Player::StartInterface.start_game_interface $mailer, MockPlayerConfig, $session
63
+ rescue SystemExit
64
+ end
65
+ end
@@ -0,0 +1,32 @@
1
+ require "carps/util/timeout"
2
+
3
+ Given /^a long running command$/ do
4
+ $command = lambda {
5
+ loop do
6
+ end
7
+ }
8
+ end
9
+
10
+ Then /^timeout the command after (\d+) second$/ do |t|
11
+ begin
12
+ CARPS::timeout t.to_i, "Test command 1" do
13
+ $command.call
14
+ end
15
+ rescue Timeout::Error => e
16
+ puts "The command was timed out as expected:"
17
+ puts e.to_s
18
+ end
19
+ end
20
+
21
+ Then /^give the command (\d+) second to complete$/ do |t|
22
+ CARPS::timeout t.to_i, "test command 2" do
23
+ $command.call
24
+ end
25
+ end
26
+
27
+ Given /^a short command$/ do
28
+ $command = lambda {
29
+ puts "Hi honey!"
30
+ }
31
+ end
32
+
@@ -0,0 +1,36 @@
1
+ require "carps/mod"
2
+
3
+ require "yaml"
4
+
5
+ Given /^an integer$/ do
6
+ $val = 123
7
+ end
8
+
9
+ Then /^verify: (.+) as a (.+)$/ do |opt, type_name|
10
+ type = Sheet::TypeParser.parse type_name
11
+ accepted, coerced = type.verify $val
12
+ pass = opt == "accept"
13
+ unless (pass and accepted) or (not pass and not accepted)
14
+ raise StandardError, "Verification mechanism fucked: should pass #{pass}, did pass #{accepted}"
15
+ end
16
+ end
17
+
18
+ Given /^a nil value$/ do
19
+ $val = nil
20
+ end
21
+
22
+ Given /^a string$/ do
23
+ $val = "howdy!"
24
+ end
25
+
26
+ Given /^'yes'$/ do
27
+ $val = YAML.load "yes"
28
+ end
29
+
30
+ Given /^'bronze'$/ do
31
+ $val = "bronze"
32
+ end
33
+
34
+ Given /^'gold'$/ do
35
+ $val = "gold"
36
+ end
@@ -0,0 +1,123 @@
1
+ require "carps/wizard/wizard"
2
+
3
+ require "fileutils"
4
+
5
+ $sweet_files = ["roses", "kittens"]
6
+ $salty_files = ["robots", "miniguns"]
7
+ $salty_dirs = ["strength", "power"]
8
+
9
+ class SweetWizard < Wizard
10
+
11
+ def initialize
12
+ super $sweet_files, []
13
+ end
14
+
15
+ end
16
+
17
+ class SillyStep < Setup::Interface
18
+
19
+ def initialize
20
+ super
21
+ end
22
+
23
+ def description
24
+ "A pretty silly configuration step that doesn't do much."
25
+ end
26
+
27
+ def test
28
+ puts "Yup, looks good to me."
29
+ test_passed
30
+ end
31
+
32
+ end
33
+
34
+ class SaltyWizard < Wizard
35
+
36
+ def initialize
37
+ super $salty_files, $salty_dirs
38
+ set_steps SillyStep.new
39
+ end
40
+
41
+ end
42
+
43
+ Then /^setup email$/ do
44
+ em = Setup::Email.new
45
+ em.run
46
+ end
47
+
48
+ Then /^setup processing$/ do
49
+ pr = Setup::Process.new
50
+ pr.run
51
+ end
52
+
53
+ Then /^setup editor$/ do
54
+ ed = Setup::Editor.new
55
+ ed.run
56
+ end
57
+
58
+ Given /^a player wizard$/ do
59
+ $wizard = Player::Wizard.new
60
+ end
61
+
62
+ Then /^clean the wizard directory$/ do
63
+ wiz = CARPS::root_config + "/wizard/"
64
+ FileUtils.rm_rf wiz
65
+ FileUtils.mkdir wiz
66
+ end
67
+
68
+ Then /^run the wizard$/ do
69
+ $wizard.run
70
+ end
71
+
72
+ Given /^a sweet wizard$/ do
73
+ FileUtils.touch $CONFIG + $sweet_files[0]
74
+ $wizard = SweetWizard.new
75
+ end
76
+
77
+ Then /^detect missing files$/ do
78
+ unless $wizard.first_time?
79
+ raise StandardError, "The wizard thought the files were present when they were not."
80
+ end
81
+ end
82
+
83
+ Given /^a salty wizard$/ do
84
+ FileUtils.touch $salty_files.map {|f| $CONFIG + "/" + f}
85
+ FileUtils.mkdir $salty_dirs.map {|f| $CONFIG + "/" + f}
86
+ $wizard = SaltyWizard.new
87
+ end
88
+
89
+ Then /^confirm files are present$/ do
90
+ if $wizard.first_time?
91
+ raise StandardError, "The wizard thought the files were not present when they were."
92
+ end
93
+ end
94
+
95
+ Given /^a partially populated folder$/ do
96
+ FileUtils.rmdir $CONFIG + $salty_dirs[0]
97
+ end
98
+
99
+ Given /^the config directory is (.+)$/ do |dir|
100
+ CARPS::config_dir dir
101
+ end
102
+
103
+ Then /^the salty wizard builds needed directories$/ do
104
+ $wizard.create_directories
105
+ dirs_exist = $salty_dirs.map {|f| File.exists?($CONFIG + "/" + f)}
106
+ unless dirs_exist.all?
107
+ raise StandardError, "Salty Wizard did not create needed directories."
108
+ end
109
+ end
110
+
111
+ When /^one of the salty wizard's files is in fact a directory$/ do
112
+ file = $CONFIG + "/" + $salty_files[0]
113
+ FileUtils.rm file
114
+ FileUtils.mkdir file
115
+ end
116
+
117
+ Then /^the wizard, attempting to create files, causes the program to exit$/ do
118
+ begin
119
+ $wizard.create_files
120
+ rescue SystemExit => e
121
+ puts e
122
+ end
123
+ end
@@ -0,0 +1,29 @@
1
+ module CommonHelpers
2
+ def in_tmp_folder(&block)
3
+ FileUtils.chdir(@tmp_root, &block)
4
+ end
5
+
6
+ def in_project_folder(&block)
7
+ project_folder = @active_project_folder || @tmp_root
8
+ FileUtils.chdir(project_folder, &block)
9
+ end
10
+
11
+ def in_home_folder(&block)
12
+ FileUtils.chdir(@home_path, &block)
13
+ end
14
+
15
+ def force_local_lib_override(project_name = @project_name)
16
+ rakefile = File.read(File.join(project_name, 'Rakefile'))
17
+ File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
18
+ f << "$:.unshift('#{@lib_path}')\n"
19
+ f << rakefile
20
+ end
21
+ end
22
+
23
+ def setup_active_project_folder project_name
24
+ @active_project_folder = File.join(@tmp_root, project_name)
25
+ @project_name = project_name
26
+ end
27
+ end
28
+
29
+ World(CommonHelpers)
@@ -0,0 +1,14 @@
1
+ require File.dirname(__FILE__) + "/../../lib/carps"
2
+
3
+ gem 'cucumber'
4
+ require 'cucumber'
5
+
6
+ # This is shit and means I can't test carps properly
7
+ # Before do
8
+ # @tmp_root = File.dirname(__FILE__) + "/../../tmp"
9
+ # @home_path = File.expand_path(File.join(@tmp_root, "home"))
10
+ # @lib_path = File.expand_path(File.dirname(__FILE__) + "/../../lib")
11
+ # FileUtils.rm_rf @tmp_root
12
+ # FileUtils.mkdir_p @home_path
13
+ # ENV['HOME'] = @home_path
14
+ # end
@@ -0,0 +1,11 @@
1
+ module Matchers
2
+ def contain(expected)
3
+ simple_matcher("contain #{expected.inspect}") do |given, matcher|
4
+ matcher.failure_message = "expected #{given.inspect} to contain #{expected.inspect}"
5
+ matcher.negative_failure_message = "expected #{given.inspect} not to contain #{expected.inspect}"
6
+ given.index expected
7
+ end
8
+ end
9
+ end
10
+
11
+ World(Matchers)
@@ -0,0 +1,11 @@
1
+ Feature: timeout
2
+ As a programmer,
3
+ I find ruby's timeout lacking.
4
+
5
+ Scenario: timeout
6
+ Given a long running command
7
+ Then timeout the command after 1 second
8
+
9
+ Scenario: no timeout
10
+ Given a short command
11
+ Then give the command 1 second to complete
@@ -0,0 +1,48 @@
1
+ Feature: type verification
2
+ In order to verify character sheets correctly
3
+ the basic types making up those character sheets must be verified
4
+
5
+ Scenario: accept integer as integer
6
+ Given an integer
7
+ Then verify: accept as a integer
8
+
9
+ Scenario: accept integer as optional integer
10
+ Given an integer
11
+ Then verify: accept as a optional integer
12
+
13
+ Scenario: accept nil as optional integer
14
+ Given a nil value
15
+ Then verify: accept as a optional integer
16
+
17
+ Scenario: deny nil as integer
18
+ Given a nil value
19
+ Then verify: deny as a integer
20
+
21
+ Scenario: deny string as integer
22
+ Given a string
23
+ Then verify: deny as a integer
24
+
25
+ Scenario: deny string as optional integer
26
+ Given a string
27
+ Then verify: deny as a optional integer
28
+
29
+ Scenario: accept boolean as boolean
30
+ Given 'yes'
31
+ Then verify: accept as a boolean
32
+
33
+ Scenario: accept nil as optional choice gold silver
34
+ Given a nil value
35
+ Then verify: accept as a optional choice gold silver
36
+
37
+ Scenario: accept nil as optional boolean
38
+ Given a nil value
39
+ Then verify: accept as a optional boolean
40
+
41
+ Scenario: accept gold as choice gold silver
42
+ Given 'gold'
43
+ Then verify: accept as a choice gold silver
44
+
45
+ Scenario: deny bronze as choice gold silver
46
+ Given 'bronze'
47
+ Then verify: deny as a choice gold silver
48
+
@@ -0,0 +1,50 @@
1
+ Feature: wizard
2
+ In order to play CARPS
3
+ we must have a valid configuration
4
+
5
+ Scenario: detect missing files
6
+ Given the config directory is wizard
7
+ Then clean the wizard directory
8
+ Given a sweet wizard
9
+ Then detect missing files
10
+
11
+ Scenario: confirm files present
12
+ Given the config directory is wizard
13
+ Then clean the wizard directory
14
+ Given a salty wizard
15
+ Then confirm files are present
16
+
17
+ Scenario: build needed directories
18
+ Given the config directory is wizard
19
+ Then clean the wizard directory
20
+ Given a salty wizard
21
+ Given a partially populated folder
22
+ Then the salty wizard builds needed directories
23
+
24
+ Scenario: fail on error
25
+ Given the config directory is wizard
26
+ Then clean the wizard directory
27
+ Given a salty wizard
28
+ Given one of the salty wizard's files is in fact a directory
29
+ Then the wizard, attempting to create files, causes the program to exit
30
+
31
+ Scenario: setup email
32
+ Given the config directory is wizard
33
+ Then clean the wizard directory
34
+ Then setup email
35
+
36
+ Scenario: setup processing
37
+ Given the config directory is wizard
38
+ Then clean the wizard directory
39
+ Then setup processing
40
+
41
+ Scenario: setup editor
42
+ Given the config directory is wizard
43
+ Then clean the wizard directory
44
+ Then setup editor
45
+
46
+ Scenario: configure player
47
+ Given the config directory is wizard
48
+ Then clean the wizard directory
49
+ Given a salty wizard
50
+ Then run the wizard
@@ -0,0 +1,40 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of CARPS.
4
+
5
+ # CARPS is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # CARPS is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with CARPS. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require "carps/protocol/message"
19
+
20
+ module CARPS
21
+
22
+ class AcceptHandshake < Message
23
+
24
+ # Extend the protocol for this OKAY message
25
+ protoword :accept_handshake
26
+
27
+ # Parse from the void
28
+ def AcceptHandshake.parse blob
29
+ forget, blob = find K.accept_handshake, blob
30
+ [AcceptHandshake.new, blob]
31
+ end
32
+
33
+ # Emit
34
+ def emit
35
+ K.accept_handshake
36
+ end
37
+
38
+ end
39
+
40
+ end
@@ -0,0 +1,29 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of CARPS.
4
+
5
+ # CARPS is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # CARPS is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with CARPS. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require "carps/crypt/handshake"
19
+ require "carps/crypt/public_key"
20
+ require "carps/crypt/accept_handshake"
21
+
22
+ module CARPS
23
+
24
+ # Services will be built by extending upon these messages
25
+ def default_messages
26
+ [Handshake, AcceptHandshake, PublicKey]
27
+ end
28
+
29
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of CARPS.
4
+
5
+ # CARPS is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # CARPS is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with CARPS. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require "carps/protocol/message"
19
+
20
+ module CARPS
21
+
22
+ # A cryptographic handshake request
23
+ class Handshake < Message
24
+
25
+ # Extend the protocol for this request
26
+ protoword :handshake
27
+
28
+ # Parse from the void
29
+ def Handshake.parse blob
30
+ forget, blob = find K.handshake, blob
31
+ [Handshake.new, blob]
32
+ end
33
+
34
+ # Emit
35
+ def emit
36
+ K.handshake
37
+ end
38
+
39
+ end
40
+
41
+ end