oldskool 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'sinatra'
4
+ gem 'httparty'
data/Gemfile.lock CHANGED
@@ -1,6 +1,11 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ httparty (0.8.1)
5
+ multi_json
6
+ multi_xml
7
+ multi_json (1.0.4)
8
+ multi_xml (0.4.1)
4
9
  rack (1.4.0)
5
10
  rack-protection (1.1.4)
6
11
  rack
@@ -14,4 +19,5 @@ PLATFORMS
14
19
  ruby
15
20
 
16
21
  DEPENDENCIES
22
+ httparty
17
23
  sinatra
data/config.ru CHANGED
@@ -1,5 +1,7 @@
1
1
  $: << File.join(File.dirname(__FILE__), "lib")
2
2
 
3
+ require 'bundler/setup'
4
+
3
5
  require 'oldskool'
4
6
 
5
7
  set :run, false
@@ -8,10 +10,10 @@ config = YAML.load_file(File.expand_path("../config/oldskool.yaml", __FILE__))
8
10
 
9
11
  # If you want basic HTTP authentication
10
12
  # include :username and :password in gdash.yaml
11
- #if config[:username] && config[:password]
12
- # use Rack::Auth::Basic do |username, password|
13
- # username == config[:username] && password == config[:password]
14
- # end
15
- #end
13
+ if config[:username] && config[:password]
14
+ use Rack::Auth::Basic do |username, password|
15
+ username == config[:username] && password == config[:password]
16
+ end
17
+ end
16
18
 
17
19
  run Oldskool::SinatraApp.new(config)
@@ -20,12 +20,25 @@ module Oldskool
20
20
  include Rack::Utils
21
21
 
22
22
  alias_method :h, :escape_html
23
+
24
+ def base_url
25
+ "#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}"
26
+ end
27
+
28
+ def search_url
29
+ "#{base_url}/do"
30
+ end
23
31
  end
24
32
 
25
33
  get '/' do
26
34
  erb :index
27
35
  end
28
36
 
37
+ get '/opensearch.xml' do
38
+ content_type 'application/opensearchdescription+xml', :charset => 'utf-8'
39
+ erb :opensearch_xml, :layout => false
40
+ end
41
+
29
42
  get '/do' do
30
43
  if params[:q]
31
44
  @result = @router.route(params)
@@ -0,0 +1,3 @@
1
+ module Oldskool
2
+ VERSION = "0.0.2"
3
+ end
data/lib/oldskool.rb CHANGED
@@ -1,15 +1,13 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
- module Oldskool
5
- require 'oldskool/utils'
6
-
7
- Bundler.require(:default)
4
+ Bundler.require(:default)
8
5
 
6
+ module Oldskool
7
+ require 'oldskool/version'
9
8
  require 'oldskool/router'
10
9
  require 'oldskool/router'
11
10
  require 'oldskool/url_handler'
12
11
  require 'oldskool/error_handler'
13
12
  require 'oldskool/sinatra_app'
14
-
15
13
  end
Binary file
data/views/index.erb CHANGED
@@ -5,12 +5,7 @@
5
5
  <div class="row">
6
6
  <form action="/do" method="get" class="span10">
7
7
  <div class="span16">
8
- <div class="row">
9
- <div class="span2">&nbsp;</div>
10
- <input name="q" id="q" type="text" placeholder="Query" class="span10"/>
11
- <div class="span1">&nbsp;</div>
12
- <button type="submit" class="btn">Go</button>
13
- </div>
8
+ <center><input name="q" id="q" type="text" placeholder="#" class="span10"/></center>
14
9
  </div>
15
10
  </form>
16
11
  </div>
data/views/layout.erb CHANGED
@@ -2,6 +2,7 @@
2
2
  <head>
3
3
  <link rel="stylesheet/less" type="text/css" href="/lib/bootstrap.less">
4
4
  <script src="/js/less-1.1.3.min.js" type="text/javascript"></script>
5
+ <link rel="search" type="application/opensearchdescription+xml" title="Oldskool" href="/opensearch.xml" />
5
6
  <title>Oldskool</title>
6
7
  </head>
7
8
  <body style="padding-top: 80px;">
@@ -16,7 +17,7 @@
16
17
  <% end %>
17
18
  </ul>
18
19
  <% end %>
19
- <form action="/do" method="get" class="pull-right"><input name="q" type="text" placeholder="Query" /></form>
20
+ <form action="/do" method="get" class="pull-right"><input name="q" type="text" placeholder="#" /></form>
20
21
  </div>
21
22
  </div>
22
23
  </div>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
3
+ <ShortName>Oldskool</ShortName>
4
+ <Description>Web Commandline</Description>
5
+ <InputEncoding>UTF-8</InputEncoding>
6
+ <Image width="16" height="16" type="image/x-icon"><%= base_url %>/favicon.ico</Image>
7
+ <Url type="text/html" method="get" template="<%= search_url %>?q={searchTerms}"></Url>
8
+ <Tags>oldskool</Tags>
9
+ </OpenSearchDescription>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oldskool
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - R.I.Pienaar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-14 00:00:00 +00:00
18
+ date: 2012-01-15 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -32,6 +32,34 @@ dependencies:
32
32
  version: "0"
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: bundler
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: httparty
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
35
63
  description: "description: Pluggable web command line"
36
64
  email: rip@devco.net
37
65
  executables: []
@@ -41,14 +69,15 @@ extensions: []
41
69
  extra_rdoc_files: []
42
70
 
43
71
  files:
44
- - lib/oldskool/utils.rb
45
72
  - lib/oldskool/router.rb
46
73
  - lib/oldskool/error_handler.rb
47
74
  - lib/oldskool/url_handler.rb
75
+ - lib/oldskool/version.rb
48
76
  - lib/oldskool/sinatra_app.rb
49
77
  - lib/oldskool.rb
50
78
  - views/layout.erb
51
79
  - views/index.erb
80
+ - views/opensearch_xml.erb
52
81
  - views/do.erb
53
82
  - public/js/less-1.1.3.min.js
54
83
  - public/lib/forms.less
@@ -60,6 +89,7 @@ files:
60
89
  - public/lib/mixins.less
61
90
  - public/lib/variables.less
62
91
  - public/lib/type.less
92
+ - public/favicon.ico
63
93
  - config/oldskool.yaml.dist
64
94
  - config.ru
65
95
  - Gemfile
@@ -1,9 +0,0 @@
1
- module Oldskool
2
- module Utils
3
- include Rack::Utils
4
-
5
- def plugin_template(template, relative)
6
- File.read(File.expand_path("../../../views/#{template}.erb", relative))
7
- end
8
- end
9
- end