Skip to content

Commit

Permalink
feat: new pipeline
Browse files Browse the repository at this point in the history
* better folder structure
* better pipeline for assets
* now serving minified app
* npm run app now shows fake logs for development
  • Loading branch information
kilianc committed May 29, 2015
1 parent 4051f97 commit 45bba8c
Show file tree
Hide file tree
Showing 54 changed files with 216 additions and 92 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
webapp/css/*.css
webapp/scripts/*.js
app/css/*
app/*.js
dist
29 changes: 22 additions & 7 deletions webapp/scripts/app.js → app/app.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,25 @@ angular
var $sce = $injector.get('$sce')
var $moment = $injector.get('moment')
var $localForage = $injector.get('$localForage')
var $window = $injector.get('$window')
var $streamLines = $('.stream-lines')
var ctrl = this
var BUFFER_SIZE = 100
var ctrl = this

ctrl.paused = false
ctrl.version = '0.2.0'
ctrl.version = '<%= version %>'
ctrl.lines = []

/**
* Socket stuff
*/

ctrl.socket = io(document.location.origin, { path: document.location.pathname + 'socket.io' })
// handle development mode
if ($window.localStorage.development) {
ctrl.socket = io(document.location.origin)
} else {
ctrl.socket = io(document.location.origin, { path: document.location.pathname + 'socket.io' })
}

ctrl.socket.on('streams', function (streams) {
ctrl.streams = streams
Expand Down Expand Up @@ -68,12 +74,15 @@ angular
}

function formatLine(line) {
// for object just format JSON
if ('object' === line.type) {
if (!line.content) {
// handle empty line
line.html = $sce.trustAsHtml('')
} else if ('object' === line.type) {
// for object just format JSON
line.html = $sce.trustAsHtml('<pre>' + JSON.stringify(line.content, null, ' ') + '</pre>')
} else {
// for log lines format ansi format
line.html = ansi_up.ansi_to_html(line.content || line.line, { use_classes: true })
// for log lines use ansi format
line.html = ansi_up.ansi_to_html(line.content, { use_classes: true })
line.html = $sce.trustAsHtml(line.html)
}

Expand Down Expand Up @@ -170,4 +179,10 @@ angular
$localForage.getItem('streamDirection').then(function (streamDirection) {
ctrl.streamDirection = undefined === streamDirection ? true : streamDirection
})

/**
* Tell UI we're ready to roll
*/

ctrl.loaded = true
})
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
39 changes: 20 additions & 19 deletions webapp/index.html → app/index.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<!DOCTYPE html>
<html>
<html ng-app="app" ng-controller="MainController as ctrl">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>rTail</title>

<!-- stlyles -->
<title ng-if="!ctrl.loaded">rTail : loading ...</title>
<title ng-if="ctrl.loaded">rTail : {{ctrl.activeStream}}</title>
<!-- build:css(app) css/bundle.min.css -->
<link href="css/main.css" rel="stylesheet" type="text/css">
<link href="css/dark-theme.css" rel="stylesheet" type="text/css">
<link href="css/light-theme.css" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro|Roboto+Mono|Inconsolata|Anonymous+Pro|Ubuntu+Mono|Droid+Sans+Mono|Nunito:300' rel='stylesheet' type='text/css'>

<!-- endbuild -->
<link href='//fonts.googleapis.com/css?family=Source+Code+Pro|Roboto+Mono|Inconsolata|Anonymous+Pro|Ubuntu+Mono|Droid+Sans+Mono|Nunito:300' rel='stylesheet' type='text/css'>
<!-- favicon -->
<link rel="icon" href="images/common/favicon-16x16.png" sizes="16x16">
<link rel="icon" href="images/common/favicon-32x32.png" sizes="32x32">
<link rel="icon" href="images/common/favicon-96x96.png" sizes="96x96">
</head>
<body class="{{ctrl.theme}} font-family-{{ctrl.fontFamily}} font-size-{{ctrl.fontSize}}" ng-app="app" ng-controller="MainController as ctrl">
<body class="{{ctrl.theme}} font-family-{{ctrl.fontFamily}} font-size-{{ctrl.fontSize}}">

<header>
<div class="rtail-logo"></div>
Expand Down Expand Up @@ -156,17 +156,18 @@ <h4>Theme</h4>
</div>
</script>

<!-- scripts -->
<script src="socket.io/socket.io.js"></script>
<script src="scripts/jquery.js"></script>
<script src="scripts/moment.js"></script>
<script src="scripts/localforage.js"></script>
<script src="scripts/ansi_up.js"></script>
<script src="scripts/angular.js"></script>
<script src="scripts/angular-animate.js"></script>
<script src="scripts/angular-moment.js"></script>
<script src="scripts/angular-localForage.js"></script>
<script src="scripts/angular-rt-popup.js"></script>
<script src="scripts/app.js"></script>
<!-- build:js(app) bundle.min.js -->
<script src="../node_modules/socket.io/node_modules/socket.io-client/socket.io.js"></script>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/moment/moment.js"></script>
<script src="../node_modules/localforage/dist/localforage.js"></script>
<script src="../node_modules/ansi_up/ansi_up.js"></script>
<script src="../node_modules/angular/angular.js"></script>
<script src="../node_modules/angular-animate/angular-animate.js"></script>
<script src="../node_modules/angular-moment/angular-moment.js"></script>
<script src="../node_modules/angular-localforage/dist/angular-localForage.js"></script>
<script src="../node_modules/angular-rt-popup/dist/angular-rt-popup.js"></script>
<script src="app.js"></script>
<!-- endbuild -->
</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions lib/server.js → cli/rtail-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const http = require('http').Server(app)
const io = require('socket.io')(http)
const yargs = require('yargs')
const debug = require('debug')('rtail:server')
const webapp = require('./webapp')
const webapp = require('./lib/webapp')
const updateNotifier = require('update-notifier')
const pkg = require('../package')

Expand Down Expand Up @@ -124,7 +124,10 @@ io.on('connection', function (socket) {
*/

if (!argv.webVersion) {
app.use(serve(__dirname + '/../webapp'))
app.use(serve(__dirname + '/../dist'))
} else if ('development' === argv.webVersion) {
app.use('/app', serve(__dirname + '/../app'))
app.use('/node_modules', serve(__dirname + '/../node_modules'))
} else {
app.use(webapp({
s3: 'http://rtail.s3-website-us-east-1.amazonaws.com/' + argv.webVersion,
Expand Down
File renamed without changes.
Loading

0 comments on commit 45bba8c

Please sign in to comment.