diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..1b20c5f --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gem 'sinatra', '~> 3.0' +gem 'puma', '~> 6.0' + +gem 'rerun' + diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..198d57c --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,38 @@ +GEM + remote: https://rubygems.org/ + specs: + ffi (1.15.5) + listen (3.7.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + mustermann (3.0.0) + ruby2_keywords (~> 0.0.1) + nio4r (2.5.8) + puma (6.0.0) + nio4r (~> 2.0) + rack (2.2.4) + rack-protection (3.0.4) + rack + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) + rerun (0.13.1) + listen (~> 3.0) + ruby2_keywords (0.0.5) + sinatra (3.0.4) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.0.4) + tilt (~> 2.0) + tilt (2.0.11) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + puma (~> 6.0) + rerun + sinatra (~> 3.0) + +BUNDLED WITH + 2.3.5 diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..2514748 --- /dev/null +++ b/Rakefile @@ -0,0 +1,11 @@ +require 'bundler/setup' + +namespace :server do + task :dev do + %x{puma -C puma.rb} + end + + task :reload do + %x{rerun --no-notify 'puma -C puma.rb'} + end +end diff --git a/app/controllers/auth.rb b/app/controllers/auth.rb new file mode 100644 index 0000000..9f8f930 --- /dev/null +++ b/app/controllers/auth.rb @@ -0,0 +1,9 @@ +class AuthController < Sinatra::Base + + get '/login' do + erb :'auth/login', :locals => { + :title => 'Login to your account' + } + end + +end diff --git a/app/controllers/index.rb b/app/controllers/index.rb new file mode 100644 index 0000000..c5fd93a --- /dev/null +++ b/app/controllers/index.rb @@ -0,0 +1,9 @@ +class IndexController < Sinatra::Base + + get '/' do + erb :index, :locals => { + :title => 'Home' + } + end + +end diff --git a/app/settings.rb b/app/settings.rb new file mode 100644 index 0000000..8f1d37c --- /dev/null +++ b/app/settings.rb @@ -0,0 +1,10 @@ +class Sinatra::Base + + configure do + enable :sessions + + set :views, './views' + set :public_folder, './public' + end + +end diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..329bce9 --- /dev/null +++ b/config.ru @@ -0,0 +1,15 @@ +require 'rubygems' +require 'sinatra/base' + +require_relative 'app/settings.rb' + +require_relative 'app/controllers/index.rb' +require_relative 'app/controllers/auth.rb' + +map "/" do + run IndexController +end + +map "/auth" do + run AuthController +end diff --git a/puma.rb b/puma.rb new file mode 100644 index 0000000..7ce1173 --- /dev/null +++ b/puma.rb @@ -0,0 +1,8 @@ +root = Dir.getwd.to_s + +bind 'tcp://0.0.0.0:3108' +pidfile '/tmp/puma.pid' +state_path '/tmp/puma.state' +rackup root.to_s + '/config.ru' + +threads 4, 8 diff --git a/views/auth/login.erb b/views/auth/login.erb new file mode 100644 index 0000000..f991480 --- /dev/null +++ b/views/auth/login.erb @@ -0,0 +1,30 @@ +
+
+
+ +
+

+
+ + +
+
+ +
+

+
+ + +
+
+ +
+

+
+ +
+
+ +
+
+
diff --git a/views/index.erb b/views/index.erb new file mode 100644 index 0000000..8b8f6f1 --- /dev/null +++ b/views/index.erb @@ -0,0 +1,6 @@ +
+
+

Welcome to Webdap!

+

You can use this site to manage your network account. Click here to login.

+
+
diff --git a/views/layout.erb b/views/layout.erb new file mode 100644 index 0000000..fd49450 --- /dev/null +++ b/views/layout.erb @@ -0,0 +1,15 @@ + + + + + + + <%= title %> | Webdap + + + +
+ <%= yield %> +
+ + \ No newline at end of file