Пример #1
0
class Step2(StepTemplateRm):
    story = [
        _("The rabbit stops. The anger behind its eyes fades, replaced with confusion."
          ), "",
        _("The Swordmaster runs into the {{bb:rabbithole}}."), "",
        _("Swordmaster: {{Bb:\"You did it! The rabbit is free from the cursed bell, and you saved everyone!\"}}"
          ), "",
        _("{{Bb:\"Have you looked inside the}} {{bb:chest}} {{Bb:the rabbit stole? It's right here.\"}}"
          )
    ]
    start_dir = "~/woods/thicket/rabbithole"
    end_dir = "~/woods/thicket/rabbithole"
    commands = ["cat chest/scroll"]
    hints = [
        _("{{rb:Use}} {{yb:cat chest/scroll}} {{rb:to examine the contents.}}")
    ]
    deleted_items = ["~/woods/thicket/rabbithole/Rabbit"]

    file_list = [{
        "path": "~/woods/thicket/rabbithole/Swordmaster",
        "contents": get_story_file("swordmaster-without-sword")
    }, {
        "path": "~/woods/thicket/rabbithole/Rabbit",
        "contents": get_story_file("Rabbit-cute")
    }]

    def check_command(self, line):
        if line == "cat chest/torn-note":
            return False
        return StepTemplateRm.check_command(self, line)

    def next(self):
        return 46, 3
Пример #2
0
class Step1(StepTemplateNano):
    story = [
        _("Enough wandering. Time to find the Swordmaster."),
        _("Clara said that he was in the woods just off the {{lb:Windy Road}} {{yb:~}}."
          ),
        _("Use {{yb:cd}} to head there now.")
    ]
    start_dir = "~/town/east/shed-shop/basement"
    end_dir = "~"
    hints = [
        _("{{rb:Use}} {{yb:cd}} {{rb:by itself to go back to the Windy Road ~}}"
          )
    ]

    file_list = [{
        "path": "~/woods/clearing/house",
        "permissions": 0000,
        "type": "directory"
    }, {
        "path": "~/woods/clearing/signpost",
        "permissions": 0644,
        "type": "file",
        "contents": get_story_file("signpost")
    }, {
        "path": "~/woods/clearing/house/Swordmaster",
        "contents": get_story_file("swordmaster")
    }]

    # Maybe this could be reduced to an argument in the class.
    def block_command(self, line):
        return unblock_cd_commands(line)

    def next(self):
        return 32, 2
Пример #3
0
class Step6(StepTemplateSudo):
    story = [
        _("The towns people cheer as you walk into town."),
        _("{{lb:Look around.}}")
    ]
    commands = ["ls"]
    start_dir = "~/town"
    end_dir = "~/town"

    hints = [_("{{rb:Use}} {{yb:ls}} {{rb:to look around.}}")]

    file_list = [{
        "path": "~/town/Rabbit",
        "contents": get_story_file("Rabbit-cute")
    }, {
        "path": "~/town/Swordmaster",
        "contents": get_story_file("swordmaster-without-sword")
    }]

    deleted_items = [
        "~/woods/thicket/rabbithole/Rabbit",
        "~/woods/thicket/rabbithole/Swordmaster"
    ]

    def next(self):
        return 46, 7
Пример #4
0
class Step5(StepTemplateSudo):
    story = [
        _("Swordmaster: {{Bb:\"Well done!\"}}"),
        _("{{Bb:\"Let's go back to}} {{bb:~/town}}{{Bb:. Everyone will want to thank you!\"}}"
          )
    ]

    start_dir = "~/woods/thicket/rabbithole"
    end_dir = "~/town"
    file_list = [{
        "path": "~/town/Ruth",
        "contents": get_story_file("Ruth")
    }, {
        "path": "~/town/Clara",
        "contents": get_story_file("Clara")
    }, {
        "path": "~/town/Eleanor",
        "contents": get_story_file("Eleanor")
    }]

    def block_command(self, last_user_input):
        return unblock_cd_commands(last_user_input)

    def next(self):
        return 46, 6
Пример #5
0
    def test_file_does_not_exist_challenge_2(self):
        tree = {
            "name": "~",
            "children": [
                {
                    "name": "Dad",
                    "contents": get_story_file("Dad"),
                    "challenges": [
                        {
                            "challenge": 1,
                            "step": 1
                        },
                        {
                            "challenge": 2,
                            "step": 1,
                            "exists": False
                        }
                    ],
                }
            ]
        }

        FileTree(tree, self.__end_path).parse_complete(2, 2)
        dad = os.path.join(self.__end_path, "~/Dad")
        self.assertFalse(os.path.exists(dad))
Пример #6
0
class Step1(StepTemplateMkdir):
    story = [
        _("You are back in {{bb:Bernard}}'s place.\n"),
        _("{{lb:Listen}} to what {{bb:Bernard}} has to say.")
    ]

    start_dir = "~/town/east/shed-shop"
    end_dir = "~/town/east/shed-shop"

    hints = [
        _("{{rb:Use}} {{yb:cat Bernard}} {{rb:to interact with Bernard.}}")
    ]

    commands = ["cat Bernard"]

    deleted_items = ["~/town/east/library/Eleanor"]
    file_list = [{
        "path": "~/town/east/shed-shop/Eleanor",
        "contents": get_story_file("Eleanor"),
        "type": "file"
    }]
    companion_speech = (
        _("Eleanor: {{Bb:\"Achoo! This place is really dusty...*sniff*\"}}"))

    def next(self):
        return 27, 2
Пример #7
0
 def test_containing_folder_outside_challenge_scope_then_child_file_is(
         self):
     tree = {
         "name":
         "~",
         "children": [{
             "name":
             "my-house",
             "challenges": [{
                 "challenge": 1,
                 "step": 1,
                 "exists": False
             }, {
                 "challenge": 2,
                 "step": 1
             }],
             "children": [{
                 "name": "Dad",
                 "contents": get_story_file("Dad"),
                 "challenges": [{
                     "challenge": 2,
                     "step": 1
                 }]
             }]
         }]
     }
     FileTree(tree, self.__end_path).parse_complete(1, 9)
     house = os.path.join(self.__end_path, "~/my-house")
     dad = os.path.join(house, "Dad")
     self.assertFalse(os.path.exists(house))
     self.assertFalse(os.path.exists(dad))
Пример #8
0
class Step3(StepTemplateNano):
    story = [
        _("You and {{bb:Eleanor}} walk into the {{bb:restaurant}}.\n"),
        _("Look around {{lb:closely}}.")
    ]

    start_dir = "~/town/east/restaurant"
    end_dir = "~/town/east/restaurant"

    hints = [
        _("Eleanor: {{Bb:Do you remember how you found me? You used}} {{yb:ls -a}} {{Bb:right?}}"
          )
    ]

    commands = ["ls -a"]

    deleted_items = ["~/town/east/Eleanor"]
    file_list = [{
        "path": "~/town/east/restaurant/Eleanor",
        "contents": get_story_file("Eleanor"),
        "type": "file"
    }]

    companion_speech = _("Eleanor: {{Bb:It seems really empty here...}}")

    def next(self):
        return 28, 4
Пример #9
0
class Step1(StepTemplateNano):
    story = [
        _("You're back in town. {{bb:Eleanor}} looked relieved to be outside."
          ),
        _("Where could the {{bb:librarian}} be hiding?\n"),
        _("{{lb:Look around}} to decide where to go next.")
    ]

    start_dir = "~/town/east"
    end_dir = "~/town/east"

    hints = [_("{{rb:Use}} {{yb:ls}} {{rb:to look around.}}")]

    deleted_items = ["~/town/east/shed-shop/Eleanor"]
    file_list = [{
        "path": "~/town/east/Eleanor",
        "contents": get_story_file("Eleanor")
    }]

    commands = ["ls", "ls -a"]

    companion_speech = _(
        "Eleanor: {{Bb:\"I'm hungry. Can you see anywhere we could eat?\"}}")

    def next(self):
        return 28, 2
Пример #10
0
class Step2(StepTemplateCd):
    story = [
        _("{{pb:Ding. Dong.}}\n"),
        _("Type {{yb:cd my-house/kitchen}} to go straight to the {{bb:kitchen}}.\n"),
        _("{{gb:Press}} {{ob:TAB}} {{gb:to speed up your typing!}}")
    ]
    start_dir = "~"
    end_dir = "~/my-house/kitchen"
    commands = ["cd my-house/kitchen", "cd my-house/kitchen/"]
    hints = [
        _("{{rb:Use}} {{yb:cd my-house/kitchen}} {{rb:to go to the kitchen.}}")
    ]
    file_list = [
        {
            "path": "~/my-house/kitchen/note",
            "contents": get_story_file("note_kitchen"),
            "type": "file"
        }
    ]
    deleted_items = ['~/my-house/kitchen/Mum', '~/town/note']

    def block_command(self, line):
        return unblock_commands_with_cd_hint(line, self.commands)

    def next(self):
        return 9, 3
