petli 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
 - data/Gemfile.lock +3 -0
 - data/README.md +28 -2
 - data/bin/petli +3 -3
 - data/lib/petli/hud.rb +5 -3
 - data/lib/petli/pet.rb +8 -4
 - data/lib/petli/rooms.rb +5 -1
 - data/lib/petli/version.rb +1 -1
 - data/lib/petli.rb +1 -1
 - data/petli.gemspec +6 -2
 - metadata +21 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 65333f3864f90309c1fbcaab7bf7895ac0b9d8b60383cab06dbeb46a9e676de3
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4bde0f8bcbe218e0003495601844612b3eecdae7ca9c58378658ee0138f567ca
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: de4f1810aa3c2c7796285bb18d06e71a2047577df673b09223a93c3ae87aa86743b120f47c1203f11aafd4ab290300c7979c8b6f48b826f76cac01607dcb2ee4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f8014e8e53caab3bd8e9a3a5363eddd15e9aa328254fc04fea61bece49a969ac62edfbd2254ad5b5d90984e370da2968a722e0a2abcba235d2c9e20672345c23
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -2,10 +2,12 @@ PATH 
     | 
|
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
4 
     | 
    
         
             
                petli (0.0.1)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  pastel (~> 0.8.0)
         
     | 
| 
       5 
6 
     | 
    
         
             
                  tty-box (~> 0.7.0)
         
     | 
| 
       6 
7 
     | 
    
         
             
                  tty-color (~> 0.6.0)
         
     | 
| 
       7 
8 
     | 
    
         
             
                  tty-config (~> 0.5.0)
         
     | 
| 
       8 
9 
     | 
    
         
             
                  tty-cursor (~> 0.7.1)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  tty-platform (~> 0.3.0)
         
     | 
| 
       9 
11 
     | 
    
         
             
                  tty-reader (~> 0.9.0)
         
     | 
| 
       10 
12 
     | 
    
         
             
                  tty-screen (~> 0.8.1)
         
     | 
| 
       11 
13 
     | 
    
         | 
| 
         @@ -26,6 +28,7 @@ GEM 
     | 
|
| 
       26 
28 
     | 
    
         
             
                tty-color (0.6.0)
         
     | 
| 
       27 
29 
     | 
    
         
             
                tty-config (0.5.0)
         
     | 
| 
       28 
30 
     | 
    
         
             
                tty-cursor (0.7.1)
         
     | 
| 
      
 31 
     | 
    
         
            +
                tty-platform (0.3.0)
         
     | 
| 
       29 
32 
     | 
    
         
             
                tty-reader (0.9.0)
         
     | 
| 
       30 
33 
     | 
    
         
             
                  tty-cursor (~> 0.7)
         
     | 
| 
       31 
