argyle.rb 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/README.md +48 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/argyle.rb +50 -0
- data/lib/argyle/assert.rb +11 -0
- data/lib/argyle/blueprint.rb +51 -0
- data/lib/argyle/component/base.rb +9 -0
- data/lib/argyle/component/component.rb +4 -0
- data/lib/argyle/component/text.rb +9 -0
- data/lib/argyle/error.rb +13 -0
- data/lib/argyle/layout/area.rb +7 -0
- data/lib/argyle/layout/base.rb +51 -0
- data/lib/argyle/layout/default.rb +3 -0
- data/lib/argyle/layout/factory.rb +36 -0
- data/lib/argyle/layout/layout.rb +7 -0
- data/lib/argyle/layout/registry.rb +33 -0
- data/lib/argyle/page/base.rb +73 -0
- data/lib/argyle/page/factory.rb +24 -0
- data/lib/argyle/page/page.rb +4 -0
- data/lib/argyle/prototype.rb +12 -0
- data/lib/argyle/renderer.rb +47 -0
- data/lib/argyle/style_sheet/base.rb +24 -0
- data/lib/argyle/style_sheet/color.rb +10 -0
- data/lib/argyle/style_sheet/container.rb +13 -0
- data/lib/argyle/style_sheet/style.rb +9 -0
- data/lib/argyle/style_sheet/style_sheet.rb +6 -0
- data/lib/argyle/view/base.rb +14 -0
- data/lib/argyle/view/text.rb +7 -0
- data/lib/argyle/view/view.rb +4 -0
- metadata +175 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 42a16f94abe2d9b315ac32be278bc0634f14f42dc2f42f869a19999e264c7aec
|
4
|
+
data.tar.gz: 06bf79dd8f5b660e57e55adc54368efbdf87c40d54fe5665861152a16ed85f37
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aed6632a4609e9f2b4319edaff40e4826a1d685418eaba9156ed5f898b236f7d7aee7118338036886ac92c2d0b7e54c552372aacc518bfc0b99f66aec75a3899
|
7
|
+
data.tar.gz: c65d3ac81975f3d38a60bae96a194967a90cd60bd7cd10a1e69afda424266bdcdab18c55d52c8f01a0dd767c63ccb42e45334318391817152ff14cf051ae2657
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Argyle
|
2
|
+
|
3
|
+
![Test Ruby 2.6](https://github.com/Isty001/argyle/workflows/Test%20Ruby%202.6/badge.svg)
|
4
|
+
![Test Ruby 2.7](https://github.com/Isty001/argyle/workflows/Test%20Ruby%202.7/badge.svg)
|
5
|
+
![Rubocop](https://github.com/Isty001/argyle/workflows/Rubocop/badge.svg)
|
6
|
+
[![codecov](https://codecov.io/gh/Isty001/argyle/branch/master/graph/badge.svg)](https://codecov.io/gh/Isty001/argyle)
|
7
|
+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/cc216aebb30d483a9384514c24f26ba1)](https://www.codacy.com/gh/Isty001/argyle/dashboard)
|
8
|
+
|
9
|
+
---
|
10
|
+
|
11
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/argyle`. To experiment with that code, run `bin/console` for an interactive prompt.
|
12
|
+
|
13
|
+
TODO: Delete this and the text above, and describe your gem
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'argyle'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle install
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install argyle
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
TODO: Write usage instructions here
|
34
|
+
|
35
|
+
## Development
|
36
|
+
|
37
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
38
|
+
|
39
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/argyle.
|
44
|
+
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'argyle'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/argyle.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'ncursesw'
|
2
|
+
|
3
|
+
module Argyle
|
4
|
+
class << self
|
5
|
+
def activate
|
6
|
+
return if active?
|
7
|
+
|
8
|
+
Ncurses.initscr
|
9
|
+
Ncurses.start_color
|
10
|
+
Ncurses.use_default_colors
|
11
|
+
Ncurses.cbreak
|
12
|
+
Ncurses.noecho
|
13
|
+
# Ncurses.curs_set(0)
|
14
|
+
Ncurses.stdscr.intrflush(false)
|
15
|
+
Ncurses.stdscr.keypad(true)
|
16
|
+
Ncurses.stdscr.nodelay(true)
|
17
|
+
|
18
|
+
@active = true
|
19
|
+
|
20
|
+
at_exit { deactivate }
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def deactivate
|
26
|
+
return unless active?
|
27
|
+
|
28
|
+
Ncurses.endwin
|
29
|
+
|
30
|
+
@active = false
|
31
|
+
end
|
32
|
+
|
33
|
+
def active?
|
34
|
+
@active ||= false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
require_relative 'argyle/assert'
|
40
|
+
require_relative 'argyle/blueprint'
|
41
|
+
require_relative 'argyle/error'
|
42
|
+
require_relative 'argyle/prototype'
|
43
|
+
require_relative 'argyle/renderer'
|
44
|
+
|
45
|
+
require_relative 'argyle/component/component'
|
46
|
+
require_relative 'argyle/page/page'
|
47
|
+
require_relative 'argyle/layout/layout'
|
48
|
+
require_relative 'argyle/view/view'
|
49
|
+
|
50
|
+
Argyle.activate
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Argyle::Assert
|
2
|
+
class << self
|
3
|
+
def klass(expected, actual)
|
4
|
+
return if actual.respond_to?(:superclass) && expected == actual.superclass
|
5
|
+
|
6
|
+
actual_name = actual.respond_to?(:name) ? actual.name : actual.class
|
7
|
+
|
8
|
+
raise Argyle::Error::TypeError.new("Expected subclass of #{expected.name}, #{actual_name} given")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# @!attribute [r] pages
|
2
|
+
# @return [Hash{Symbol=>Argyle::Page}]
|
3
|
+
#
|
4
|
+
class Argyle::Blueprint
|
5
|
+
attr_reader :pages
|
6
|
+
|
7
|
+
# @param layout_factory [Argyle::Layout::Factory]
|
8
|
+
# @param layout_registry [Argyle::Layout::Registry]
|
9
|
+
# @param page_factory [Argyle::Page::Factory]
|
10
|
+
# @param renderer [Argyle::Renderer]
|
11
|
+
#
|
12
|
+
def initialize(layout_factory: nil, layout_registry: nil, page_factory: nil, renderer: nil)
|
13
|
+
@pages = {}
|
14
|
+
@layouts = []
|
15
|
+
@current_page = nil
|
16
|
+
@layout_factory = layout_factory || Argyle::Layout::Factory.new
|
17
|
+
@layout_registry = layout_registry || create_layout_registry
|
18
|
+
@page_factory = page_factory || Argyle::Page::Factory.new(@layout_registry)
|
19
|
+
@renderer = renderer || Argyle::Renderer.new
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def create_layout_registry
|
25
|
+
registry = Argyle::Layout::Registry.new
|
26
|
+
registry.add(@layout_factory.create(Argyle::Layout::Default))
|
27
|
+
|
28
|
+
registry
|
29
|
+
end
|
30
|
+
|
31
|
+
public
|
32
|
+
|
33
|
+
# @param page_klass [Class<Argyle::Page::Base>] Subclass of Argyle::Page::Base
|
34
|
+
#
|
35
|
+
def add_page(page_klass)
|
36
|
+
raise Argyle::Error::ArgumentError.new("Page #{page_klass} has no id") if page_klass.identifier.nil?
|
37
|
+
|
38
|
+
page = @page_factory.create(page_klass)
|
39
|
+
@pages[page_klass.identifier] = page
|
40
|
+
|
41
|
+
@current_page = page if @current_page.nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
# @note Renders the current page
|
45
|
+
#
|
46
|
+
def render
|
47
|
+
raise Argyle::Error::NotFound.new('No pages defined yet') if @pages.empty?
|
48
|
+
|
49
|
+
@renderer.render(@current_page)
|
50
|
+
end
|
51
|
+
end
|
data/lib/argyle/error.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# @!attribute [r] areas
|
2
|
+
# @return [Hash{Symbol=>Argyle::Layout::Area}]
|
3
|
+
#
|
4
|
+
# @!attribute [r] windows
|
5
|
+
# @return [Hash{Symbol=>Ncurses::WINDOW}]
|
6
|
+
#
|
7
|
+
# @!attribute [r] identifier
|
8
|
+
# @return [Symbol]
|
9
|
+
#
|
10
|
+
class Argyle::Layout::Base
|
11
|
+
attr_reader :areas, :windows
|
12
|
+
|
13
|
+
# @param areas [Hash{Symbol=>Argyle::Layout::Area}]
|
14
|
+
# @param windows [Hash{Symbol=>Ncurses::WINDOW}] Mapped to the corresponding Area
|
15
|
+
#
|
16
|
+
def initialize(areas, windows)
|
17
|
+
@areas = areas
|
18
|
+
@windows = windows
|
19
|
+
end
|
20
|
+
|
21
|
+
# @!attribute [r] area_prototypes
|
22
|
+
# @return [Hash{Symbol=>Argyle::Prototype}]
|
23
|
+
#
|
24
|
+
class << self
|
25
|
+
attr_reader :area_prototypes, :identifier
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
# @param id [Symbol]
|
30
|
+
#
|
31
|
+
def area(id)
|
32
|
+
area_prototypes[id] = Argyle::Prototype.new(Argyle::Layout::Area, {})
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
# @param id [Symbol]
|
38
|
+
#
|
39
|
+
def id(id)
|
40
|
+
@identifier = id
|
41
|
+
end
|
42
|
+
|
43
|
+
def inherited(klass)
|
44
|
+
super
|
45
|
+
|
46
|
+
klass.instance_variable_set('@area_prototypes', area_prototypes || {})
|
47
|
+
|
48
|
+
klass.area(:main)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Argyle::Layout::Factory
|
2
|
+
# @param klass [Class<Argyle::Layout::Base>] Subclass of Argyle::Layout::Base
|
3
|
+
#
|
4
|
+
# @return [Argyle::Layout::Base]
|
5
|
+
#
|
6
|
+
# @raise [Argyle::Error::TypeError] If the layout is not a subclass of Argyle::Layout::Base
|
7
|
+
#
|
8
|
+
def create(klass)
|
9
|
+
Argyle::Assert.klass(Argyle::Layout::Base, klass)
|
10
|
+
|
11
|
+
areas = klass.area_prototypes.transform_values(&:unwrap)
|
12
|
+
|
13
|
+
windows = areas.map(&method(:create_window)).to_h
|
14
|
+
|
15
|
+
klass.new(areas, windows)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# @param area [Argyle::Layout::Area]
|
21
|
+
#
|
22
|
+
# @return [Ncurses::WINDOW]
|
23
|
+
#
|
24
|
+
def create_window(id, area)
|
25
|
+
max_height = Ncurses.getmaxy(Ncurses.stdscr)
|
26
|
+
max_width = Ncurses.getmaxx(Ncurses.stdscr)
|
27
|
+
|
28
|
+
width = area.width || max_width
|
29
|
+
height = area.height || max_height
|
30
|
+
|
31
|
+
y = 0
|
32
|
+
x = 0
|
33
|
+
|
34
|
+
[id, Ncurses::WINDOW.new(height, width, y, x)]
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Argyle::Layout::Registry
|
2
|
+
def initialize
|
3
|
+
@layouts = {}
|
4
|
+
end
|
5
|
+
|
6
|
+
# @param id [Symbol]
|
7
|
+
# @param layout [Argyle::Layout::Base]
|
8
|
+
#
|
9
|
+
# @raise [Argyle::Error::TypeError] If layout is not an instance of Argyle::Layout::Base
|
10
|
+
# @raise [Argyle::Error::ArgumentError] If he layout has no id set
|
11
|
+
#
|
12
|
+
def add(layout)
|
13
|
+
unless layout.is_a?(Argyle::Layout::Base)
|
14
|
+
raise Argyle::Error::TypeError.new("Layout must be an instance of #{Argyle::Layout::Base}")
|
15
|
+
end
|
16
|
+
|
17
|
+
raise Argyle::Error::ArgumentError.new("Layout #{layout.class} has no id") if layout.class.identifier.nil?
|
18
|
+
|
19
|
+
@layouts[layout.class.identifier] = layout
|
20
|
+
end
|
21
|
+
|
22
|
+
# @param id [Symbol]
|
23
|
+
#
|
24
|
+
# @return [Argyle::Layout::Base] Clone of the original definition
|
25
|
+
#
|
26
|
+
# @raise [Argyle::Error::NotFound] If the layout does not exist
|
27
|
+
#
|
28
|
+
def clone(id)
|
29
|
+
raise Argyle::Error::NotFound.new("Unknown layout: #{id}") unless @layouts.include?(id)
|
30
|
+
|
31
|
+
@layouts[id].clone
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# @!attribute [r] components
|
2
|
+
# @return [Hash{Symbol=>Argyle::Component::Base}]
|
3
|
+
#
|
4
|
+
# @!attribute [r] layout
|
5
|
+
# @return [Argyle::Layout::Base]
|
6
|
+
#
|
7
|
+
# @!attribute [r] identifier
|
8
|
+
# @return [Symbol]
|
9
|
+
#
|
10
|
+
class Argyle::Page::Base
|
11
|
+
attr_reader :components, :layout
|
12
|
+
|
13
|
+
def initialize(components, layout)
|
14
|
+
@components = components
|
15
|
+
@layout = layout
|
16
|
+
end
|
17
|
+
|
18
|
+
# @!attribute [r] component_prototypes
|
19
|
+
# @return [Hash{Symbol=>Argyle::Prototype}]
|
20
|
+
#
|
21
|
+
# @!attribute [r] layout_id
|
22
|
+
# @return [Symbol]
|
23
|
+
#
|
24
|
+
# @!attribute [r] id
|
25
|
+
# @return [Symbol]
|
26
|
+
#
|
27
|
+
class << self
|
28
|
+
attr_reader :component_prototypes, :layout_id, :identifier
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# @param id [Symbol]
|
33
|
+
#
|
34
|
+
def id(id)
|
35
|
+
@identifier = id
|
36
|
+
end
|
37
|
+
|
38
|
+
# @param id [Symbol]
|
39
|
+
# @param value [String]
|
40
|
+
#
|
41
|
+
def text(id, value)
|
42
|
+
component_prototypes[id] = Argyle::Prototype.new(Argyle::Component::Text, {value: value, area: @current_area})
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param id [Symbol]
|
46
|
+
#
|
47
|
+
# @raise [Argyle::Error::RuntimeError] When area calls are nested
|
48
|
+
#
|
49
|
+
def area(id)
|
50
|
+
raise Argyle::Error::RuntimeError.new('Areas cannot be nested') unless @current_area == :main
|
51
|
+
|
52
|
+
@current_area = id
|
53
|
+
yield
|
54
|
+
@current_area = :main
|
55
|
+
end
|
56
|
+
|
57
|
+
# @param id [Symbol]
|
58
|
+
#
|
59
|
+
def layout(id)
|
60
|
+
@layout_id = id
|
61
|
+
end
|
62
|
+
|
63
|
+
def inherited(klass)
|
64
|
+
super
|
65
|
+
|
66
|
+
klass.instance_variable_set('@identifier', nil)
|
67
|
+
klass.instance_variable_set('@current_area', :main)
|
68
|
+
|
69
|
+
klass.instance_variable_set('@component_prototypes', component_prototypes || {})
|
70
|
+
klass.instance_variable_set('@layout_id', layout_id)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Argyle::Page::Factory
|
2
|
+
# @param layout_registry [Argyle::Layout::Registry]
|
3
|
+
#
|
4
|
+
def initialize(layout_registry)
|
5
|
+
@layout_registry = layout_registry
|
6
|
+
end
|
7
|
+
|
8
|
+
# @param klass [Class<Argyle::Page::Base>] Subclass of Argyle::Page
|
9
|
+
#
|
10
|
+
# @return [Argyle::Page::Base]
|
11
|
+
#
|
12
|
+
# @raise [Argyle::Error::TypeError] If the page is not a subclass of Argyle::Page
|
13
|
+
#
|
14
|
+
def create(klass)
|
15
|
+
Argyle::Assert.klass(Argyle::Page::Base, klass)
|
16
|
+
|
17
|
+
components = klass.component_prototypes.transform_values(&:unwrap)
|
18
|
+
|
19
|
+
klass.new(
|
20
|
+
components,
|
21
|
+
@layout_registry.clone(klass.layout_id || :default)
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class Argyle::Renderer
|
2
|
+
# @param style_container [Argyle::StyleSheet::Container]
|
3
|
+
#
|
4
|
+
def initialize(style_container)
|
5
|
+
@style_container = style_container
|
6
|
+
@views = {}
|
7
|
+
|
8
|
+
set_view(Argyle::Component::Text, Argyle::View::Text)
|
9
|
+
end
|
10
|
+
|
11
|
+
# @param component_klass [Class<Argyle::Component::Base>]
|
12
|
+
# @param view_klass [Class<Argyle::View::Base>]
|
13
|
+
#
|
14
|
+
# @raise [Argyle::Error::TypeError] If component_klass is not a subclass of Argyle::Component::Base
|
15
|
+
# @raise [Argyle::Error::TypeError] If view_klass is not a subclass of Argyle::View::Base
|
16
|
+
#
|
17
|
+
def set_view(component_klass, view_klass)
|
18
|
+
Argyle::Assert.klass(Argyle::Component::Base, component_klass)
|
19
|
+
Argyle::Assert.klass(Argyle::View::Base, view_klass)
|
20
|
+
|
21
|
+
@views[component_klass] = view_klass.new(@style_container)
|
22
|
+
end
|
23
|
+
|
24
|
+
# @param page [Argyle::Page::Base]
|
25
|
+
#
|
26
|
+
# @raise [Argyle::Error::NotFound] If no view is set for a component class
|
27
|
+
# @raise [Argyle::Error::NotFound] If the layout has no associated window for the a component's area
|
28
|
+
#
|
29
|
+
def render(page)
|
30
|
+
windows = page.layout.windows
|
31
|
+
|
32
|
+
page.components.each_value do |component|
|
33
|
+
component_class = component.class
|
34
|
+
area = component.area
|
35
|
+
|
36
|
+
unless @views.include?(component_class)
|
37
|
+
raise Argyle::Error::NotFound.new("View not found fo component #{component_class}")
|
38
|
+
end
|
39
|
+
|
40
|
+
raise Argyle::Error::NotFound.new("Window not found for area: #{area}") unless windows.include?(area)
|
41
|
+
|
42
|
+
@views[component_class].render(windows[area], component)
|
43
|
+
end
|
44
|
+
|
45
|
+
windows.each_value(&:refresh)
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Argyle::StyleSheet::Base
|
2
|
+
# @!attribute [r] style_prototypes
|
3
|
+
# @return [Hash{Symbol=>Argyle::Prototype}]
|
4
|
+
#
|
5
|
+
# @!attribute [r] color_prototypes
|
6
|
+
# @return [Hash{Symbol=>Argyle::Prototype}]
|
7
|
+
#
|
8
|
+
class << self
|
9
|
+
attr_reader :style_prototypes, :color_prototypes
|
10
|
+
|
11
|
+
def color(id, r:, g:, b:)
|
12
|
+
color_prototypes[id] = Argyle::Prototype.new(Argyle::StyleSheet::Color, {r: r, g: g, b: b})
|
13
|
+
end
|
14
|
+
|
15
|
+
# @param id [Symbol]
|
16
|
+
#
|
17
|
+
# @option opts [Symbol] :fg Foreground color
|
18
|
+
# @option opts [Symbol] :bg Background color
|
19
|
+
#
|
20
|
+
def style(id, **opts)
|
21
|
+
style_prototypes[id] = Argyle::Prototype.new(Argyle::StyleSheet::Style, opts)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Argyle::StyleSheet::Container
|
2
|
+
def initialize
|
3
|
+
@colors = {}
|
4
|
+
@styles = {}
|
5
|
+
end
|
6
|
+
|
7
|
+
# @param klass [Class<StyleSheet::Base>]
|
8
|
+
#
|
9
|
+
def add(klass)
|
10
|
+
@colors.merge!(klass.color_prototypes.transform_values(&:unwrap))
|
11
|
+
@styles.merge!(klass.style_prototypes.transform_values(&:unwrap))
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Argyle::View::Base
|
2
|
+
# @param style_container [Argyle::StyleSheet::Container]
|
3
|
+
#
|
4
|
+
def initialize(style_container)
|
5
|
+
@style_container = style_container
|
6
|
+
end
|
7
|
+
|
8
|
+
# @param window [Ncurses::WINDOW]
|
9
|
+
# @param component [Argyle::Component::Base]
|
10
|
+
#
|
11
|
+
def render(_window, _component)
|
12
|
+
raise NotImplementedError.new("render method must be implemented in #{self.class}")
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: argyle.rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Isty001
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ncursesw
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mocha
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '12.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '12.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: codecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.16
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.16
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.17'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.17'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.93.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.93.1
|
111
|
+
description: Argyle
|
112
|
+
email:
|
113
|
+
- isty001@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- Gemfile
|
119
|
+
- README.md
|
120
|
+
- Rakefile
|
121
|
+
- bin/console
|
122
|
+
- bin/setup
|
123
|
+
- lib/argyle.rb
|
124
|
+
- lib/argyle/assert.rb
|
125
|
+
- lib/argyle/blueprint.rb
|
126
|
+
- lib/argyle/component/base.rb
|
127
|
+
- lib/argyle/component/component.rb
|
128
|
+
- lib/argyle/component/text.rb
|
129
|
+
- lib/argyle/error.rb
|
130
|
+
- lib/argyle/layout/area.rb
|
131
|
+
- lib/argyle/layout/base.rb
|
132
|
+
- lib/argyle/layout/default.rb
|
133
|
+
- lib/argyle/layout/factory.rb
|
134
|
+
- lib/argyle/layout/layout.rb
|
135
|
+
- lib/argyle/layout/registry.rb
|
136
|
+
- lib/argyle/page/base.rb
|
137
|
+
- lib/argyle/page/factory.rb
|
138
|
+
- lib/argyle/page/page.rb
|
139
|
+
- lib/argyle/prototype.rb
|
140
|
+
- lib/argyle/renderer.rb
|
141
|
+
- lib/argyle/style_sheet/base.rb
|
142
|
+
- lib/argyle/style_sheet/color.rb
|
143
|
+
- lib/argyle/style_sheet/container.rb
|
144
|
+
- lib/argyle/style_sheet/style.rb
|
145
|
+
- lib/argyle/style_sheet/style_sheet.rb
|
146
|
+
- lib/argyle/view/base.rb
|
147
|
+
- lib/argyle/view/text.rb
|
148
|
+
- lib/argyle/view/view.rb
|
149
|
+
homepage: https://github.com/argyle/argyle
|
150
|
+
licenses:
|
151
|
+
- MIT
|
152
|
+
metadata:
|
153
|
+
homepage_uri: https://github.com/argyle/argyle
|
154
|
+
source_code_uri: https://github.com/argyle/argyle
|
155
|
+
changelog_uri: https://github.com/argyle/argyle/blob/master/CHANGELOG.md
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 2.6.0
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubygems_version: 3.1.2
|
172
|
+
signing_key:
|
173
|
+
specification_version: 4
|
174
|
+
summary: Argyle
|
175
|
+
test_files: []
|