remedy 0.0.3.pre → 0.0.3

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 (3) hide show
  1. data/README.markdown +85 -2
  2. data/lib/remedy/version.rb +1 -1
  3. metadata +5 -5
data/README.markdown CHANGED
@@ -3,12 +3,27 @@ Remedy
3
3
 
4
4
  Remedy is a console interaction framework along the lines of Curses written in pure Ruby with an Object-Oriented approach and baked-in support for bulding MVC applications.
5
5
 
6
+ THIS SOFTWARE IS PRE-ALPHA!!
7
+ ----------------------------
8
+
9
+ It's under active development and is being used in my own projects. However, expect bugs, missing features, etc.
10
+
11
+ If you have any suggestions or find any bugs, drop them in GitHub/issues so I can keep track of them. Thanks!
12
+
6
13
  Installation
7
14
  ------------
8
15
 
9
16
  Add this line to your application's Gemfile:
10
17
 
11
- gem 'remedy'
18
+ ```ruby
19
+ gem 'remedy'
20
+ ```
21
+
22
+ If you're only going to use part of Remedy, you can tell Bundler to not automatically require the whole thing:
23
+
24
+ ```ruby
25
+ gem 'remedy', require: false
26
+ ```
12
27
 
13
28
  And then execute:
14
29
 
@@ -21,7 +36,74 @@ Or install it yourself as:
21
36
  Usage
22
37
  -----
23
38
 
24
- TODO: Write usage instructions here
39
+ Remedy makes a few different classes and modules available to allow straight forward half-duplex communication with users via the console.
40
+
41
+ There are obejcts for input as well as output, including low level console keystroke reads and screen drawing.
42
+
43
+ ### Interaction
44
+
45
+ The Interaction object wraps raw keyboard reads and streamlines some aspects of accepting keyboard input.
46
+
47
+ ```ruby
48
+ include Remedy
49
+ user_input = Interaction.new
50
+
51
+ user_input.loop do |key|
52
+ puts key
53
+ end
54
+ ```
55
+
56
+ ### Viewport
57
+
58
+ Viewport is the object that draws on your screen, you can give it any compatible Remedy::Partial object, or something that responds like one.
59
+
60
+ ```ruby
61
+ include Remedy
62
+ joke = Content.new
63
+ joke << "Q: What's the difference between a duck?"
64
+ joke << "A: Purple, because ice cream has no bones!"
65
+
66
+ screen = Viewport.new
67
+ screen.draw joke
68
+ ```
69
+
70
+ Remedy::Partial has the subclasses Header, Footer, and Content.
71
+
72
+ You can use the above classes to divide your Views into 3 seperate pieces. Content will be truncated as needed to accomodate the header and footer and the dimensions of the console. You can also specify the cursor/scroll position of the content being drawn, and when specifying headers or footers, you must.
73
+
74
+ ```ruby
75
+ include Remedy
76
+ title = Header.new
77
+ title << "Someone Said These Were Good"
78
+
79
+ jokes = Content.new
80
+ jokes << %q{1. A woman gets on a bus with her baby. The bus driver says: 'Ugh, that's the ugliest baby I've ever seen!' The woman walks to the rear of the bus and sits down, fuming. She says to a man next to her: 'The driver just insulted me!' The man says: 'You go up there and tell him off. Go on, I'll hold your monkey for you.'}
81
+ jokes << %q{2. I went to the zoo the other day, there was only one dog in it, it was a shitzu.}
82
+
83
+ disclaimer = Footer.new
84
+ disclaimer << "According to a survey they were funny. I didn't make them."
85
+
86
+ screen = Viewport.new
87
+ screen.draw jokes, Size.new(0,0), title, disclaimer
88
+ ```
89
+
90
+ ### Console
91
+
92
+ If you want easy access to some lower level console commands, you can use Console.
93
+
94
+ The most interesting function in my opinion is the callback that gets triggered when the user resizes the console window.
95
+
96
+ ```ruby
97
+ include Remedy
98
+
99
+ screen = Viewport.new
100
+ notice = Content.new
101
+ notice << "You just resized your screen!\n\nBrilliant!"
102
+
103
+ Console.set_console_resized_hook! do
104
+ screen.draw notice
105
+ end
106
+ ```
25
107
 
26
108
  Contributing
27
109
  ------------
@@ -31,3 +113,4 @@ Contributing
31
113
  3. Commit your changes (`git commit -am 'Add some feature'`)
32
114
  4. Push to the branch (`git push origin my-new-feature`)
33
115
  5. Create new Pull Request
116
+
@@ -1,3 +1,3 @@
1
1
  module Remedy
2
- VERSION = "0.0.3.pre"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remedy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.pre
5
- prerelease: 6
4
+ version: 0.0.3
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Anthony M. Cook
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-31 00:00:00.000000000 Z
12
+ date: 2013-01-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Pure Ruby console interaction library in the vein of Curses with baked-in
15
15
  MVC support.
@@ -54,9 +54,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
54
  none: false
55
55
  required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - ! '>'
57
+ - - ! '>='
58
58
  - !ruby/object:Gem::Version
59
- version: 1.3.1
59
+ version: '0'
60
60
  none: false
61
61
  requirements: []
62
62
  rubyforge_project: