Copied initial project structure from Raven
This commit is contained in:
parent
c509297b1c
commit
69ec98cba1
9
.gitignore
vendored
9
.gitignore
vendored
@ -56,3 +56,12 @@ build-iPhoneSimulator/
|
||||
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
||||
# .rubocop-https?--*
|
||||
|
||||
# Local database storage
|
||||
data/raven.db
|
||||
|
||||
# Node modules for Grunt.js
|
||||
node_modules/
|
||||
|
||||
# Compiled CSS and JS
|
||||
public/css/
|
||||
public/js/
|
||||
|
12
Gemfile
Normal file
12
Gemfile
Normal file
@ -0,0 +1,12 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'sinatra', '~> 3.0'
|
||||
gem 'sinatra-contrib', '~> 3.0'
|
||||
gem 'puma', '~> 6.1'
|
||||
|
||||
gem 'sequel', '~> 5.66'
|
||||
gem 'sqlite3', '~> 1.6'
|
||||
|
||||
# Use rerun gem to auto-reload app
|
||||
gem 'rerun'
|
||||
|
50
Gemfile.lock
Normal file
50
Gemfile.lock
Normal file
@ -0,0 +1,50 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
ffi (1.15.5)
|
||||
listen (3.8.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
multi_json (1.15.0)
|
||||
mustermann (3.0.0)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
nio4r (2.5.8)
|
||||
puma (6.1.1)
|
||||
nio4r (~> 2.0)
|
||||
rack (2.2.6.2)
|
||||
rack-protection (3.0.5)
|
||||
rack
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rerun (0.14.0)
|
||||
listen (~> 3.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
sequel (5.66.0)
|
||||
sinatra (3.0.5)
|
||||
mustermann (~> 3.0)
|
||||
rack (~> 2.2, >= 2.2.4)
|
||||
rack-protection (= 3.0.5)
|
||||
tilt (~> 2.0)
|
||||
sinatra-contrib (3.0.5)
|
||||
multi_json
|
||||
mustermann (~> 3.0)
|
||||
rack-protection (= 3.0.5)
|
||||
sinatra (= 3.0.5)
|
||||
tilt (~> 2.0)
|
||||
sqlite3 (1.6.1-x86_64-linux)
|
||||
tilt (2.1.0)
|
||||
|
||||
PLATFORMS
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
puma (~> 6.1)
|
||||
rerun
|
||||
sequel (~> 5.66)
|
||||
sinatra (~> 3.0)
|
||||
sinatra-contrib (~> 3.0)
|
||||
sqlite3 (~> 1.6)
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.5
|
65
Gruntfile.js
Normal file
65
Gruntfile.js
Normal file
@ -0,0 +1,65 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
|
||||
sass: {
|
||||
dist: {
|
||||
options: {
|
||||
style: 'compressed'
|
||||
},
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: 'assets/styles',
|
||||
src: ['**/*.scss'],
|
||||
dest: 'public/css',
|
||||
ext: '.css'
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
||||
coffee: {
|
||||
options: {
|
||||
sourceMap: true,
|
||||
style: 'compressed'
|
||||
},
|
||||
files: {
|
||||
expand: true,
|
||||
flatten: true,
|
||||
cwd: 'assets/coffee',
|
||||
src: ['*.coffee'],
|
||||
dest: 'public/js',
|
||||
ext: '.js'
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
css: {
|
||||
files: ['assets/styles/**/*.scss'],
|
||||
tasks: ['sass'],
|
||||
options: {
|
||||
atBegin: true,
|
||||
spawn: false
|
||||
}
|
||||
},
|
||||
js: {
|
||||
files: ['assets/coffee/*.coffee'],
|
||||
tasks: ['coffee'],
|
||||
options: {
|
||||
atBegin: true,
|
||||
spawn: false
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Load plugins.
|
||||
grunt.loadNpmTasks('grunt-contrib-sass');
|
||||
grunt.loadNpmTasks('grunt-contrib-coffee');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
|
||||
// Default task(s).
|
||||
grunt.registerTask('default', ['sass', 'coffee']);
|
||||
|
||||
};
|
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
||||
Copyright (c) <year> <owner>
|
||||
Copyright (c) 2023 Bit Goblin
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
|
20
Rakefile
Normal file
20
Rakefile
Normal file
@ -0,0 +1,20 @@
|
||||
require 'bundler/setup'
|
||||
|
||||
require 'sequel'
|
||||
require 'sqlite3'
|
||||
|
||||
namespace :db do
|
||||
task :migrate do
|
||||
%x{sequel -m 'db/migrations/' 'sqlite://data/stgm.db'}
|
||||
end
|
||||
end
|
||||
|
||||
namespace :server do
|
||||
task :dev do
|
||||
%x{ruby server.rb}
|
||||
end
|
||||
|
||||
task :reload do
|
||||
%x{rerun --no-notify 'ruby server.rb'}
|
||||
end
|
||||
end
|
3
assets/styles/drake.scss
Normal file
3
assets/styles/drake.scss
Normal file
@ -0,0 +1,3 @@
|
||||
body{
|
||||
background: white;
|
||||
}
|
0
data/.gitkeep
Normal file
0
data/.gitkeep
Normal file
3
data/defaults.yaml
Normal file
3
data/defaults.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
database:
|
||||
adapter: 'sqlite'
|
||||
database: 'data/raven.db'
|
20
lib/config.rb
Normal file
20
lib/config.rb
Normal file
@ -0,0 +1,20 @@
|
||||
require 'yaml'
|
||||
|
||||
class Config
|
||||
|
||||
def initialize(config_path)
|
||||
@data = YAML::load_file(config_path)
|
||||
end
|
||||
|
||||
def get(key, depth = 0)
|
||||
bits = key.split('.')
|
||||
value = @data
|
||||
|
||||
bits.each do |bit|
|
||||
value = value[bit]
|
||||
end
|
||||
|
||||
return value
|
||||
end
|
||||
|
||||
end
|
21
lib/helpers.rb
Normal file
21
lib/helpers.rb
Normal file
@ -0,0 +1,21 @@
|
||||
helpers do
|
||||
|
||||
def nullable(value)
|
||||
if (value) and (value != '')
|
||||
return value
|
||||
else
|
||||
return 'N/a'
|
||||
end
|
||||
end
|
||||
|
||||
def date_format(date)
|
||||
dt = date.to_datetime
|
||||
return dt.strftime('%B %d, %Y @ %I:%M:%S %p %Z')
|
||||
end
|
||||
|
||||
def date_format_input(date)
|
||||
dt = date.to_datetime
|
||||
return dt.strftime('%Y-%m-%dT%H:%M:%S')
|
||||
end
|
||||
|
||||
end
|
1
lib/routes.rb
Normal file
1
lib/routes.rb
Normal file
@ -0,0 +1 @@
|
||||
require_relative 'routes/index.rb'
|
10
lib/routes/index.rb
Normal file
10
lib/routes/index.rb
Normal file
@ -0,0 +1,10 @@
|
||||
namespace '/' do
|
||||
|
||||
get '' do
|
||||
erb :index, :locals => {
|
||||
:title => 'Dashboard'
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
1741
package-lock.json
generated
Normal file
1741
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
34
package.json
Normal file
34
package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "stage-manager",
|
||||
"version": "0.1.0",
|
||||
"description": "Bit Goblin video project manager",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"grunt": "grunt",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "gitea@git.metaunix.net:BitGoblin/stage-manager.git"
|
||||
},
|
||||
"keywords": [
|
||||
"video",
|
||||
"project"
|
||||
],
|
||||
"author": "Gregory Ballanine <gballantine@bitgoblin.tech>",
|
||||
"uploaders": [
|
||||
{
|
||||
"name": "Gregory Ballantine",
|
||||
"email": "gballantine@bitgoblin.tech"
|
||||
}
|
||||
],
|
||||
"license": "BSD-2-Clause",
|
||||
"devDependencies": {
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"grunt-contrib-coffee": "^2.1.0",
|
||||
"grunt-contrib-sass": "^2.0.0",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"sass": "^1.55.0"
|
||||
}
|
||||
}
|
31
server.rb
Normal file
31
server.rb
Normal file
@ -0,0 +1,31 @@
|
||||
require 'logger'
|
||||
require 'sequel'
|
||||
require 'sqlite3'
|
||||
require 'sinatra'
|
||||
require 'sinatra/namespace'
|
||||
|
||||
require_relative 'lib/config.rb'
|
||||
|
||||
set :public_folder, __dir__ + '/public'
|
||||
|
||||
set :views, settings.root + '/views'
|
||||
|
||||
# Load configuration file
|
||||
conf = Config.new(File.join(__dir__, 'data/defaults.yaml'))
|
||||
|
||||
# Initialize logging
|
||||
logger = Logger.new(STDOUT)
|
||||
logger.level = Logger::INFO
|
||||
|
||||
# Load the Sequel timestamps plugin
|
||||
Sequel::Model.plugin :timestamps
|
||||
# Initialize Sequel gem for database actions
|
||||
DB = Sequel.connect(adapter: conf.get('database.adapter'), database: conf.get('database.database'))
|
||||
# Load models
|
||||
# TODO - when models get made
|
||||
|
||||
# Load helper functions
|
||||
require_relative 'lib/helpers.rb'
|
||||
|
||||
# Register route handlers
|
||||
require_relative 'lib/routes.rb'
|
7
views/index.erb
Normal file
7
views/index.erb
Normal file
@ -0,0 +1,7 @@
|
||||
<div class="row">
|
||||
<div class="twelve columns">
|
||||
<h1 id="site-header">Welcome to Stage Manager</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
21
views/layout.erb
Normal file
21
views/layout.erb
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><%= title %> | Stage Manager</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
|
||||
<link rel="stylesheet" href="/css/drake.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<script src="/js/wyrm.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Main navigation -->
|
||||
<%= erb :'layout/navbar', :locals => locals %>
|
||||
|
||||
<div id="main-wrapper" class="container fluid card">
|
||||
<%= yield %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
9
views/layout/mobile_navbar.erb
Normal file
9
views/layout/mobile_navbar.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<nav id="mobile-nav">
|
||||
<span class="u-text-centered"><i id="mobile-nav-toggle" class="fa-solid fa-bars"></i></span>
|
||||
<ul>
|
||||
<li><a href="/">Dashboard <i class="fa-solid fa-gauge"></i></a></li>
|
||||
<li><a href="/item/list">Items <i class="fa-solid fa-desktop"></i></a></li>
|
||||
<li><a href="/license/list">Licenses <i class="fa-solid fa-floppy-disk"></i></a></li>
|
||||
<li><a href="/ip-tracker">IP Tracker <i class="fa-solid fa-network-wired"></i></a></li>
|
||||
</ul>
|
||||
</nav>
|
6
views/layout/navbar.erb
Normal file
6
views/layout/navbar.erb
Normal file
@ -0,0 +1,6 @@
|
||||
<nav id="main-nav">
|
||||
<h3>Stage Manager <i id="nav-toggle" class="fa-solid fa-bars"></i></h3>
|
||||
<ul>
|
||||
<li><a href="/">Dashboard <i class="fa-solid fa-gauge"></i></a></li>
|
||||
</ul>
|
||||
</nav>
|
Loading…
Reference in New Issue
Block a user