Пример #11
0
class Step5(StepTemplateNano):
    story = [
        _("{{bb:Eleanor}} grabs your hand, and the two of you walk into the {{bb:cellar}}.\n"
          ),
        _("{{lb:Look around.}}")
    ]

    start_dir = "~/town/east/restaurant/.cellar"
    end_dir = "~/town/east/restaurant/.cellar"

    hints = [_("{{rb:Look around with}} {{yb:ls}}{{rb:.}}")]

    deleted_items = ["~/town/east/restaurant/Eleanor"]
    file_list = [{
        "path": "~/town/east/restaurant/.cellar/Eleanor",
        "contents": get_story_file("Eleanor"),
        "type": "file"
    }]
    commands = ["ls", "ls -a"]

    companion_speech = _("Eleanor: {{Bb:\"...is there someone there?\"}}")

    def _run_at_start(self):
        sound_manager = SoundManager()
        sound_manager.play_sound('steps')

    def next(self):
        return 28, 6
Пример #12
0
class Step4(StepEleanorMkdir):
    start_dir = "~/town"
    end_dir = "~/town"
    hints = [
        _("Eleanor: {{Bb:Have you forgotten how to look around? " +\
        "You need to use}} {{yb:ls}}{{Bb:.}}"),

        _("{{rb:Look around with}} {{yb:ls}}{{rb:.}}")
    ]
    commands = [
        "ls",
        "ls -a"
    ]
    deleted_items = ["~/town/.hidden-shelter/Eleanor"]
    file_list = [
        {
            "path": "~/town/Eleanor",
            "contents": get_story_file("Eleanor")
        }
    ]

    story = [
        _("Eleanor: {{Bb:\"Let's go to the}} {{bb:east}} {{Bb:of town.\"}}"),
        _("{{Bb:\"Haven't you noticed it before? It's over there! Look over there.\"}}"),
        _("\nUse {{yb:ls}} to see what {{bb:Eleanor}} is trying to show you.")
    ]

    companion_speech = (
        _("\nEleanor: {{Bb:Why are you looking at me? You should be looking over THERE.}}")
    )

    def next(self):
        return 23, 5
Пример #13
0
    def test_basic_file(self):
        tree = {
            "name":
            "~",
            "children": [{
                "name": "Dad",
                "contents": get_story_file("Dad"),
                "permissions": 0755
            }]
        }

        FileTree(tree, self.__end_path).parse_complete(1, 1)
        dad = os.path.join(self.__end_path, "~/Dad")
        self.assertTrue(os.path.exists(dad))
        self.assertTrue(os.path.isfile(dad))
        self.assertTrue(is_executable(dad))
        self.assertTrue(filecmp.cmp(dad, get_story_file("Dad"), shallow=False))
Пример #14
0
class Step3(StepTemplateChmod):
    story = [
        _("Awesome, you unlocked it! {{lb:Go inside the private-section.}}")
    ]
    start_dir = "~/town/east/library"
    end_dir = "~/town/east/library/private-section"
    hints = ["{{rb:Use}} {{yb:cd private-section/}} {{rb:to go inside.}}"]
    file_list = [{
        "path": "~/town/east/library/private-section/chest/scroll",
        "contents": get_story_file("scroll"),
        "permissions": 0644,
        "type": "file"
    }, {
        "path": "~/town/east/library/private-section/chest/torn-note",
        "contents": get_story_file("torn-note"),
        "permissions": 0644,
        "type": "file"
    }]
Пример #15
0
    def test_basic_file(self):
        tree = {
            "name": "~",
            "children": [
                {
                    "name": "Dad",
                    "contents": get_story_file("Dad"),
                    "permissions": 0755
                }
            ]
        }

        FileTree(tree, self.__end_path).parse_complete(1, 1)
        dad = os.path.join(self.__end_path, "~/Dad")
        self.assertTrue(os.path.exists(dad))
        self.assertTrue(os.path.isfile(dad))
        self.assertTrue(is_executable(dad))
        self.assertTrue(filecmp.cmp(dad, get_story_file("Dad"), shallow=False))
Пример #16
0
class Step1(StepTemplateChmod):
    story = [
        _("Swordsmaster:{{Bb:\"...this is very strange. I left the door open. Perhaps someone...or "
          "something...sneaked in while we were talking.\"}}"),
        _("{{Bb:\"You may need my help later. Come back if you are blocked by lack of knowledge.\"}}"
          ), "",
        _("Time to head off - {{lb:leave}} the Swordmaster's house.")
    ]
    start_dir = "~/woods/clearing/house"
    end_dir = "~/woods/clearing"

    hints = [_("{{rb:Leave the house with}} {{yb:cd ..}}")]

    file_list = [{
        "contents": get_story_file("note_woods"),
        "path": "~/woods/note",
        "permissions": 0644,
        "type": "file"
    }, {
        "contents": get_story_file("Rabbit"),
        "path": "~/woods/thicket/Rabbit",
        "permissions": 0644,
        "type": "file"
    }, {
        "path": "~/woods/thicket/rabbithole",
        "permissions": 0755,
        "type": "directory"
    }, {
        "contents": get_story_file("note_swordsmaster-clearing"),
        "path": "~/woods/clearing/note",
        "permissions": 0644,
        "type": "file"
    }, {
        "contents": get_story_file("note_rabbithole"),
        "path": "~/woods/thicket/note",
        "permissions": 0644,
        "type": "file"
    }]
Пример #17
0
class Step1(StepTemplateChmod):
    story = [
        _("You set off the firework!"),
        _("{{gb:You learnt all the chmod commands.}}"), "",
        _("{{lb:Thunk.}}"), "",
        _("Something new landed in front of you."),
        _("{{lb:Look around}} to see what it is.")
    ]
    file_list = [{
        "path": "~/woods/cave/chest",
        "permissions": 0000,
        "type": "directory"
    }, {
        "path": "~/woods/cave/chest/answer",
        "type": "file",
        "permissions": 0644,
        "contents": get_story_file("answer-cave")
    }, {
        "path": "~/woods/cave/chest/riddle",
        "type": "file",
        "permissions": 0644,
        "contents": get_story_file("riddle-cave")
    }]
Пример #18
0
class Step4(StepTemplateChmod):
    story = [_("Have a {{lb:look around.}}")]
    start_dir = "~/town/east/library/private-section"
    end_dir = "~/town/east/library/private-section"
    commands = [
        "ls", "ls -a", "cat chest/scroll", "cat chest/torn-note", "ls chest",
        "ls chest/", "ls chest/scroll", "ls chest/torn-note"
    ]
    file_list = [{
        "path": "~/town/east/library/private-section/Rabbit",
        "contents": get_story_file("Rabbit"),
        "permissions": 0644,
        "type": "file"
    }]
Пример #19
0
class Step1(StepTemplateChmod):
    story = [
        _("Now, which is the locked room? {{lb:Look around}} to remind yourself."
          )
    ]
    start_dir = "~/town/east/library"
    end_dir = "~/town/east/library"
    commands = ["ls", "ls -a"]
    hints = [_("{{rb:Use}} {{yb:ls}} {{rb:to look around.}}")]
    file_list = [{
        "path": "~/town/east/library/Rabbit",
        "contents": get_story_file("Rabbit"),
        "permissions": 0644,
        "type": "file"
    }]
Пример #20
0
 def test_containing_folder_outside_challenge_scope_then_child_folder_is(self):
     tree = {
         "name": "~",
         "children": [
             {
                 "name": "my-house",
                 "challenges": [
                     {
                         "challenge": 1,
                         "step": 1,
                         "exists": False
                     },
                     {
                         "challenge": 2,
                         "step": 1
                     }
                 ],
                 "children": [
                     {
                         "name": "greenhouse",
                         "challenges": [
                             {
                                 "challenge": 2,
                                 "step": 1
                             }
                         ],
                         "children": [
                             {
                                 "name": "Dad",
                                 "contents": get_story_file("Dad"),
                                 "challenges": [
                                     {
                                         "challenge": 2,
                                         "step": 1
                                     }
                                 ]
                             }
                         ]
                     }
                 ]
             }
         ]
     }
     FileTree(tree, self.__end_path).parse_complete(1, 9)
     house = os.path.join(self.__end_path, "~/my-house")
     dad = os.path.join(house, "Dad")
     self.assertFalse(os.path.exists(house))
     self.assertFalse(os.path.exists(dad))
Пример #21
0
class Step5(StepTemplateChmod):
    story = [
        _("Swordmaster: {{Bb:\"I thought you might be. Few have the power to use the commands you used earlier."
          ),
        _("How did I know your name? Use}} {{yb:ls -l}} {{Bb:to see.\"}}")
    ]
    commands = ["ls -l", "ls -l .", "ls -l ./"]
    start_dir = "~/woods/clearing/house"
    end_dir = "~/woods/clearing/house"

    file_list = [{
        "contents": get_story_file("note_swordsmaster-house"),
        "path": "~/woods/clearing/house/note",
        "permissions": 0644,
        "type": "file"
    }]
Пример #22
0
class Step3(StepTemplateMv):
    story = [
        _("Check you've managed to move the {{bb:apple}}. {{lb:Look around}} in this directory.\n"
          )
    ]
    start_dir = "~/town/.hidden-shelter"
    end_dir = "~/town/.hidden-shelter"
    commands = ["ls", "ls -a"]
    hints = [_("{{rb:Use}} {{yb:ls}} {{rb:to look around.}}")]
    file_list = [{
        "path": "~/town/.hidden-shelter/basket/apple",
        "contents": get_story_file("apple"),
        "type": "file"
    }]

    def next(self):
        return 11, 4
