sportweb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,30 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '3.2.12'
4
+ gem 'sinatra', require: 'sinatra/base'
5
+
6
+ gem 'sqlite3' # database - use (embedded) sqlite database
7
+
8
+ gem 'thin' # webserver - use thin web server
9
+
10
+
11
+ ### rails asset addons
12
+
13
+ gem 'actionpack', require: 'action_controller/railtie' ## needed by sprockets-rails
14
+ gem 'sprockets-rails', require: 'sprockets/railtie'
15
+
16
+ gem 'sass-rails' ## todo/check -- require sass-rails/railtie ??
17
+ gem 'jquery-rails' ## todo/check -- require jquery-rails/railtie ?? to activate?
18
+
19
+
20
+
21
+ gem 'worlddb'
22
+ gem 'sportdb'
23
+ gem 'sportdb-admin'
24
+
25
+
26
+ ##########
27
+ # add sinatra (mountable) app(let)s
28
+ ## gem 'about' # mountable app - about - sys info pages
29
+ ## gem 'dbbrowser' # mountable app
30
+
data/Gemfile.lock ADDED
@@ -0,0 +1,160 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.12)
5
+ actionpack (= 3.2.12)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.12)
8
+ activemodel (= 3.2.12)
9
+ activesupport (= 3.2.12)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.4)
13
+ rack (~> 1.4.5)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.2.1)
17
+ activemodel (3.2.12)
18
+ activesupport (= 3.2.12)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.12)
21
+ activemodel (= 3.2.12)
22
+ activesupport (= 3.2.12)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activerecord-utils (0.2.0)
26
+ logutils
27
+ activeresource (3.2.12)
28
+ activemodel (= 3.2.12)
29
+ activesupport (= 3.2.12)
30
+ activesupport (3.2.12)
31
+ i18n (~> 0.6)
32
+ multi_json (~> 1.0)
33
+ arel (3.0.3)
34
+ builder (3.0.4)
35
+ daemons (1.1.9)
36
+ erubis (2.7.0)
37
+ eventmachine (1.0.3)
38
+ fetcher (0.4.3)
39
+ logutils (>= 0.6)
40
+ gli (2.12.0)
41
+ hike (1.2.3)
42
+ i18n (0.6.11)
43
+ journey (1.0.4)
44
+ jquery-rails (3.1.1)
45
+ railties (>= 3.0, < 5.0)
46
+ thor (>= 0.14, < 2.0)
47
+ json (1.8.1)
48
+ logutils (0.6.0)
49
+ mail (2.4.4)
50
+ i18n (>= 0.4.0)
51
+ mime-types (~> 1.16)
52
+ treetop (~> 1.4.8)
53
+ mime-types (1.25.1)
54
+ multi_json (1.10.1)
55
+ persondb (0.3.1)
56
+ activerecord
57
+ activerecord-utils
58
+ logutils
59
+ props
60
+ tagutils
61
+ textutils
62
+ worlddb
63
+ polyglot (0.3.5)
64
+ props (1.1.1)
65
+ rack (1.4.5)
66
+ rack-cache (1.2)
67
+ rack (>= 0.4)
68
+ rack-protection (1.5.3)
69
+ rack
70
+ rack-ssl (1.3.4)
71
+ rack
72
+ rack-test (0.6.2)
73
+ rack (>= 1.0)
74
+ rails (3.2.12)
75
+ actionmailer (= 3.2.12)
76
+ actionpack (= 3.2.12)
77
+ activerecord (= 3.2.12)
78
+ activeresource (= 3.2.12)
79
+ activesupport (= 3.2.12)
80
+ bundler (~> 1.0)
81
+ railties (= 3.2.12)
82
+ railties (3.2.12)
83
+ actionpack (= 3.2.12)
84
+ activesupport (= 3.2.12)
85
+ rack-ssl (~> 1.3.2)
86
+ rake (>= 0.8.7)
87
+ rdoc (~> 3.4)
88
+ thor (>= 0.14.6, < 2.0)
89
+ rake (10.3.2)
90
+ rdoc (3.12.2)
91
+ json (~> 1.4)
92
+ sass (3.3.14)
93
+ sass-rails (3.2.6)
94
+ railties (~> 3.2.0)
95
+ sass (>= 3.1.10)
96
+ tilt (~> 1.3)
97
+ sinatra (1.4.5)
98
+ rack (~> 1.4)
99
+ rack-protection (~> 1.4)
100
+ tilt (~> 1.3, >= 1.3.4)
101
+ sportdb (1.9.5)
102
+ activerecord
103
+ activerecord-utils
104
+ fetcher (>= 0.3)
105
+ gli (>= 2.5.6)
106
+ logutils
107
+ persondb
108
+ props
109
+ tagutils
110
+ textutils
111
+ worlddb (>= 2.0.2)
112
+ sportdb-admin (0.3.0)
113
+ sprockets (2.2.2)
114
+ hike (~> 1.2)
115
+ multi_json (~> 1.0)
116
+ rack (~> 1.0)
117
+ tilt (~> 1.1, != 1.3.0)
118
+ sprockets-rails (0.0.1)
119
+ sprockets (>= 1.0.2)
120
+ sqlite3 (1.3.9)
121
+ tagutils (0.2.2)
122
+ activerecord
123
+ logutils (>= 0.6)
124
+ textutils (0.9.4)
125
+ activesupport
126
+ logutils (~> 0.5)
127
+ props
128
+ thin (1.6.2)
129
+ daemons (>= 1.0.9)
130
+ eventmachine (>= 1.0.0)
131
+ rack (>= 1.0.0)
132
+ thor (0.19.1)
133
+ tilt (1.4.1)
134
+ treetop (1.4.15)
135
+ polyglot
136
+ polyglot (>= 0.3.1)
137
+ tzinfo (0.3.41)
138
+ worlddb (2.0.4)
139
+ activerecord
140
+ gli (>= 2.9)
141
+ logutils
142
+ props
143
+ tagutils
144
+ textutils (>= 0.9.4)
145
+
146
+ PLATFORMS
147
+ ruby
148
+
149
+ DEPENDENCIES
150
+ actionpack
151
+ jquery-rails
152
+ rails (= 3.2.12)
153
+ sass-rails
154
+ sinatra
155
+ sportdb
156
+ sportdb-admin
157
+ sprockets-rails
158
+ sqlite3
159
+ thin
160
+ worlddb
data/HISTORY.md ADDED
@@ -0,0 +1,3 @@
1
+ ### 0.0.1 / 2014-08-16
2
+
3
+ * Everything is new. First release.
data/Manifest.txt ADDED
@@ -0,0 +1,12 @@
1
+ Gemfile
2
+ Gemfile.lock
3
+ HISTORY.md
4
+ Manifest.txt
5
+ README.md
6
+ Rakefile
7
+ bin/sportweb
8
+ lib/sportweb.rb
9
+ lib/sportweb/app.rb
10
+ lib/sportweb/boot_with_bundler.rb
11
+ lib/sportweb/boot_with_require.rb
12
+ lib/sportweb/version.rb
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # sportweb gem - instant open sports web browser command line tool
2
+
3
+ * home :: [github.com/sportdb/sport.db.web.ruby](https://github.com/sportdb/sport.db.web.ruby)
4
+ * bugs :: [github.com/sportdb/sport.db.web.ruby/issues](https://github.com/sportdb/sport.db.web.ruby/issues)
5
+ * gem :: [rubygems.org/gems/sportweb](https://rubygems.org/gems/sportweb)
6
+ * rdoc :: [rubydoc.info/gems/sportweb](http://rubydoc.info/gems/sportweb)
7
+ * forum :: [groups.google.com/group/opensport](https://groups.google.com/group/opensport)
8
+
9
+
10
+ ## Usage
11
+
12
+ #### Step 1: Startup the instant web server.
13
+
14
+ Type in your shell:
15
+
16
+ $ sportweb
17
+
18
+ or
19
+
20
+ $ sportweb worldcup.db
21
+
22
+
23
+ >> Thin web server (v3.7.1 codename Doc Brown)
24
+ >> Listening on 0.0.0.0:3000, CTRL+C to stop
25
+
26
+ Note: The web server runs by default on port `3000`.
27
+
28
+
29
+ #### Step 2: Open your browser of choice and start browsing.
30
+
31
+ Open your browser of choice (e.g. [`localhost:3000`](http://localhost:3000))
32
+ and start browsing your open sports database
33
+ (e.g. `sport.db`, `football.db`, `worldcup.db`, etc.).
34
+
35
+ [add pic here]
36
+
37
+ That's it.
38
+
39
+
40
+
41
+ ## Install
42
+
43
+ Just install the gem:
44
+
45
+ $ gem install sportweb
46
+
47
+
48
+ ## License
49
+
50
+ The `sportweb` scripts are dedicated to the public domain.
51
+ Use it as you please with no restrictions whatsoever.
52
+
53
+
54
+ ## Questions? Comments?
55
+
56
+ Send them along to the
57
+ [Open Sports & Friends Forum/Mailing List](http://groups.google.com/group/opensport).
58
+ Thanks!
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require 'hoe'
2
+ require './lib/sportweb/version.rb'
3
+
4
+ Hoe.spec 'sportweb' do
5
+
6
+ self.version = SportWeb::VERSION
7
+
8
+ self.summary = 'sportweb - instant open sports web browser command line tool'
9
+ self.description = summary
10
+
11
+ self.urls = ['https://github.com/sportdb/sport.db.web.ruby']
12
+
13
+ self.author = 'Gerald Bauer'
14
+ self.email = 'opensport@googlegroups.com'
15
+
16
+ # switch extension to .markdown for gihub formatting
17
+ self.readme_file = 'README.md'
18
+ self.history_file = 'HISTORY.md'
19
+
20
+ self.licenses = ['Public Domain']
21
+
22
+ self.spec_extras = {
23
+ :required_ruby_version => '>= 1.9.2'
24
+ }
25
+
26
+ end
data/bin/sportweb ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sportweb'
4
+
5
+ SportWeb.main
6
+
data/lib/sportweb.rb ADDED
@@ -0,0 +1,65 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # test run like:
5
+ # $ ruby -I ./lib ./lib/sportweb.rb
6
+
7
+
8
+ require 'sportweb/version' # let version always go first
9
+
10
+
11
+
12
+ module SportWeb
13
+
14
+ def self.banner
15
+ "sportweb/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
16
+ end
17
+
18
+ def self.root
19
+ "#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
20
+ end
21
+
22
+ def self.main
23
+ puts 'hello from main'
24
+
25
+ require 'sportweb/boot_with_bundler'
26
+
27
+ app = Rack::Builder.new {
28
+ ### use Rails::Rack::Static
29
+
30
+ # Anything urls starting with /tiny will go to Sinatra
31
+ ### map "/tiny" do
32
+ ## run Sinatra.application
33
+ ### end
34
+
35
+ ## map '/' do
36
+ ## run SportDbAdmin::Engine
37
+ ## end
38
+
39
+ # Rest with "Dummy" Rails Host App
40
+ map '/' do
41
+ run SportWebHost
42
+ end
43
+
44
+ }.to_app
45
+
46
+
47
+ #####
48
+ # fix/todo:
49
+ ## use differnt port ??
50
+ ##
51
+ ## use --local for host e.g. 127.0.0.1 insteaod of 0.0.0.0 ???
52
+
53
+ puts 'before Thin.run app'
54
+ Rack::Handler::Thin.run app, :Port => 3000, :Host => '0.0.0.0'
55
+ puts 'after Thin.run app'
56
+
57
+ puts 'bye'
58
+ end
59
+
60
+ end # module SportWeb
61
+
62
+
63
+
64
+ SportWeb.main if __FILE__ == $0
65
+
@@ -0,0 +1,134 @@
1
+ # encoding: utf-8
2
+
3
+
4
+ puts '[boot] enter sportweb/app.rb'
5
+
6
+ ####
7
+ # setup mini-rails
8
+ # see https://gist.github.com/josevalim/1942658
9
+ # and others
10
+
11
+ ### host app - no module - keep it simple
12
+ class SportWebHost < Rails::Application
13
+
14
+ routes.append do
15
+ match '/hello/world' => 'hello#world'
16
+
17
+ ## mount About::Server, :at => '/sysinfo'
18
+ ## mount DbBrowser::Server, :at => '/browse'
19
+
20
+ ###
21
+ # mount sinatra app (bundled w/ sportdb-service gem) for json api service
22
+ # todo: add JSON API link to layout
23
+ ## get '/api' => redirect('/api/v1')
24
+ ## mount SportDb::Service::Server, :at => '/api/v1' # NB: make sure to require 'sportdb-service'
25
+
26
+ ## mount sinatra app (bundled w/ logutils gem)
27
+ ## mount LogDb::Server, :at => '/logs' # NB: make sure to require 'logutils/server'
28
+
29
+ mount SportDbAdmin::Engine, :at => '/' # mount a root possible?
30
+ end
31
+
32
+
33
+ # Configure the default encoding used in templates for Ruby 1.9.
34
+ config.encoding = "utf-8"
35
+
36
+ # Enable cache classes. Production style.
37
+ config.cache_classes = true
38
+
39
+ # We need a secret token for session, cookies, etc.
40
+ config.secret_token = "49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk"
41
+
42
+
43
+ #################################################
44
+ # Enable the asset pipeline !!!!!!!!!!!!!!!!
45
+ config.assets.enabled = true
46
+ # Version of your assets, change this if you want to expire all your assets
47
+ config.assets.version = '1.0'
48
+
49
+ ### Enables Sprockets compile environment.
50
+ ## If disabled, Rails.application.assets will be unavailable
51
+ ## to any ActionView helpers.
52
+ ## View helpers will depend on assets being precompiled
53
+ ## to public/assets in order to link to them.
54
+ ## You can still access the environment
55
+ ## by directly calling Rails.application.assets
56
+ ## config.assets.compile = true
57
+ end
58
+
59
+
60
+ # This is a barebone controller. One good reference can be found here:
61
+ # http://piotrsarnacki.com/2010/12/12/lightweight-controllers-with-rails3/
62
+
63
+ class HelloController < ActionController::Metal
64
+ include ActionController::Rendering
65
+
66
+ def world
67
+ render text: 'Hello world!'
68
+ end
69
+ end
70
+
71
+
72
+ ####
73
+ # Database Setup & Config
74
+ #
75
+ # possible w/o config/database.yml ???
76
+ #
77
+ # see stackoverflow.com/questions/4204724/strategies-for-overriding-database-yml
78
+ #
79
+ # google for "rails database.yml opt out" ???
80
+
81
+
82
+ db_config = {
83
+ adapter: 'sqlite3',
84
+ database: 'football.db' # NOTE: change to use your db of choice (e.g. worldcup.db, bundesliga.db, ski.db etc.)
85
+ }
86
+
87
+ pp db_config
88
+ ActiveRecord::Base.establish_connection( db_config )
89
+ ## for debugging - disable for production use
90
+ ActiveRecord::Base.logger = Logger.new( STDOUT )
91
+
92
+ ### make all SportDb models - top level (e.g. SportDb::Model::Team becomes Team)
93
+ include SportDb::Models
94
+
95
+
96
+ puts '[boot] before App.initialize!'
97
+ # Initialize the app (originally in config/environment.rb)
98
+ SportWebHost.initialize!
99
+ puts '[boot] after App.initialize!'
100
+
101
+
102
+
103
+ ####
104
+ # check asset pipeline
105
+
106
+ puts "Rails.version: #{Rails.version}"
107
+ puts "Rails.env: #{Rails.env}"
108
+ puts "Rails.root: #{Rails.root}"
109
+ puts "Rails.application.class: #{Rails.application.class.name}"
110
+ puts "Rails.application.assets.class: #{Rails.application.assets.class.name}"
111
+
112
+ pp Rails.application.assets
113
+
114
+ puts ">> Rails asset pipeline:"
115
+
116
+ if Rails.application.assets.find_asset( "logos/24x24/austria.png" ).present?
117
+ puts "asset 'logos/24x24/austria.png' found"
118
+ else
119
+ puts "asset 'logos/24x24/austria.png' not found"
120
+ end
121
+
122
+
123
+ # Print the stack for fun!
124
+ puts ">> Starting Rails stack:"
125
+ Rails.configuration.middleware.each do |middleware|
126
+ puts "use #{middleware.inspect}"
127
+ end
128
+
129
+ ## # Run it (originally in config.ru)
130
+ ## run MyApp
131
+
132
+
133
+
134
+ puts '[boot] leave sportweb/app.rb'
@@ -0,0 +1,69 @@
1
+ # encoding: utf-8
2
+
3
+ puts '[boot] enter boot_with_bundler.rb'
4
+
5
+
6
+ ENV['RACK_ENV'] ||= 'development'
7
+ puts "ENV['RACK_ENV'] = #{ENV['RACK_ENV']}"
8
+
9
+ puts '[boot] before require bundler'
10
+ require 'bundler'
11
+ puts '[boot] after require bundler'
12
+
13
+
14
+ # ruby core n stdlibs
15
+ require 'json'
16
+ require 'uri'
17
+ require 'logger'
18
+ require 'pp'
19
+
20
+
21
+ # 3rd party gems via bundler (see Gemfile)
22
+
23
+ puts '[boot] before Bundler.setup'
24
+ Bundler.setup
25
+ puts '[boot] after Bundler.setup'
26
+
27
+ puts '[boot] before Bundler.require'
28
+ Bundler.require(:default, ENV['RACK_ENV'].to_sym)
29
+ puts '[boot] after Bundler.require'
30
+
31
+ #########
32
+ # require rails n rails/all - still needed ??
33
+ puts '[boot] before require rails'
34
+ require 'rails'
35
+ puts '[boot] after require rails'
36
+
37
+ puts '[boot] before require rails/all'
38
+ ## note: do NOT load active_record/railtie - will load database/config ??
39
+ ## require it ourself
40
+
41
+ ### require 'rails/all'
42
+
43
+ ###
44
+ ## gem 'sprockets-rails', :require => 'sprockets/railtie'
45
+ ##
46
+ ## Or alternatively require 'sprockets/railtie' in your config/application.rb if you have Bundler auto-require disabled.
47
+
48
+ ['action_controller',
49
+ 'sprockets'].each do |framework|
50
+ begin
51
+ require "#{framework}/railtie"
52
+ rescue LoadError
53
+ end
54
+ end
55
+
56
+ puts '[boot] after require rails/all'
57
+
58
+
59
+ #############
60
+ ### move require app to sportweb.rb ????
61
+
62
+ puts '[boot] before require sportweb/app'
63
+ require 'sportweb/app'
64
+ puts '[boot] after require sportweb/app'
65
+
66
+
67
+
68
+ puts '[boot] leave boot_with_bundler.rb'
69
+
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # note: it's an addon to sportdb (get all libs via sportdb)
5
+
6
+ puts '[boot] before require worlddb'
7
+ require 'worlddb'
8
+ puts '[boot] after require worlddb'
9
+
10
+
11
+ puts '[boot] before require sportdb'
12
+ require 'sportdb'
13
+ puts '[boot] after require sportdb'
14
+
15
+
16
+ puts '[boot] before require rails'
17
+ require 'rails'
18
+ puts '[boot] after require rails'
19
+
20
+
21
+ puts '[boot] before require rails/all'
22
+ require 'rails/all'
23
+ puts '[boot] after require rails/all'
24
+
25
+
26
+
27
+ puts '[boot] before before sportdb-admin'
28
+ require 'sportdb/admin' ## require addon sportdb-keys
29
+ puts '[boot] after require sportdb-admin'
30
+
@@ -0,0 +1,4 @@
1
+
2
+ module SportWeb
3
+ VERSION = '0.0.1'
4
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sportweb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Gerald Bauer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-08-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ requirement: &82813100 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '4.0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *82813100
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ requirement: &82812810 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '3.11'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *82812810
36
+ description: sportweb - instant open sports web browser command line tool
37
+ email: opensport@googlegroups.com
38
+ executables:
39
+ - sportweb
40
+ extensions: []
41
+ extra_rdoc_files:
42
+ - HISTORY.md
43
+ - Manifest.txt
44
+ - README.md
45
+ files:
46
+ - Gemfile
47
+ - Gemfile.lock
48
+ - HISTORY.md
49
+ - Manifest.txt
50
+ - README.md
51
+ - Rakefile
52
+ - bin/sportweb
53
+ - lib/sportweb.rb
54
+ - lib/sportweb/app.rb
55
+ - lib/sportweb/boot_with_bundler.rb
56
+ - lib/sportweb/boot_with_require.rb
57
+ - lib/sportweb/version.rb
58
+ homepage: https://github.com/sportdb/sport.db.web.ruby
59
+ licenses:
60
+ - Public Domain
61
+ post_install_message:
62
+ rdoc_options:
63
+ - --main
64
+ - README.md
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: 1.9.2
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 1.8.17
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: sportweb - instant open sports web browser command line tool
85
+ test_files: []