about 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,4 +3,15 @@ Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
5
  lib/about.rb
6
+ lib/about/public/style.css
7
+ lib/about/server.rb
6
8
  lib/about/version.rb
9
+ lib/about/views/debug.erb
10
+ lib/about/views/env.erb
11
+ lib/about/views/layout.erb
12
+ lib/about/views/rack.erb
13
+ lib/about/views/rails.erb
14
+ lib/about/views/ruby.erb
15
+ lib/about/views/shared/_debug.erb
16
+ lib/about/views/shared/_version.erb
17
+ lib/about/views/sinatra.erb
data/Rakefile CHANGED
@@ -18,7 +18,8 @@ Hoe.spec 'about' do
18
18
  self.history_file = 'History.md'
19
19
 
20
20
  self.extra_deps = [
21
- ['logutils', '>= 0.5']
21
+ ['logutils', '>= 0.5'],
22
+ ['textutils', '>= 0.7']
22
23
  ]
23
24
 
24
25
  self.licenses = ['Public Domain']
@@ -1,22 +1,21 @@
1
1
 
2
+ # 3rd party gems/libs
3
+
4
+ require 'textutils'
5
+
6
+
7
+ # our own code
2
8
 
3
9
  require 'about/version' # let it always go first
4
10
 
5
11
 
6
12
  module About
7
13
 
8
- def self.banner
9
- "about #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
10
- end
11
-
12
- =begin
13
14
  def self.root
14
15
  "#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
15
16
  end
16
- =end
17
17
 
18
18
  end # module About
19
19
 
20
20
 
21
- puts About.banner # say hello
22
-
21
+ require 'about/server'
@@ -0,0 +1,39 @@
1
+ /* fix: use sass w/ variables */
2
+
3
+ body {
4
+ font-family: sans-serif;
5
+ background-color: #F4F4F4;
6
+ color: #333333;
7
+ }
8
+
9
+ a, a:visited {
10
+ text-decoration: none;
11
+ color: maroon;
12
+ }
13
+
14
+ a:hover {
15
+ text-decoration: underline;
16
+ color: #1E68A6;
17
+ background-color: yellow;
18
+ }
19
+
20
+
21
+ /* fix: use .small instead */
22
+ .smaller {
23
+ font-size: 12px;
24
+ /* color: #666666; */ /* lighter gray than text gray */
25
+ }
26
+
27
+
28
+
29
+ /** version block **********/
30
+
31
+ .version {
32
+ text-align: center;
33
+ margin-top: 10px;
34
+ color: grey; }
35
+ .version a, .version span {
36
+ font-size: 12px;
37
+ color: grey; }
38
+
39
+ /***************************/
@@ -0,0 +1,116 @@
1
+ ######
2
+ # NB: use rackup to startup Sinatra service (see config.ru)
3
+ #
4
+ # e.g. config.ru:
5
+ # require './boot'
6
+ # run About::Server
7
+
8
+
9
+ # 3rd party libs/gems
10
+
11
+ require 'sinatra/base'
12
+
13
+
14
+ module About
15
+
16
+ class Server < Sinatra::Base
17
+
18
+ def self.banner
19
+ "about #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] on Sinatra/#{Sinatra::VERSION} (#{ENV['RACK_ENV']})"
20
+ end
21
+
22
+ PUBLIC_FOLDER = "#{About.root}/lib/about/public"
23
+ VIEWS_FOLDER = "#{About.root}/lib/about/views"
24
+
25
+ puts "[boot] about - setting public folder to: #{PUBLIC_FOLDER}"
26
+ puts "[boot] about - setting views folder to: #{VIEWS_FOLDER}"
27
+
28
+ set :public_folder, PUBLIC_FOLDER # set up the static dir (with images/js/css inside)
29
+ set :views, VIEWS_FOLDER # set up the views dir
30
+
31
+ set :static, true # set up static file routing
32
+
33
+
34
+ #######################
35
+ # Models
36
+
37
+ # -- to be done
38
+
39
+ #################
40
+ # Helpers
41
+
42
+ include TextUtils::HypertextHelper # e.g. lets us use link_to, sanitize, etc.
43
+
44
+ def path_prefix
45
+ request.script_name # request.env['SCRIPT_NAME']
46
+ end
47
+
48
+ def ruby_path
49
+ "#{path_prefix}/ruby"
50
+ end
51
+
52
+ def rack_path
53
+ "#{path_prefix}/rack"
54
+ end
55
+
56
+ def env_path
57
+ "#{path_prefix}/env"
58
+ end
59
+
60
+ def sinatra_path
61
+ "#{path_prefix}/sinatra"
62
+ end
63
+
64
+ def rails_path
65
+ "#{path_prefix}/rails"
66
+ end
67
+
68
+ def root_path
69
+ "#{path_prefix}/"
70
+ end
71
+
72
+
73
+ ##############################################
74
+ # Controllers / Routing / Request Handlers
75
+
76
+ ###
77
+ ## todo: add page for gems/gem ?? why? why not?
78
+
79
+ ## todo: add page for threads/thread list ?? why? why not?
80
+
81
+ get '/' do
82
+ redirect( ruby_path )
83
+ end
84
+
85
+ get '/ruby' do
86
+ erb :ruby
87
+ end
88
+
89
+ get '/env' do
90
+ erb :env
91
+ end
92
+
93
+ get '/rack' do
94
+ erb :rack
95
+ end
96
+
97
+ get '/sinatra' do
98
+ erb :sinatra
99
+ end
100
+
101
+ get '/rails' do
102
+ erb :rails
103
+ end
104
+
105
+
106
+ get '/d*' do
107
+ erb :debug
108
+ end
109
+
110
+
111
+ end # class Server
112
+ end # module About
113
+
114
+
115
+ # say hello
116
+ puts About::Server.banner
@@ -1,4 +1,4 @@
1
1
 
2
2
  module About
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.0'
4
4
  end
@@ -0,0 +1,13 @@
1
+
2
+ <h3>Named Route Helpers</h3>
3
+
4
+ <pre>
5
+ root_path: <%= root_path %>
6
+ ruby_path: <%= ruby_path %>
7
+ env_path: <%= env_path %>
8
+ rack_path: <%= rack_path %>
9
+ sinatra_path: <%= sinatra_path %>
10
+ rails_path: <%= rails_path %>
11
+ </pre>
12
+
13
+ <%= erb :'shared/_debug' %>
@@ -0,0 +1,9 @@
1
+
2
+
3
+ <h3>Environment</h3>
4
+
5
+ <pre>
6
+ <% ENV.each do |key,value| %>
7
+ <%= key %> = <%= value %>
8
+ <% end %>
9
+ </pre>
@@ -0,0 +1,24 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <title>About / Sys Info</title>
6
+ <link href="<%= url('/style.css') %>" rel='stylesheet'>
7
+ </head>
8
+ <body>
9
+
10
+ <p>
11
+ About |
12
+ <%= link_to 'Ruby', ruby_path %> &bull;
13
+ <%= link_to 'Env', env_path %> &bull;
14
+ <%= link_to 'Rack', rack_path %> &bull;
15
+ <%= link_to 'Sinatra', sinatra_path %> &bull;
16
+ <%= link_to 'Rails', rails_path %>
17
+ </p>
18
+
19
+ <%= yield %>
20
+
21
+ <%= erb :'shared/_version' %>
22
+
23
+ </body>
24
+ </html>
@@ -0,0 +1,5 @@
1
+
2
+ <h3>Rack</h3>
3
+
4
+ to be done
5
+
@@ -0,0 +1,11 @@
1
+
2
+ <h3>Rails</h3>
3
+
4
+ to be done
5
+
6
+ <!-- check if Rails present ?
7
+ add versions of libs
8
+
9
+ Rails.root, Rails version, etc.
10
+ Rails.env?
11
+ -->
@@ -0,0 +1,17 @@
1
+
2
+ <h3>Ruby</h3>
3
+
4
+ <pre>
5
+ version: <%= RUBY_VERSION %>
6
+ release_date: <%= RUBY_RELEASE_DATE %>
7
+ platform: <%= RUBY_PLATFORM %>
8
+ </pre>
9
+
10
+
11
+ <h4>Loadpath</h4>
12
+
13
+ <pre>
14
+ <% $LOAD_PATH.each_with_index do |path,index| %>
15
+ [<%= index+1 %>] <%= path %>
16
+ <% end %>
17
+ </pre>
@@ -0,0 +1,16 @@
1
+ <h3>Request</h3>
2
+
3
+ <pre>
4
+ request.scheme: <%= request.scheme %>
5
+ request.script_name: <%= request.script_name %>
6
+ request.path_info: <%= request.path_info %>
7
+ request.port: <%= request.port %>
8
+ request.request_method: <%= request.request_method %>
9
+ request.query_string: <%= request.query_string %>
10
+ request.host: <%= request.host %>
11
+ request.referrer: <%= request.referrer %>
12
+ request.user_agent: <%= request.user_agent %>
13
+ request.url: <%= request.url %>
14
+ request.path: <%= request.path %>
15
+ request.ip: <%= request.ip %>
16
+ </pre>
@@ -0,0 +1,6 @@
1
+ <div class='version'>
2
+ <a href="https://github.com/rubylibs/about">about/<%= About::VERSION %></a>,
3
+ -
4
+ <span>Ruby/<%= "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM})" %> on</span>
5
+ <span>Sinatra/<%= Sinatra::VERSION %> (<%= ENV['RACK_ENV'] %>)</span>
6
+ </div>
@@ -0,0 +1,5 @@
1
+
2
+ <h3>Sinatra</h3>
3
+
4
+ to be done
5
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: about
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: logutils
16
- requirement: &77292950 !ruby/object:Gem::Requirement
16
+ requirement: &81325490 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '0.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *77292950
24
+ version_requirements: *81325490
25
+ - !ruby/object:Gem::Dependency
26
+ name: textutils
27
+ requirement: &81325240 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0.7'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *81325240
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rdoc
27
- requirement: &77292720 !ruby/object:Gem::Requirement
38
+ requirement: &81324970 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ~>
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '3.10'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *77292720
46
+ version_requirements: *81324970
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: hoe
38
- requirement: &77292470 !ruby/object:Gem::Requirement
49
+ requirement: &81324700 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ~>
@@ -43,7 +54,7 @@ dependencies:
43
54
  version: '3.3'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *77292470
57
+ version_requirements: *81324700
47
58
  description: about - sys info (system information) about your computer, environment,
48
59
  runtime, libs, etc. as mountable web app
49
60
  email: webslideshow@googlegroups.com
@@ -57,7 +68,18 @@ files:
57
68
  - README.md
58
69
  - Rakefile
59
70
  - lib/about.rb
71
+ - lib/about/public/style.css
72
+ - lib/about/server.rb
60
73
  - lib/about/version.rb
74
+ - lib/about/views/debug.erb
75
+ - lib/about/views/env.erb
76
+ - lib/about/views/layout.erb
77
+ - lib/about/views/rack.erb
78
+ - lib/about/views/rails.erb
79
+ - lib/about/views/ruby.erb
80
+ - lib/about/views/shared/_debug.erb
81
+ - lib/about/views/shared/_version.erb
82
+ - lib/about/views/sinatra.erb
61
83
  homepage: https://github.com/rubylibs/about
62
84
  licenses:
63
85
  - Public Domain