Пример #23
0
class Step1(StepTemplateMv):
    story = [
        _("You're in your room, standing in front of the {{bb:.chest}} containing all the commands "
          "you've learned so far.\n"),
        _("Maybe something else is hidden in the house?\n"),
        _("{{lb:Look}} in the hallway {{lb:behind you}}. Remember, behind you is {{bb:..}}"
          )
    ]
    start_dir = "~/my-house/my-room"
    end_dir = "~/my-house/my-room"
    file_list = [{
        "path": "~/farm/barn/Cobweb"
    }, {
        "path": "~/farm/barn/Daisy"
    }, {
        "path": "~/farm/barn/Ruth"
    }, {
        "path": "~/farm/barn/Trotter"
    }, {
        "path": "~/farm/toolshed/MKDIR"
    }, {
        "path": "~/farm/toolshed/spanner"
    }, {
        "path": "~/farm/toolshed/hammer"
    }, {
        "path": "~/farm/toolshed/saw"
    }, {
        "path": "~/farm/toolshed/tape-measure"
    }, {
        "path": "~/farm/farmhouse/bed",
        "contents": get_story_file("bed_farmhouse")
    }, {
        "path": "~/farm/toolshed/MKDIR"
    }, {
        "path": "~/my-house/parents-room/.safe/ECHO"
    }, {
        "path": "~/my-house/parents-room/.safe/mums-diary"
    }, {
        "path": "~/my-house/parents-room/.safe/map"
    }]
    hints = [_("{{rb:Look behind you with}} {{yb:ls ../}}")]
    commands = ["ls ..", "ls ../"]

    def next(self):
        return 17, 2
Пример #24
0
class Step1(StepTemplateChmod):
    story = [
        _("You stand alone in the library. The Rabbit has stolen the command."),
        _("There is a growing sense of impending doom. Then, the Swordmaster runs into the room."),
        "",
        _("Swordmaster: {{Bb:\"What have you done?\"}}"),
        "",
        "{{yb:1:}} " + REPLY_PRINT_TEXT,
        _("{{yb:2: Nothing.}}")
    ]
    start_dir = "~/town/east/library/private-section"
    end_dir = "~/town/east/library/private-section"
    file_list = [
        {
            "path": "~/town/east/library/private-section/Swordmaster",
            "contents": get_story_file("swordmaster"),
            "permissions": 0644,
            "type": "file"
        }
    ]
Пример #25
0
class Step2(StepTemplateCd):
    story = [
        _("You've left {{bb:my-room}} and are in the hall of {{bb:my-house}}.\n"),
        _("{{lb:Look around}} at the different rooms using {{yb:ls}}.\n")
    ]
    start_dir = "~/my-house"
    end_dir = "~/my-house"
    commands = "ls"
    hints = [_("{{rb:Type}} {{yb:ls}} {{rb:and press}} {{ob:Enter}}{{rb:.}}")]
    file_list = [
        {
            "path": "~/my-house/garden/greenhouse/note",
            "contents": get_story_file("note_greenhouse"),
            "type": "file"
        }
    ]
    deleted_items = ['~/my-house/garden/greenhouse/Dad']

    def next(self):
        return 4, 3
Пример #26
0
class Step1(StepTemplateChmod):
    story = [
        _("The bird dropped a {{bb:scroll}} in the {{bb:cage}}."),
        _("{{lb:Examine}} the scroll.")
    ]

    start_dir = "~/woods/cave"
    end_dir = "~/woods/cave"
    commands = ["cat cage/scroll"]
    hints = [
        _("{{rb:Use}} {{yb:cat cage/scroll}} {{rb:to examine the scroll.}}")
    ]
    file_list = [{
        "path": "~/woods/cave/cage/scroll",
        "contents": get_story_file("scroll-cage")
    }]
    deleted_items = ["~/woods/cave/bird"]

    def next(self):
        return 36, 2
Пример #27
0
class Step5(StepTemplateCd):

    story = [
        _("{{wb:Mayor:}} {{Bb:\"Everyone...has disappeared??\"\n"),
        _("\"....I should head home now...\"}}"),
        _("\n{{pb:Ding. Dong.}}\n")
    ]
    start_dir = "~/town"
    end_dir = "~/town"
    commands = "ls"
    hints = [_("{{rb:Use}} {{yb:ls}} {{rb:to look around.}}")]
    deleted_items = ["~/town/Mayor"]
    file_list = [{
        "path": "~/town/note",
        "contents": get_story_file("note_town"),
        "type": "file"
    }]

    def next(self):
        return 8, 6
Пример #28
0
class Step1(StepNano):
    story = [
        _("{{pb:Ding. Dong.}}\n"),
        _("\nEleanor: {{Bb:\"...what was that?\"}}\n"),
        _("{{lb:Look around.}}")
    ]
    start_dir = "~/town/east/restaurant/.cellar"
    end_dir = "~/town/east/restaurant/.cellar"
    commands = ["ls", "ls -a"]
    hints = [
        _("{{rb:Use}} {{yb:ls}} {{rb:to check everyone is still present.}}")
    ]
    deleted_items = ["~/town/east/shed-shop/Bernard"]
    file_list = [{
        "path": "~/town/east/shed-shop/Bernards-hat",
        "contents": get_story_file("bernards-hat")
    }]
    companion_speech = _("Eleanor: {{Bb:......}}")

    def next(self):
        return 30, 2
Пример #29
0
class Step3(StepTemplateMkdir):
    story = [
        _("{{bb:Eleanor}} skips into the {{bb:library}}, while you follow her.\n"
          ),
        _("{{lb:Look around}} the {{bb:library}}.")
    ]

    start_dir = "~/town/east/library"
    end_dir = "~/town/east/library"

    hints = [_("{{rb:Use}} {{yb:ls}} {{rb:to look around.}}")]
    commands = ["ls", "ls -a"]
    deleted_items = ["~/town/east/Eleanor"]
    file_list = [{
        "path": "~/town/east/library/Eleanor",
        "contents": get_story_file("Eleanor")
    }]
    companion_speech = _("Eleanor: {{Bb:It's all echo-y-y-y-y..}}")

    def next(self):
        return 26, 4
Пример #30
0
def modify_file_tree(items):
    if not items:
        return

    file_tree = FileTree(None, tq_file_system)
    for f in items:
        if "path" not in f:
            raise Exception("Not all info available for item " + str(f))
        if "type" not in f:
            f["type"] = "file"
        if f["type"] == "file" and "contents" not in f:
            f["contents"] = get_story_file(f["path"].split("/")[-1])

        if f["type"] == "directory":
            f["contents"] = ""
            if "permissions" not in f:
                f["permissions"] = 0755
        elif "permissions" not in f:
                f["permissions"] = 0644

        file_tree.create_item(f["type"], f["path"], f["permissions"], f["contents"])
Пример #31
0
class Step2(StepTemplateEcho):
    story = [
        _("{{bb:Ruth}} follows you into the {{bb:toolshed}}. It's a very large " +\
        "space with tools lining the walls.\n"),
        _("Ruth: {{Bb:\"Let's}} {{lb:look around}} {{Bb:for " +\
        "anything that could be useful.\"}}\n")
    ]
    start_dir = "~/farm/toolshed"
    end_dir = "~/farm/toolshed"
    hints = [_("{{rb:Use}} {{yb:ls}} {{rb:to look around.}}")]
    commands = ["ls", "ls -a", "ls .", "ls ./", "ls -a .", "ls -a ./"]
    # Move Ruth into toolshed
    file_list = [{
        "path": "~/farm/toolshed/Ruth",
        "contents": get_story_file("Ruth"),
        "type": "file"
    }]
    deleted_items = ["~/farm/barn/Ruth"]

    def next(self):
        return 20, 3
Пример #32
0
class Step1(StepTemplateRm):
    story = [
        _("Woah! You destroyed the note."), "",
        _("It's time to find that rabbit and put an end to this madness."),
        _("{{lb:Go to where you met the rabbit.}}")
    ]
    start_dir = "~/town/east/library/private-section"
    end_dir = "~/woods/thicket"

    hints = [
        "",
        _("{{lb:You met the rabbit in the}} {{bb:~/woods/thicket}}"),
        _("{{rb:Use}} {{yb:cd ~/woods/thicket}}")
    ]
    dark_theme = True

    file_list = [{
        "path": "~/town/east/library/rabbithole/Swordmaster",
        "contents": get_story_file("swordmaster"),
        "permissions": 0644,
        "type": "file"
    }]
Пример #33
0
 def __containing_folder_with_permission_removed(self, permissions, string_permissions):
     tree = {
         "name": "~",
         "children": [
             {
                 "name": "my-house",
                 "type": FileTree.TYPE_DIR,
                 "permissions": permissions,
                 "children": [
                     {
                         "name": "Dad",
                         "contents": get_story_file("Dad")
                     }
                 ]
             }
         ]
     }
     FileTree(tree, self.__end_path).parse_complete(1, 1)
     house = os.path.join(self.__end_path, "~/my-house")
     dad = os.path.join(house, "Dad")
     self.assertEquals(get_oct_permissions(house), string_permissions)
     os.chmod(house, 0755)
     self.assertTrue(os.path.exists(dad))
