mousevc 0.0.2 → 0.0.3.pre.alpha

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d9fa6dd0f403e43b06f4776aeaff121d204cee5
4
- data.tar.gz: b5343d26fdd055e2f9c72309f5201c6b399dfca9
3
+ metadata.gz: 48ec74aed2a3dde484226cc1db018bf3fc3086ff
4
+ data.tar.gz: 24b4222ef7944364b837092e1950538486e56f74
5
5
  SHA512:
6
- metadata.gz: addba491d0f09d2db745cb45a9d5b2028a1f7d48bccfdf8ea31fe10f9a057f1fb805b020e15d902e13e15fd270d926a405abfe79c1ac7f14b6730d9ae3fc42c5
7
- data.tar.gz: fc70704ed24d5bb3a1a362b9f3abe650b5877e79a4969fbe967014a1a6828d85e6e812a27d64cd1317c1fce7003cba048436ef57fefe4a39dfdd5c4dada0681d
6
+ metadata.gz: 01cb7f165aa5b97594cef91e9d30e52ba8e76bdaf02b603b3eab96180a1fe1eeb78438ff7b3542b22a364750a00e44a4e41fec37aed68ce0a9e7023a031378f2
7
+ data.tar.gz: 8ee1890266ca700d64edc6c4111cbaa28a6ced8e343732f74e6b72fd0805295407a6ced14ee9b7462288a156d12e209b9ea5a1d769dd115861becfe47b58d390
data/README.md CHANGED
@@ -10,6 +10,10 @@
10
10
 
11
11
  A tiny mouse sized MVC framework to jump start command line apps. Written in Ruby.
12
12
 
13
+ [![Gem Version](https://badge.fury.io/rb/mousevc.svg)](http://badge.fury.io/rb/mousevc)
14
+
15
+ [View the documentation](http://www.rubydoc.info/gems/mousevc)
16
+
13
17
  ## Installation
14
18
 
15
19
  Add this line to your application's Gemfile:
data/lib/mousevc/app.rb CHANGED
@@ -31,6 +31,15 @@ module Mousevc
31
31
 
32
32
  attr_accessor :looping
33
33
 
34
+ ##
35
+ # @!attribute router
36
+ #
37
+ # Returns the current router
38
+ #
39
+ # @return [Mousevc::Router] the router
40
+
41
+ attr_reader :router
42
+
34
43
  ##
35
44
  # Creates a new +Mousevc::App+ instance
36
45
  #
@@ -52,11 +61,13 @@ module Mousevc
52
61
  end
53
62
 
54
63
  ##
55
- # Run the application
64
+ # Runs the application
56
65
 
57
66
  def run
58
67
  reset
59
68
  @looping ? listen : single
69
+ Input.clear
70
+ nil
60
71
  end
61
72
 
62
73
  ##
@@ -90,10 +101,12 @@ module Mousevc
90
101
  )
91
102
  end
92
103
 
104
+ ##
105
+ # Runs the application without looping automatically
106
+
93
107
  def single
94
- Kernel.system('clear') if system_clear?
95
- @router.route unless Input.quit?
96
- reset if Input.reset?
108
+ clear_view
109
+ @router.route
97
110
  end
98
111
 
99
112
  ##
@@ -106,9 +119,17 @@ module Mousevc
106
119
 
107
120
  def listen
108
121
  begin
109
- single
122
+ clear_view
123
+ @router.route unless Input.quit?
124
+ reset if Input.reset?
110
125
  end until Input.quit?
111
- Input.clear
126
+ end
127
+
128
+ ##
129
+ # Executes a system clear if system clearing is enabled
130
+
131
+ def clear_view
132
+ Kernel.system('clear') if system_clear?
112
133
  end
113
134
  end
114
135
  end
@@ -18,7 +18,7 @@ module Mousevc
18
18
  # Allows clearing of all or some of the models currently stored.
19
19
  # Clears all data and models stored if no keys are provided
20
20
  #
21
- # @param [Symbol] a list of keys to clear from the currently stored models
21
+ # @param args [Symbol] a list of keys to clear from the currently stored models
22
22
 
23
23
  def self.clear(*args)
24
24
  if args.empty?
@@ -29,12 +29,21 @@ module Mousevc
29
29
  end
30
30
 
31
31
  ##
32
- #
32
+ # Get a stored model by key
33
+ #
34
+ # @param key [Symbol] the key under which the model is stored
35
+ # @return [Mousevc::Model, Any] the stored model or value
33
36
 
34
37
  def self.get(key)
35
38
  @@models[key]
36
39
  end
37
40
 
41
+ ##
42
+ # Set the value of a storage key
43
+ # @raise [Mousevc::Error] if the key already exists
44
+ #
45
+ # @param key [Symbol] the key under which the model is stored
46
+
38
47
  def self.set(key, value)
39
48
  raise Error.new("Cannot persist, a value already exists at: #{key}") unless @@models[key].nil?
40
49
  @@models.store(key, value)
@@ -3,5 +3,5 @@ module Mousevc
3
3
  ##
4
4
  # The current version
5
5
 
6
- VERSION = "0.0.2"
6
+ VERSION = "0.0.3-alpha"
7
7
  end
data/lib/mousevc.rb CHANGED
@@ -24,11 +24,13 @@ module Mousevc
24
24
  "",
25
25
  "by",
26
26
  "Bideo Wego",
27
+ "http://bideowego.com/mousevc",
27
28
  "",
28
- "http://bideowego.com",
29
- ""
29
+ "Documentation",
30
+ "http://www.rubydoc.info/gems/mousevc"
30
31
  ]
31
32
  width = lines.max.length
33
+ width = width.even? ? width + 1 : width
32
34
  lines.map do |s|
33
35
  s.center(width)
34
36
  end.join("\n")
data/mousevc.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{A tiny mouse sized MVC framework to jump start command line apps.}
13
13
  #spec.description = %q{TODO: Write a longer description or delete this line.}
14
- spec.homepage = "http://bideowego.com"
14
+ spec.homepage = "http://bideowego.com/mousevc"
15
15
  spec.license = "MIT"
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mousevc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Scavello
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-22 00:00:00.000000000 Z
11
+ date: 2015-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,7 +82,7 @@ files:
82
82
  - lib/mousevc/version.rb
83
83
  - lib/mousevc/view.rb
84
84
  - mousevc.gemspec
85
- homepage: http://bideowego.com
85
+ homepage: http://bideowego.com/mousevc
86
86
  licenses:
87
87
  - MIT
88
88
  metadata:
@@ -98,9 +98,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - ">"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 1.3.1
104
104
  requirements: []
105
105
  rubyforge_project:
106
106
  rubygems_version: 2.4.6