34 
     | 
    
         
             
                  tty-screen (~> 0.8)
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -3,13 +3,39 @@ PETLI 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            Pet line interface (look I know it should have been command line pet like Clipet? Clet? those just don't sound great)
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            This is a little pet that will live in your console. You must feed it, clean up after it, and play with it to keep it happy!
         
     | 
| 
      
 6 
     | 
    
         
            +
            This is a little virtual pet that will live in your console. You must feed it, clean up after it, and play with it to keep it happy!
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            ###  
     | 
| 
      
 10 
     | 
    
         
            +
            ### Usage
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            Run `gem install petli` and then run `petli` in your command line
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            ### Advanced usage
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            Petli has a command line api that would allow you to do funky things like
         
     | 
| 
      
 17 
     | 
    
         
            +
            - have mutiple pets using `--path`
         
     | 
| 
      
 18 
     | 
    
         
            +
            - make a separate app that graphs happiness using `petli --status | jq '.health`
         
     | 
| 
      
 19 
     | 
    
         
            +
            - setup a cron job to feed your pet hourly with `petli --bread`
         
     | 
| 
      
 20 
     | 
    
         
            +
            - Your idea here!
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ```
         
     | 
| 
      
 23 
     | 
    
         
            +
            $> petli --help
         
     | 
| 
      
 24 
     | 
    
         
            +
            Usage: petli [options]
         
     | 
| 
      
 25 
     | 
    
         
            +
                -r, --reset          Reset button to start over again
         
     | 
| 
      
 26 
     | 
    
         
            +
                -s, --status         Dump pet status
         
     | 
| 
      
 27 
     | 
    
         
            +
                -b, --bread          Feed your pet bread without viewing
         
     | 
| 
      
 28 
     | 
    
         
            +
                -c, --candy          Feed your pet candy without viewing
         
     | 
| 
      
 29 
     | 
    
         
            +
                -m, --medicine       Feed your pet candy without viewing
         
     | 
| 
      
 30 
     | 
    
         
            +
                -l, --clean          Clean up any 'dirt' without viewing
         
     | 
| 
      
 31 
     | 
    
         
            +
                -p, --path [PATH]    Path to your pet data (defaults to system config dir)
         
     | 
| 
      
 32 
     | 
    
         
            +
            ```
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            ### Development
         
     | 
| 
       11 
35 
     | 
    
         | 
| 
       12 
36 
     | 
    
         
             
            ```bash
         
     | 
| 
      
 37 
     | 
    
         
            +
            $> git clone git@github.com:tanema/petli.git
         
     | 
| 
      
 38 
     | 
    
         
            +
            $> cd petli
         
     | 
| 
       13 
39 
     | 
    
         
             
            $> bundle install
         
     | 
| 
       14 
40 
     | 
    
         
             
            $> rake install
         
     | 
| 
       15 
41 
     | 
    
         
             
            $> petli
         
     | 
    
        data/bin/petli
    CHANGED
    
    | 
         @@ -25,11 +25,11 @@ if options[:reset] 
     | 
|
| 
       25 
25 
     | 
    
         
             
            elsif options[:status]
         
     | 
| 
       26 
26 
     | 
    
         
             
              puts Petli::DB.dump
         
     | 
| 
       27 
27 
     | 
    
         
             
            elsif options[:bread]
         
     | 
| 
       28 
     | 
    
         
            -
              pet.feed(food: :bread)
         
     | 
| 
      
 28 
     | 
    
         
            +
              pet.feed!(food: :bread)
         
     | 
| 
       29 
29 
     | 
    
         
             
            elsif options[:candy]
         
     | 
| 
       30 
     | 
    
         
            -
              pet.feed(food: :candy)
         
     | 
| 
      
 30 
     | 
    
         
            +
              pet.feed!(food: :candy)
         
     | 
| 
       31 
31 
     | 
    
         
             
            elsif options[:medicine]
         
     | 
| 
       32 
     | 
    
         
            -
              pet.feed(food: :medicine)
         
     | 
| 
      
 32 
     | 
    
         
            +
              pet.feed!(food: :medicine)
         
     | 
| 
       33 
33 
     | 
    
         
             
            elsif options[:clean]
         
     | 
| 
       34 
34 
     | 
    
         
             
              pet.clean
         
     | 
| 
       35 
35 
     | 
    
         
             
            else
         
     | 
    
        data/lib/petli/hud.rb
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require_relative '../tatty/game'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'pastel'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            module Petli
         
     | 
| 
       4 
5 
     | 
    
         
             
              class HUD < Tatty::Game
         
     | 
| 
         @@ -22,8 +23,8 @@ module Petli 
     | 
|
| 
       22 
23 
     | 
    
         
             
                  left, top = ((w-GAME_WIDTH)/2).round, ((h-GAME_HEIGHT)/2).round
         
     | 
| 
       23 
24 
     | 
    
         
             
                  render_box(
         
     | 
| 
       24 
25 
     | 
    
         
             
                    title: {
         
     | 
| 
       25 
     | 
    
         
            -
                      top_left: " Petli ",
         
     | 
| 
       26 
     | 
    
         
            -
                      bottom_right: " #{@pet.lifetime} days ",
         
     | 
| 
      
 26 
     | 
    
         
            +
                      top_left: Pastel.new.bright_white.bold(" Petli "),
         
     | 
| 
      
 27 
     | 
    
         
            +
                      bottom_right: Pastel.new.green(" #{@pet.lifetime} days "),
         
     | 
| 
       27 
28 
     | 
    
         
             
                    },
         
     | 
| 
       28 
29 
     | 
    
         
             
                    width: GAME_WIDTH,
         
     | 
| 
       29 
30 
     | 
    
         
             
                    height: GAME_HEIGHT,
         
     | 
| 
         @@ -36,7 +37,8 @@ module Petli 
     | 
|
| 
       36 
37 
     | 
    
         
             
                end
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
       38 
39 
     | 
    
         
             
                def status_bar
         
     | 
| 
       39 
     | 
    
         
            -
                   
     | 
| 
      
 40 
     | 
    
         
            +
                  p = Pastel.new
         
     | 
| 
      
 41 
     | 
    
         
            +
                  "#{p.red("♥")*@pet.health}#{"♡"*(10-@pet.health)}      #{"☺"*(10-@pet.happiness)}#{p.green("☻")*@pet.happiness}"
         
     | 
| 
       40 
42 
     | 
    
         
             
                end
         
     | 
| 
       41 
43 
     | 
    
         
             
              end
         
     | 
| 
       42 
44 
     | 
    
         
             
            end
         
     | 
    
        data/lib/petli/pet.rb
    CHANGED
    
    | 
         @@ -75,12 +75,16 @@ module Petli 
     | 
|
| 
       75 
75 
     | 
    
         
             
                  return self.embarass if ((food == :medicine && self.sick <= 0) || (self.health == 10 && food != :medicine))
         
     | 
| 
       76 
76 
     | 
    
         
             
                  self.last_meal = Time.now unless food == :medicine
         
     | 
| 
       77 
77 
     | 
    
         
             
                  @animation.eat(food: food) do
         
     | 
| 
       78 
     | 
    
         
            -
                    self. 
     | 
| 
       79 
     | 
    
         
            -
                    self.happiness = [10, self.happiness+1].min if food == :candy
         
     | 
| 
       80 
     | 
    
         
            -
                    self.sick = [0, self.sick - 1].max if food == :medicine
         
     | 
| 
      
 78 
     | 
    
         
            +
                    self.feed!(food)
         
     | 
| 
       81 
79 
     | 
    
         
             
                  end
         
     | 
| 
       82 
80 
     | 
    
         
             
                end
         
     | 
| 
       83 
81 
     | 
    
         | 
| 
      
 82 
     | 
    
         
            +
                def feed!(food: :bread)
         
     | 
| 
      
 83 
     | 
    
         
            +
                  self.health = [10, self.health+1].min unless food == :medicine
         
     | 
| 
      
 84 
     | 
    
         
            +
                  self.happiness = [10, self.happiness+1].min if food == :candy
         
     | 
| 
      
 85 
     | 
    
         
            +
                  self.sick = [0, self.sick - 1].max if food == :medicine
         
     | 
| 
      
 86 
     | 
    
         
            +
                end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
       84 
88 
     | 
    
         
             
                def win
         
     | 
| 
       85 
89 
     | 
    
         
             
                  self.happiness = [10, self.happiness+1].min
         
     | 
| 
       86 
90 
     | 
    
         
             
                end
         
     | 
| 
         @@ -95,7 +99,7 @@ module Petli 
     | 
|
| 
       95 
99 
     | 
    
         
             
                end
         
     | 
| 
       96 
100 
     | 
    
         | 
| 
       97 
101 
     | 
    
         
             
                def poop(hours_ago)
         
     | 
| 
       98 
     | 
    
         
            -
                  self.poops = self.poops + [Poop.new(hours_ago 
     | 
| 
      
 102 
     | 
    
         
            +
                  self.poops = self.poops + [Poop.new(hours_ago)] if self.poops.count < Poop::LOCATIONS.count
         
     | 
| 
       99 
103 
     | 
    
         
             
                end
         
     | 
| 
       100 
104 
     | 
    
         | 
| 
       101 
105 
     | 
    
         
             
                def clean
         
     | 
    
        data/lib/petli/rooms.rb
    CHANGED
    
    | 
         @@ -25,7 +25,11 @@ module Petli 
     | 
|
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                  def action_bar
         
     | 
| 
       27 
27 
     | 
    
         
             
                    return "" if @pet.dead?
         
     | 
| 
       28 
     | 
    
         
            -
                     
     | 
| 
      
 28 
     | 
    
         
            +
                    p = Pastel.new
         
     | 
| 
      
 29 
     | 
    
         
            +
                    self.actions.map do |a|
         
     | 
| 
      
 30 
     | 
    
         
            +
                      key = p.bold("[#{a[0].capitalize}]")
         
     | 
| 
      
 31 
     | 
    
         
            +
                      "#{key}#{a[1..]}"
         
     | 
| 
      
 32 
     | 
    
         
            +
                    end.join(" ")
         
     | 
| 
       29 
33 
     | 
    
         
             
                  end
         
     | 
| 
       30 
34 
     | 
    
         | 
| 
       31 
35 
     | 
    
         
             
                  def keypress(event)
         
     | 
    
        data/lib/petli/version.rb
    CHANGED
    
    
    
        data/lib/petli.rb
    CHANGED
    
    
    
        data/petli.gemspec
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: utf-8
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            $:.unshift File.expand_path('../lib', __FILE__)
         
     | 
| 
       4 
     | 
    
         
            -
            require 'petli 
     | 
| 
      
 4 
     | 
    
         
            +
            require 'petli'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name          = 'petli'
         
     | 
| 
         @@ -16,8 +16,11 @@ Gem::Specification.new do |s| 
     | 
|
| 
       16 
16 
     | 
    
         
             
                A virtual pet that will live in your command line!
         
     | 
| 
       17 
17 
     | 
    
         
             
              HERE
         
     | 
| 
       18 
18 
     | 
    
         
             
              s.post_install_message = <<~HERE
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       19 
20 
     | 
    
         
             
                I am so happy to meet you!
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                   ʕ=ʔ 乁(☯ ᴥ ☯)ㄏ ▷☯◁
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       21 
24 
     | 
    
         
             
              HERE
         
     | 
| 
       22 
25 
     | 
    
         
             
              s.metadata      = { "source_code_uri" => "https://github.com/tanema/petli" }
         
     | 
| 
       23 
26 
     | 
    
         | 
| 
         @@ -28,6 +31,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       28 
31 
     | 
    
         | 
| 
       29 
32 
     | 
    
         
             
              s.required_ruby_version = ">= 2.6"
         
     | 
| 
       30 
33 
     | 
    
         | 
| 
      
 34 
     | 
    
         
            +
              s.add_dependency("pastel", "~> 0.8.0")
         
     | 
| 
       31 
35 
     | 
    
         
             
              s.add_dependency("tty-cursor", "~> 0.7.1")
         
     | 
| 
       32 
36 
     | 
    
         
             
              s.add_dependency("tty-config", "~> 0.5.0")
         
     | 
| 
       33 
37 
     | 
    
         
             
              s.add_dependency("tty-screen", "~> 0.8.1")
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: petli
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Tim Anema
         
     | 
| 
         @@ -10,6 +10,20 @@ bindir: bin 
     | 
|
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         
             
            date: 2021-08-27 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: pastel
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 0.8.0
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 0.8.0
         
     | 
| 
       13 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
28 
     | 
    
         
             
              name: tty-cursor
         
     | 
| 
       15 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -148,9 +162,12 @@ licenses: 
     | 
|
| 
       148 
162 
     | 
    
         
             
            - MIT
         
     | 
| 
       149 
163 
     | 
    
         
             
            metadata:
         
     | 
| 
       150 
164 
     | 
    
         
             
              source_code_uri: https://github.com/tanema/petli
         
     | 
| 
       151 
     | 
    
         
            -
            post_install_message: |
         
     | 
| 
      
 165 
     | 
    
         
            +
            post_install_message: |2+
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
       152 
167 
     | 
    
         
             
              I am so happy to meet you!
         
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                 ʕ=ʔ 乁(☯ ᴥ ☯)ㄏ ▷☯◁
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
       154 
171 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       155 
172 
     | 
    
         
             
            require_paths:
         
     | 
| 
       156 
173 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -170,3 +187,4 @@ signing_key: 
     | 
|
| 
       170 
187 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       171 
188 
     | 
    
         
             
            summary: A little pet in your console
         
     | 
| 
       172 
189 
     | 
    
         
             
            test_files: []
         
     | 
| 
      
 190 
     | 
    
         
            +
            ...
         
     |