Пример #34
0
class Step7(StepTemplateChmod):
    story = [
        _("A {{bb:note}} flutters through the air. You catch it. {{lb:Read it}}."
          )
    ]

    start_dir = "~/town/east/library/private-section"
    end_dir = "~/town/east/library/private-section"

    commands = ["cat note"]

    hints = [_("{{rb:Read the note with}} {{yb:cat note}}")]

    file_list = [{
        "contents": get_story_file("note_private-section"),
        "path": "~/town/east/library/private-section/note"
    }]

    def _run_at_start(self):
        Animation("rabbit-animation").play_across_screen(speed=10)

    def next(self):
        return 42, 8
Пример #35
0
            "exists": False
        },
        {
            "challenge": 13,
            "step": 5
        },
        {
            "challenge": 14,
            "step": 4,
            "exists": False
        }
    ],
    "children": [
        {
            "name": "empty-bottle",
            "contents": get_story_file("empty-bottle")
        }
    ]
}

kitchen = {
    "name": "kitchen",
    "children": [
        basket,
        {
            "name": "banana",
            "contents": get_story_file("banana"),
            "challenges": [
                {
                    "challenge": 0,
                    "step": 1
Пример #36
0
from linux_story.common import get_story_file

safe = {
    "name": ".safe",
    "challenges": [
        {
            "challenge": 17,
            "step": 1
        }
    ],
    "children": [
        {
            "name": "mums-diary",
            "contents": get_story_file("mums-diary"),
        },
        {
            "name": "ECHO",
            "contents": get_story_file("ECHO"),
        },
        {
            "name": "map",
            "contents": get_story_file("map"),
        }
    ]
}

parents_room = {
    "name": "parents-room",
    "children": [
        {
            "name": "picture",
Пример #37
0
     },
     {
         "challenge": 44,
         "step": 5,
         "permissions": 0500
     },
     {
         "challenge": 45,
         "step": 6,
         "permissions": 0755
     }
 ],
 "children": [
     {
         "name": "Bernard",
         "contents": get_story_file("Bernard")
     },
     {
         "name": "Edith",
         "contents": get_story_file("Edith")
     },
     {
         "name": "Edward",
         "contents": get_story_file("Edward")
     },
     {
         "name": "dog",
         "contents": get_story_file("dog")
     },
     {
         "name": "Swordmaster",
Пример #38
0
# shed-shop.py
#
# Copyright (C) 2014-2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#


from linux_story.common import get_story_file

shed_shop = {
    "name": "shed-shop",
    "children": [
        {
            "name": "Eleanor",
            "contents": get_story_file("Eleanor"),
            "challenges": [
                {
                    "challenge": 0,
                    "step": 1,
                    "exists": False
                },
                {
                    "challenge": 24,
                    "step": 4
                },
                {
                    "challenge": 26,
                    "step": 1,
                    "exists": False
                },
                {
Пример #39
0
from shed_shop import shed_shop
from library import library


restaurant = {
    "name": "restaurant",
    "children": [
        {
            "name": "",
            "children": [
                {
                    "name": ".cellar",
                    "children": [
                        {
                            "name": "Clara",
                            "contents": get_story_file("Clara")
                        },
                        {
                            "name": "Eleanor",
                            "contents": get_story_file("Eleanor"),
                            "challenges": [
                                {
                                    "challenge": 0,
                                    "step": 1,
                                    "exists": False
                                },
                                {
                                    "challenge": 28,
                                    "step": 5
                                }
                            ]
Пример #40
0
from linux_story.common import get_story_file

shelves = {
    "name": "shelves",
    "children":
        [
            {
                "name": "redwall",
                "contents": get_story_file("redwall")
            },
            {
                "name": "watership-down",
                "contents": get_story_file("watership-down")
            },
            {
                "name": "alice-in-wonderland",
                "contents": get_story_file("alice-in-wonderland")
            },
            {
                "name": "comic-book",
                "contents": get_story_file("comic-book")
            },
            {
                "name": "note",
                "contents": get_story_file("note_my-room")
            }
        ]
}

wardrobe = {
    "name": "wardrobe",
Пример #41
0
from linux_story.common import get_story_file

chest = {
    "name": "chest",
    "children": [
        {
            "name": "scroll",
            "contents": get_story_file("scroll"),
        },
        {
            "name": "torn-note",
            "contents": get_story_file("torn-note")
        }
    ],
    "challenges": [
        {
            "challenge": 0,
            "step": 1,
            "exists": False
        },
        {
            "challenge": 44,
            "step": 5
        }
    ]
}
Пример #42
0
from linux_story.common import get_story_file

greenhouse = {
    "name": "greenhouse",
    "children": [
        {
            "name": "carrots",
            "contents": get_story_file("carrots")
        },
        {
            "name": "pumpkin",
            "contents": get_story_file("pumpkin")
        },
        {
            "name": "tomato",
            "contents": get_story_file("tomato")
        },
        {
            "name": "onion",
            "contents": get_story_file("onion")
        },
        {
            "name": "Dad",
            "contents": get_story_file("Dad"),
            "challenges": [
                {
                    "challenge": 0,
                    "step": 1
                },
                {
                    "challenge": 4,
Пример #43
0
 "challenges": [
     {
         "challenge": 0,
         "step": 1,
         "exists": False
     },
     {
         "challenge": 40,
         "step": 1
     }
 ],
 "children": [
     rabbithole,
     {
         "name": "Rabbit",
         "contents": get_story_file("Rabbit"),
         "challenges": [
             {
                 "challenge": 0,
                 "step": 1,
                 "exists": False
             },
             {
                 "challenge": 40,
                 "step": 1
             },
             {
                 "challenge": 42,
                 "step": 1,
                 "exists": False
             }
Пример #44
0
# hidden_shelter.py
#
# Copyright (C) 2014-2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#

from linux_story.common import get_story_file

eleanor_hidden_shelter = {
    "name": "Eleanor",
    "contents": get_story_file("Eleanor"),
    "challenges": [
        {
            "challenge": 10,
            "step": 1
        },
        {
            "challenge": 11,
            "step": 6,
            "exists": False
        },
        {
            "challenge": 12,
            "step": 1
        },
        {
            "challenge": 23,
            "step": 4,
            "exists": False
        }
    ]
Пример #45
0
    "challenges": [
        {
            "challenge": 32,
            "step": 1,
            "permissions": 0300
        },
        {
            "challenge": 35,
            "step": 1,
            "permissions": 0700
        }
    ],
    "children": [
        {
            "name": "sign",
            "contents": get_story_file("x-sign")
        }
    ]
}

cage_room = {
    "name": "cage",
    "challenges": [
        {
            "challenge": 32,
            "step": 1,
            "permissions": 0500
        },
        {
            "challenge": 35,
            "step": 6,
Пример #46
0
# clearing.py
#
# Copyright (C) 2014-2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#

from linux_story.common import get_story_file

house = {
    "name": "house",
    "children": [
        {
           "name": "Swordmaster",
            "contents": get_story_file("swordmaster"),
            "challenges": [
                {
                    "challenge": 0,
                    "step": 1,
                    "exists": False
                },
                {
                    "challenge": 32,
                    "step": 1
                },
                {
                    "challenge": 43,
                    "step": 1,
                    "exists": False
                }
            ]
        },
Пример #47
0
         "exists": False
     },
     {
         "challenge": 14,
         "step": 4
     },
     {
         "challenge": 14,
         "step": 5,
         "exists": False
     }
 ],
 "children": [
     {
         "name": "banana",
         "contents": get_story_file("banana"),
         "challenges": [
             {
                 "challenge": 14,
                 "step": 4
             }
         ]
     },
     {
         "name": "cake",
         "contents": get_story_file("cake"),
         "challenges": [
             {
                 "challenge": 14,
                 "step": 4
             }
Пример #48
0
 "name": ".shelter",
 "challenges": [
     {
         "challenge": 0,
         "step": 1,
         "exists": False
     },
     {
         "challenge": 21,
         "step": 7
     }
 ],
 "children": [
     {
         "name": "Cobweb",
         "contents": get_story_file("Cobweb"),
         "challenges": [
             {
                 "challenge": 21,
                 "step": 10
             }
         ]
     },
     {
         "name": "Trotter",
         "contents": get_story_file("Trotter"),
         "challenges": [
             {
                 "challenge": 21,
                 "step": 10
             }
Пример #49
0
from linux_story.common import get_story_file


library = {
    "name": "library",
    "children": [
        {
            "name": "Rabbit",
            "type": "file",
            "contents": get_story_file("Rabbit"),
            "challenges": [
                {
                    "challenge": 0,
                    "step": 1,
                    "exists": False
                },
                {
                    "challenge": 42,
                    "step": 1,
                },
                {
                    "challenge": 42,
                    "step": 4,
                    "exists": False
                }
            ]
        },
        {
            "name": "private-section",
            "type": "directory",
            "challenges": [
Пример #50
0
# town.py
#
# Copyright (C) 2014-2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#


from linux_story.common import get_story_file
from hidden_shelter import hidden_shelter
from east import east


grumpy_man_hurt = {
    "name": "grumpy-man",
    "contents": get_story_file("grumpy-man"),
    "challenges": [
        {
            "challenge": 0,
            "step": 1
        },
        {
            "challenge": 8,
            "step": 1,
            "exists": False
        }
    ]
}

grumpy_man_fixed = {
    "name": "grumpy-man",
    "contents": get_story_file("grumpy-man-fixed"),