yetty 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -0
  3. data/LICENSE +0 -0
  4. data/README.md +66 -0
  5. data/bin/yetty +9 -4
  6. data/lib/yetty.rb +15 -0
  7. data/lib/yetty/command.rb +136 -0
  8. data/lib/yetty/play.rb +23 -0
  9. data/lib/yetty/push.rb +44 -0
  10. data/lib/yetty/record.rb +73 -0
  11. data/lib/yetty/site.rb +23 -0
  12. data/lib/yetty/site/app.rb +91 -0
  13. data/lib/yetty/site/static/assets/term/bg-gradient.png +0 -0
  14. data/lib/yetty/site/static/config.rb +26 -0
  15. data/lib/yetty/site/static/css/fd-slider.css +1004 -0
  16. data/lib/yetty/site/static/css/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  17. data/lib/yetty/site/static/css/fonts/bootstrap/glyphicons-halflings-regular.svg +229 -0
  18. data/lib/yetty/site/static/css/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  19. data/lib/yetty/site/static/css/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  20. data/lib/yetty/site/static/css/player.css +165 -0
  21. data/lib/yetty/site/static/css/styles.css +8035 -0
  22. data/lib/yetty/site/static/js/bootstrap.js +2323 -0
  23. data/lib/yetty/site/static/js/bootstrap.min.js +12 -0
  24. data/lib/yetty/site/static/js/config.json +429 -0
  25. data/lib/yetty/site/static/js/jquery-2.1.1.min.js +4 -0
  26. data/lib/yetty/site/static/js/nyan/runner.js +92 -0
  27. data/lib/yetty/site/static/js/nyan/three.min.js +724 -0
  28. data/lib/yetty/site/static/js/nyan/threex.nyancat.js +193 -0
  29. data/lib/yetty/site/static/js/nyan/threex.nyancatrainbow.js +89 -0
  30. data/lib/yetty/site/static/js/nyan/threex.nyancatsound.js +33 -0
  31. data/lib/yetty/site/static/js/nyan/threex.nyancatstars.js +116 -0
  32. data/lib/yetty/site/static/js/player/fd-slider.min.js +2 -0
  33. data/lib/yetty/site/static/js/player/player.js +371 -0
  34. data/lib/yetty/site/static/js/player/term.js +4177 -0
  35. data/lib/yetty/site/static/sass/_bootstrap-variables.scss +818 -0
  36. data/lib/yetty/site/static/sass/player.scss +139 -0
  37. data/lib/yetty/site/static/sass/styles.scss +3 -0
  38. data/lib/yetty/site/static/sounds/nyanlooped.mp3 +0 -0
  39. data/lib/yetty/site/static/sounds/nyanslow.mp3 +0 -0
  40. data/lib/yetty/site/views/about.haml +8 -0
  41. data/lib/yetty/site/views/index.haml +13 -0
  42. data/lib/yetty/site/views/layout.haml +33 -0
  43. data/lib/yetty/site/views/recording.haml +34 -0
  44. data/lib/yetty/site/views/recordings.haml +7 -0
  45. data/lib/yetty/site/views/user.haml +28 -0
  46. data/lib/yetty/site/views/users.haml +16 -0
  47. data/lib/yetty/ui.rb +103 -0
  48. data/lib/yetty/user.rb +42 -0
  49. data/lib/yetty/version.rb +4 -0
  50. data/yetty.gemspec +21 -0
  51. metadata +49 -16
@@ -0,0 +1,139 @@
1
+ @import "compass/css3";
2
+ @import "compass/utilities";
3
+
4
+ #term {
5
+ font-family: "DejaVu Sans Mono", monospace;
6
+ font-size: 11px;
7
+ color: #f0f0f0;
8
+ background: #000;
9
+ margin: 0 auto;
10
+ margin: 10 auto;
11
+ .reverse-video {
12
+ color: #000;
13
+ background: #f0f0f0;
14
+ }
15
+ }
16
+
17
+
18
+ .embed {
19
+ #player {
20
+ margin-top: 5px;
21
+ }
22
+ }
23
+
24
+ #player {
25
+ margin: 0 auto;
26
+ margin-bottom: 15px;
27
+ .header {
28
+ @include border-top-left-radius(5px);
29
+ @include border-top-right-radius(5px);
30
+ background: url(/assets/term/bg-gradient.png);
31
+ height: 32px;
32
+ line-height: 32px;
33
+ color: white;
34
+ img {
35
+ margin: 6px 10px 0 10px;
36
+ float: left;
37
+ }
38
+ h1 {
39
+ display: block;
40
+ font-size: 14px;
41
+ color: white;
42
+ line-height: 30px;
43
+ }
44
+ }
45
+ .cmdline {
46
+ border: 0;
47
+ border-top: 1px solid #444;
48
+ font-size: 1.4em;
49
+ padding: 3px;
50
+ background: #111;
51
+ color: #aaa;
52
+ border: 0;
53
+ }
54
+ input[type=range] {
55
+ margin-bottom: -10px;
56
+ }
57
+ .progress {
58
+ @include border-radius(0);
59
+ background-color: #333;
60
+ background-image: none;
61
+ height: 10px;
62
+ margin-bottom: 0;
63
+ .bar {
64
+ width: 0%;
65
+ }
66
+ }
67
+ .speed-container {
68
+ width: 100px;
69
+ }
70
+ .fd-slider {
71
+ height: 20px;
72
+ margin-top: 5px;
73
+ }
74
+ nav.controls {
75
+ height: 30px;
76
+ border-top: 1px solid #444;
77
+ background: black;
78
+ li {
79
+ display: block;
80
+ margin: 0;
81
+ float: left;
82
+ height: 30px;
83
+ }
84
+ .sc-label {
85
+ color: gray;
86
+ line-height: 30px;
87
+ margin-left: 30px;
88
+ margin-right: 10px;
89
+ margin-top: -2px;
90
+ }
91
+ .sc-button {
92
+ cursor: pointer;
93
+ line-height: 30px;
94
+ width: 30px;
95
+ img {
96
+ margin: 4px;
97
+ vertical-align: baseline;
98
+ }
99
+ }
100
+ .sc-settings {
101
+ display: none;
102
+ }
103
+ }
104
+ }
105
+
106
+ #player-hover {
107
+ text-align: center;
108
+ color: white;
109
+ font-size: 2em;
110
+ p {
111
+ padding: 20px;
112
+ .donate {
113
+ font-size: 0.5em;
114
+ color: gray;
115
+ }
116
+ }
117
+ &.enabled {
118
+ -webkit-transition-property: background;
119
+ -webkit-transition-duration: 5s;
120
+ -webkit-transition-timing-function: default;
121
+ background-color: rgba(0,0,0,0.7);
122
+ &.error {
123
+ a {
124
+ color: #aaa;
125
+ }
126
+ .img {
127
+ width: 126px;
128
+ height: 126px;
129
+ background: #eee;
130
+ padding: 10px;
131
+ margin: 0 auto;
132
+ border-radius: 10px;
133
+ }
134
+ }
135
+ }
136
+ &.disabled {
137
+ background: rgba(0,0,0,0)
138
+ }
139
+ }
@@ -0,0 +1,3 @@
1
+ @import "bootstrap-compass";
2
+ @import "bootstrap-variables";
3
+ @import "bootstrap";
@@ -0,0 +1,8 @@
1
+ %div.panel.panel-default
2
+ %div.panel-heading
3
+ %h4
4
+ Yetty - About
5
+ %div.panel-body
6
+ %ul
7
+ %li
8
+ GH: http://github.com
@@ -0,0 +1,13 @@
1
+ %script{:type => 'text/javascript', :src => '/js/nyan/three.min.js'}
2
+ %script{:type => 'text/javascript', :src => '/js/nyan/threex.nyancat.js'}
3
+ %script{:type => 'text/javascript', :src => '/js/nyan/threex.nyancatsound.js'}
4
+ %script{:type => 'text/javascript', :src => '/js/nyan/threex.nyancatstars.js'}
5
+ %script{:type => 'text/javascript', :src => '/js/nyan/threex.nyancatrainbow.js'}
6
+ %div.panel.panel-default
7
+ %div.panel-heading
8
+ %h4
9
+ Yetty - Welcome!
10
+ %div.panel-body#nyan-holder
11
+ #nyan
12
+ Please make a selection!
13
+ %script{:type => 'text/javascript', :src => '/js/nyan/runner.js'}
@@ -0,0 +1,33 @@
1
+ !!! 1.1
2
+ %html
3
+ %head
4
+ %title= "Yetty - [#{@title || '-'}]"
5
+ %link{:type => 'text/css', :rel => 'stylesheet', :href => '/css/styles.css'}
6
+ %link{:type => 'text/css', :rel => 'stylesheet', :href => '/css/player.css'}
7
+ %link{:type => 'text/css', :rel => 'stylesheet', :href => '/css/fd-slider.css'}
8
+ %script{:type => 'text/javascript', :src => '/js/jquery-2.1.1.min.js'}
9
+ %script{:type => 'text/javascript', :src => '/js/bootstrap.min.js'}
10
+ %script{:type => 'text/javascript', :src => '/js/player/fd-slider.min.js'}
11
+ %script{:type => 'text/javascript', :src => '/js/player/term.js'}
12
+ %script{:type => 'text/javascript', :src => '/js/player/player.js'}
13
+
14
+ %body
15
+ %div.container.document
16
+ %nav.navbar.navbar-default{:role => 'navigation'}
17
+ %div.container-fluid
18
+ %div.navbar-header
19
+ %a.navbar-brand{:href => '/'}
20
+ Yetty
21
+ %br
22
+ %div.col-md-9= yield
23
+ %div.col-md-3
24
+ %ul.nav.navbar-default
25
+ %li
26
+ %a{:href => '/recordings'}
27
+ Recordings
28
+ %li
29
+ %a{:href => '/users'}
30
+ Users
31
+ %li
32
+ %a{:href => '/about'}
33
+ About
@@ -0,0 +1,34 @@
1
+ %div.panel{:class => state == 'private' ? 'panel-warning' : 'panel-default'}
2
+ %div.panel-heading
3
+ %div.pull-right
4
+ %span.glyphicon{:class => state == 'private' ? 'glyphicon-lock' : 'glyphicon-globe'}
5
+ %h4
6
+ Recording -
7
+ = name
8
+ %div.clearfix
9
+ %div.panel-body
10
+ #player
11
+ .header= name
12
+ #term
13
+ .progress
14
+ .progress-bar.progress-info.progress-striped.bar
15
+ %nav.controls
16
+ %li.sc-button.action-toggle{'data-action' => 'play'}
17
+ %span.glyphicon.glyphicon-play
18
+ %li.speed-container
19
+ %input.speed{type: 'text', value: '2.5'}
20
+ %input.cmdline{:hidden => 'hidden'}
21
+ %div.panel-footer
22
+ %div.pull-right
23
+ Uploaded by:
24
+ %a{:href => "/users/#{user}"}= user
25
+ %div.clearfix
26
+
27
+ :javascript
28
+ jQuery(function(){
29
+ window.term = new Terminal(80, 24);
30
+ window.term.id = 1;
31
+ term.open(document.getElementById('term'));
32
+ window.player = new VT.Player(term);
33
+ window.player.load('#{url}');
34
+ });
@@ -0,0 +1,7 @@
1
+ .panel.panel-danger
2
+ .panel-heading
3
+ %h4
4
+ Recordings
5
+ .panel-body
6
+ %b
7
+ Not Implemented!
@@ -0,0 +1,28 @@
1
+ .panel.panel-default
2
+ .panel-heading
3
+ %h4
4
+ User information:
5
+ = username
6
+ .panel-body
7
+ - unless user_info.empty?
8
+ %table.table
9
+ %caption
10
+ User information
11
+ %tbody
12
+ - user_info.each do |k,v|
13
+ %tr
14
+ %td
15
+ %b= k
16
+ %td= v
17
+ %table.table.table-striped
18
+ %thead
19
+ %tr
20
+ %td{:colspan => 2}
21
+ %b
22
+ Recordings
23
+ %tbody.table-striped
24
+ - records.each do |rec|
25
+ %tr
26
+ %td= Time.at(File.basename(rec.name).split('-').first.to_i)
27
+ %td
28
+ %a{:href => "/recording/#{Base64.urlsafe_encode64(rec.name)}"}= rec.name
@@ -0,0 +1,16 @@
1
+ .panel.panel-default
2
+ .panel-heading
3
+ %h4
4
+ User List
5
+ .panel-body
6
+ %table.table.table-striped
7
+ %thead
8
+ %tr
9
+ %td
10
+ %b
11
+ Users
12
+ %tbody.table-striped
13
+ - users.sort.each do |usr|
14
+ %tr
15
+ %td
16
+ %a{:href => "/users/#{usr}"}= usr
data/lib/yetty/ui.rb ADDED
@@ -0,0 +1,103 @@
1
+ require 'paint'
2
+
3
+ module Yetty
4
+ class Ui
5
+
6
+ # @return [Truthy, Falsey]
7
+ attr_accessor :colorize
8
+
9
+ # Build new UI instance
10
+ #
11
+ # @param args [Hash]
12
+ # @option args [TrueClass, FalseClass] :color enable/disable colors
13
+ # @option args [IO] :output_to IO to write
14
+ # @return [self]
15
+ def initialize(args={})
16
+ @colorize = args.fetch(:colors, true)
17
+ @output_to = args.fetch(:output_to, $stdout)
18
+ end
19
+
20
+ # Output directly
21
+ #
22
+ # @param string [String]
23
+ # @return [String]
24
+ def puts(string='')
25
+ @output_to.puts string
26
+ string
27
+ end
28
+
29
+ # Output directly
30
+ #
31
+ # @param string [String]
32
+ # @return [String]
33
+ def print(string='')
34
+ @output_to.print string
35
+ string
36
+ end
37
+
38
+ # Output information string
39
+ #
40
+ # @param string [String]
41
+ # @return [String]
42
+ def info(string, *args)
43
+ output_method = args.include?(:nonewline) ? :print : :puts
44
+ self.send(output_method, "#{color('[Yetty]:', :green)} #{string}")
45
+ string
46
+ end
47
+
48
+ # Format warning string
49
+ #
50
+ # @param string [String]
51
+ # @return [String]
52
+ def warn(string, *args)
53
+ output_method = args.include?(:nonewline) ? :print : :puts
54
+ self.send(output_method, "#{color('[WARN]:', :yellow, :bold)} #{string}")
55
+ string
56
+ end
57
+
58
+ # Format error string
59
+ #
60
+ # @param string [String]
61
+ # @return [String]
62
+ def error(string, *args)
63
+ output_method = args.include?(:nonewline) ? :print : :puts
64
+ self.send(output_method, "#{color('[ERROR]:', :red, :bold)} #{string}")
65
+ string
66
+ end
67
+
68
+ # Colorize string
69
+ #
70
+ # @param string [String]
71
+ # @param args [Symbol]
72
+ # @return [String]
73
+ def color(string, *args)
74
+ Paint[string, *args]
75
+ end
76
+
77
+ # Prompt for question and receive answer
78
+ #
79
+ # @param question [String]
80
+ # @param default [String]
81
+ # @return [String]
82
+ def ask(question, default=nil)
83
+ string = question.dup
84
+ if(default)
85
+ string << " [#{default}]"
86
+ end
87
+ result = nil
88
+ until(result)
89
+ info "#{string}: ", :nonewline
90
+ result = $stdin.gets.strip
91
+ if(result.empty? && default)
92
+ result = default
93
+ end
94
+ if(result.empty?)
95
+ error 'Please provide a value'
96
+ result = nil
97
+ end
98
+ end
99
+ result
100
+ end
101
+
102
+ end
103
+ end
data/lib/yetty/user.rb ADDED
@@ -0,0 +1,42 @@
1
+ require 'yetty'
2
+
3
+ module Yetty
4
+ # User command class
5
+ class User < Command
6
+
7
+ # Invoke shelr record
8
+ def execute!
9
+ ui.info 'Configuration population (.yetty)'
10
+ site_url = ui.ask('Site URL', 'http://localhost:4000')
11
+ username = ui.ask('Username', ENV['USER'])
12
+ provider = ui.ask('Storage Provider', 'aws')
13
+ bucket = ui.ask('Storage bucket', 'yetty')
14
+ credentials = Hash[
15
+ ui.ask('Storage credentials(k=v,k=v...)').split(',').map{|x|x.split('=')}
16
+ ]
17
+ run_action('Writing configuration file (.yetty)') do
18
+ File.open('.yetty', 'w+') do |file|
19
+ file.write(
20
+ MultiJson.dump(
21
+ Smash.new(
22
+ :site => {
23
+ :url => site_url
24
+ },
25
+ :user => {
26
+ :username => username,
27
+ :storage => {
28
+ :provider => provider,
29
+ :bucket => bucket,
30
+ :credentials => credentials
31
+ }
32
+ }
33
+ ),
34
+ :pretty => true
35
+ )
36
+ )
37
+ end
38
+ end
39
+ end
40
+
41
+ end
42
+ end