hud 1.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 25e25a4df13677f90b22b5808e89afbfc3ae637951e4c383ebfff900f994d370
4
+ data.tar.gz: a353b37b88144f095cd39e7c80fc2b79953897d8b33e4f33e40a90919ab6916e
5
+ SHA512:
6
+ metadata.gz: b1f3a0a6bb03b9ec4317ec97424d3edd0882b101d5b65a0f614045b00044d646ca346ea69bb1fdd748cc90ff32588d925b7987eb3e9c7a0c4f67e29ee98bf8f4
7
+ data.tar.gz: 7193a1d864583cb838c9d0ae3a04388747a572460b9436812958062a6a99eae2e7189ac57ff5973867cf8e8271de6e59e0d8353d9bee7e7c9780a88b9169e947
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1 @@
1
+ 2.7.1
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in hud.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "mote"
8
+ gem "thor"
9
+ gem "rspec"
10
+
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hud (1.0.0)
5
+ mote
6
+ thor
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.4.4)
12
+ mote (1.3.0)
13
+ rake (12.3.3)
14
+ rspec (3.10.0)
15
+ rspec-core (~> 3.10.0)
16
+ rspec-expectations (~> 3.10.0)
17
+ rspec-mocks (~> 3.10.0)
18
+ rspec-core (3.10.0)
19
+ rspec-support (~> 3.10.0)
20
+ rspec-expectations (3.10.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.10.0)
23
+ rspec-mocks (3.10.0)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.10.0)
26
+ rspec-support (3.10.0)
27
+ thor (1.0.1)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ hud!
34
+ mote
35
+ rake (~> 12.0)
36
+ rspec
37
+ thor
38
+
39
+ BUNDLED WITH
40
+ 2.1.4
@@ -0,0 +1,36 @@
1
+ # Hud
2
+
3
+ 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/hud`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'hud'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install hud
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hud.
36
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/cli ADDED
@@ -0,0 +1,11 @@
1
+ require "thor"
2
+
3
+ module Hud
4
+
5
+ class CLI < Thor
6
+ desc "hello NAME", "say hello to NAME"
7
+ def hello(name)
8
+ puts "Hello #{name}"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "hud"
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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/hud ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "hud"
5
+ require "thor"
6
+
7
+ module Hud
8
+ class CLI < Thor
9
+ # contents of the Thor class
10
+ end
11
+ end
12
+
13
+
14
+ Hud::CLI.start(ARGV)
@@ -0,0 +1,22 @@
1
+ require_relative 'lib/hud/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "hud"
5
+ spec.version = Hud::VERSION
6
+ spec.authors = ["dsofadog"]
7
+ spec.email = ["delaney@so.fa.dog"]
8
+
9
+ spec.summary = %q{"Head up Display view screen builder"}
10
+ spec.description = %q{ Hud ui and api response builder"}
11
+ spec.homepage = "https://github.com/cococoder/hud"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
15
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ end
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+ spec.add_dependency 'thor'
21
+ spec.add_dependency 'mote'
22
+ end
@@ -0,0 +1,73 @@
1
+ require "hud/version"
2
+ require 'mote'
3
+ require 'ostruct'
4
+
5
+ module Hud
6
+
7
+ class Error < StandardError; end
8
+
9
+ ##################### Config #####################
10
+
11
+ def self.configuration
12
+ @configuration ||= OpenStruct.new(
13
+ {
14
+ screens_dir: "./screens",
15
+ parts: [:body,:title]
16
+ }
17
+ )
18
+ end
19
+
20
+ def self.configure
21
+ yield(configuration)
22
+ end
23
+
24
+
25
+ ##################### Screen #####################
26
+ class Screen
27
+ include Mote::Helpers
28
+ attr_reader :overides
29
+
30
+ def initialize(overides: {})
31
+ @overides = overides
32
+ end
33
+
34
+ def overide(name:,value:)
35
+ @overides[name] = value
36
+ self
37
+ end
38
+
39
+ def render
40
+ mote("#{Hud.configuration.screens_dir}/layout.mote",get_params)
41
+ end
42
+
43
+ private
44
+
45
+
46
+ def get_params
47
+ params = {}
48
+ Hud.configuration.parts.each do |symbol|
49
+ content = ""
50
+ begin
51
+ if overides.has_key? symbol
52
+ content = overides[symbol]
53
+ next
54
+ end
55
+ content = mote("#{screens_dir(overided: true)}/#{symbol}.mote",overides)
56
+ rescue => exception
57
+ content = mote("#{screens_dir}/#{symbol}.mote")
58
+ ensure
59
+ params[symbol] = content
60
+ end
61
+ end
62
+ params
63
+ end
64
+
65
+ def screens_dir(overided: false)
66
+ return "#{Hud.configuration.screens_dir}" unless overided
67
+ "#{Hud.configuration.screens_dir}/#{self.class.name.gsub(/\w*::/,"").gsub("Screen","").downcase}"
68
+ end
69
+
70
+ alias_method :to_json, :render
71
+ alias_method :to_html, :render
72
+ end
73
+ end
@@ -0,0 +1,3 @@
1
+ module Hud
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,2 @@
1
+ {{title}}
2
+ {{body}}
@@ -0,0 +1 @@
1
+ - Body ({{ state}})
@@ -0,0 +1 @@
1
+ - Body
@@ -0,0 +1 @@
1
+ - Body (overidden)
@@ -0,0 +1 @@
1
+ # Title (overidden)
@@ -0,0 +1,2 @@
1
+ {{title}}
2
+ {{body}}
@@ -0,0 +1 @@
1
+ # Title
@@ -0,0 +1,73 @@
1
+ require "hud"
2
+
3
+ describe 'Screen' do
4
+ context "override using a file" do
5
+ it 'to_html defaults' do
6
+ Hud.configure do |config|
7
+ config.screens_dir = "./specs/overridenscreens-local"
8
+ end
9
+ class TestScreen < Hud::Screen; end
10
+ content = TestScreen.new
11
+ .to_html
12
+
13
+ expect(content).to eql "# Title\n- Body"
14
+ end
15
+
16
+ end
17
+
18
+ context "override using a file" do
19
+ it 'to_html defaults' do
20
+ Hud.configure do |config|
21
+ config.screens_dir = "./specs/overridenscreens"
22
+ end
23
+ class TestScreen < Hud::Screen; end
24
+ content = TestScreen.new.to_html
25
+
26
+ expect(content).to eql "# Title\n- Body"
27
+ end
28
+ it 'to_html for index' do
29
+ Hud.configure do |config|
30
+ config.screens_dir = "./specs/overridenscreens"
31
+ end
32
+ class IndexScreen < Hud::Screen; end
33
+ content = IndexScreen.new.to_html
34
+
35
+ expect(content).to eql "# Title (overidden)\n- Body (overidden)"
36
+ end
37
+
38
+ end
39
+
40
+ context "#render" do
41
+ it 'to_html' do
42
+ Hud.configure do |config|
43
+ config.screens_dir = "./specs/screens"
44
+ end
45
+ class TestScreen < Hud::Screen; end
46
+ content = TestScreen.new.to_html
47
+
48
+ expect(content).to eql "# Title\n- Body"
49
+ end
50
+ end
51
+ it 'to_html with overidden body' do
52
+ Hud.configure do |config|
53
+ config.screens_dir = "./specs/screens"
54
+ end
55
+ class TestScreen < Hud::Screen; end
56
+ content = TestScreen.new
57
+ .overide(name: :body, value: "Overidden Body")
58
+ .to_html
59
+ expect(content).to eql "# Title\nOveridden Body"
60
+ end
61
+
62
+ it 'to_html with overidden title' do
63
+ Hud.configure do |config|
64
+ config.screens_dir = "./specs/screens"
65
+ end
66
+ class TestScreen < Hud::Screen; end
67
+ content = TestScreen.new
68
+ .overide(name: :title, value: "Overidden Title")
69
+ .to_html
70
+ expect(content).to eql "Overidden Title\n- Body"
71
+ end
72
+
73
+ end
@@ -0,0 +1 @@
1
+ - Body
@@ -0,0 +1,2 @@
1
+ {{title}}
2
+ {{body}}
@@ -0,0 +1 @@
1
+ # Title
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hud
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - dsofadog
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mote
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: ' Hud ui and api response builder"'
42
+ email:
43
+ - delaney@so.fa.dog
44
+ executables:
45
+ - hud
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".ruby-version"
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - README.md
54
+ - Rakefile
55
+ - bin/cli
56
+ - bin/console
57
+ - bin/setup
58
+ - exe/hud
59
+ - hud.gemspec
60
+ - lib/hud.rb
61
+ - lib/hud/version.rb
62
+ - specs/overridenscreens-local/body.mote
63
+ - specs/overridenscreens-local/layout.mote
64
+ - specs/overridenscreens-local/test/body.mote
65
+ - specs/overridenscreens-local/title.mote
66
+ - specs/overridenscreens/body.mote
67
+ - specs/overridenscreens/index/body.mote
68
+ - specs/overridenscreens/index/title.mote
69
+ - specs/overridenscreens/layout.mote
70
+ - specs/overridenscreens/title.mote
71
+ - specs/screen_spec.rb
72
+ - specs/screens/body.mote
73
+ - specs/screens/layout.mote
74
+ - specs/screens/title.mote
75
+ homepage: https://github.com/cococoder/hud
76
+ licenses: []
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 2.3.0
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubygems_version: 3.1.4
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: '"Head up Display view screen builder"'
97
+ test_files: []