pears 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10cdea0d2eb59b303dab2dac91edbe3a3f37d6bb833fcbccaf7176ab28cc6813
4
- data.tar.gz: aef9803cf0c1c022fdb21615c0d76c228c3eabbaf160bd5742d6fee244315301
3
+ metadata.gz: e90770f906724b64b6ae99ee1688230dd0d8b46727be9dd444ae026067cd814e
4
+ data.tar.gz: 37c6daf85a0aaba38e8d8ff8fe20cd281d0a3504f80fa679d818f6cab866904a
5
5
  SHA512:
6
- metadata.gz: 12365453b2bbdb8fc612180dd3d7723811ff3068c8c78d46c2b957824ce44cc477438d76d5a2086d7c252772a2d3ea11101fbef44e0df56e70222c0e3e3adb2f
7
- data.tar.gz: aefbc749ea3806cec18b20c948cf93253ac9d87c1de579c06a2ea757bbd8ddd8e1b0d483222e5dfe7e78160c264b735cb05387606c2687d9ddedab280fa9308c
6
+ metadata.gz: 960a73a2741bc5febbcfaad6931f97475b2171bbddcb1d6460cf075e68dd3448a98462569042309223b8e2ed634bdd6414d781323905e9373c4baa7d1766d0d2
7
+ data.tar.gz: bcb0ee18a1938ea763a2597a3af626073d24735d2048898ec439c96d3caf6ea7ba4874e2612a02faad043ec7547303194429758535554cb234c1d5263bd8426c
data/lib/pears/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pears
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
@@ -0,0 +1,23 @@
1
+ <html>
2
+ <head>
3
+ <style><%=render('style')%></style>
4
+ </head>
5
+ <body>
6
+ <header>
7
+ <h1> Pears::Subjects </h1>
8
+ </header>
9
+ <main>
10
+ <nav>
11
+ <% @subjects.each do |subject| %>
12
+ <p> <a href=<%="./subjects/#{subject.name}"%>><%= subject.name %></a> </p>
13
+ <% end %>
14
+ </nav>
15
+ <section>
16
+ <p> No subject selected </p>
17
+ </section>
18
+ </main>
19
+
20
+ <footer>
21
+ <p class='p--footer' > Pears web-interface </p>
22
+ </footer>
23
+ </body>
@@ -0,0 +1,23 @@
1
+ <html>
2
+ <head>
3
+ <style><%=render('style')%></style>
4
+ </head>
5
+ <body>
6
+ <header>
7
+ <h1> Pears::Subjects </h1>
8
+ <form method="post">
9
+ <input type='submit' value='Reboot <%= @subject.name.to_s.humanize %>' name="reboot-<%=@subject.name%>}">
10
+ </form>
11
+ </header>
12
+ <main>
13
+ <nav>
14
+ <% @subjects.each do |subject| %>
15
+ <p> <a href=<%=subject.name%>><%= subject.name.to_s.humanize.capitalize %></a> </p>
16
+ <% end %>
17
+ </nav>
18
+ <section>
19
+ <h3><%= @subject.name.capitalize %></h3>
20
+ <div class='serialization'><%= JSON.pretty_generate(@subject.project) %></div>
21
+ </section>
22
+ </main>
23
+ </body>
@@ -0,0 +1,58 @@
1
+ body {
2
+ font-family: "Avenir", "Arial", sans-serif;
3
+ color: 222;padding: 0px 30px 10px 30px;
4
+ margin: 0;
5
+ background-color: FFF;
6
+ }
7
+
8
+ header {
9
+ padding-top: 4px;
10
+ height: 60px;
11
+ display: flex;
12
+ justify-content: space-between;
13
+ align-items: center;
14
+ }
15
+
16
+ main {
17
+ height: calc(100vh - 160px);
18
+ display: flex;
19
+ }
20
+
21
+ footer {
22
+ margin: 20px 20px 10px 20px;
23
+ height: 20px;
24
+ }
25
+
26
+ .p--footer {
27
+ width: 100%;
28
+ text-align: right;
29
+ }
30
+
31
+ nav {
32
+ padding: 0px 10px 10px 0;
33
+ display: block;
34
+ border-right: 1px solid #CCC;
35
+ min-width: 15%;
36
+ min-height: 100%;
37
+ }
38
+
39
+ section {
40
+ padding: 0px 10px 10px 20px;
41
+ width: 85%;
42
+ min-height: 100%;
43
+ }
44
+
45
+ .serialization {
46
+ font-family: 'SF mono', 'Courier', monospace;
47
+ white-space: pre;
48
+ background-color: eeeeee;
49
+ border-radius: 11px;
50
+ padding: 15px;
51
+ }
52
+
53
+ input[type=submit]{
54
+ padding: 10px 22px;
55
+ background-color: fff;
56
+ border-radius: 6px;
57
+ border: 1px solid #666;
58
+ }
data/lib/pears/web.rb ADDED
@@ -0,0 +1,38 @@
1
+ require 'roda'
2
+ require 'json'
3
+
4
+ module Pears
5
+ class Web < Roda
6
+ plugin :render, views: "#{__FILE__}/../web/views"
7
+
8
+ route do |r|
9
+ r.root do
10
+ r.redirect "#{request.path}index"
11
+ end
12
+
13
+ r.get "index" do
14
+ @subjects = Pears.subjects
15
+ render('index')
16
+ end
17
+
18
+ r.on "subjects" do
19
+ r.is do
20
+ r.redirect "#{request.path.delete_suffix('/subjects')}/index"
21
+ end
22
+
23
+ r.get String do |subject|
24
+ @subjects = Pears.subjects
25
+ @subject = Pears[subject.to_sym]
26
+ render('show')
27
+ end
28
+
29
+ r.post String do |subject|
30
+ @subjects = Pears.subjects
31
+ @subject = Pears[subject.to_sym]
32
+ @subject.reboot
33
+ render('show')
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
data/pears.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency 'dry-configurable', '>= 0.13.0'
29
29
  spec.add_dependency 'activesupport'
30
30
  spec.add_dependency 'redis'
31
+ spec.add_dependency 'roda'
31
32
 
32
33
  spec.add_development_dependency 'byebug'
33
34
  # For more information and examples about making a new gem, checkout our
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pears
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Kemp
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: roda
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: byebug
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +115,10 @@ files:
101
115
  - lib/pears/testing.rb
102
116
  - lib/pears/testing/subject.rb
103
117
  - lib/pears/version.rb
118
+ - lib/pears/web.rb
119
+ - lib/pears/web/views/index.erb
120
+ - lib/pears/web/views/show.erb
121
+ - lib/pears/web/views/style.erb
104
122
  - pears.gemspec
105
123
  homepage: https://bitbucket.org/ivaldi/rubygems-pears/src/master/
106
124
  licenses: