Skip to content

Commit

Permalink
tag as v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Rokt33r committed Jun 19, 2015
1 parent 4094fff commit 9e53bec
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/node_modules
/electron_build
.env
dist/
63 changes: 48 additions & 15 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,56 @@ var ngAnnotate = require('gulp-ng-annotate')
var uglify = require('gulp-uglify')
var minifyCss = require('gulp-minify-css')
var merge = require('merge-stream')
var concat = require('gulp-concat')
var streamqueue = require('streamqueue')
var minifyHtml = require('gulp-minify-html')

var config = require('./build.config.js')

gulp.task('env', function () {
return gulp.src('tpls/env.js')
.pipe(template({
apiUrl: env.BUILD_API_URL
}))
.pipe(gulp.dest('build/config'))
gulp.task('js', function () {
return streamqueue({objectMode: true},
gulp.src('tpls/env.js')
.pipe(template({
apiUrl: env.BUILD_API_URL
})),
gulp.src(['src/**/*.js'])
)
.pipe(changed('build'))
.pipe(gulp.dest('build'))
})

gulp.task('js', function () {
return gulp.src(['src/**/*.js'])
.pipe(changed('build'))
.pipe(gulp.dest('build'))
gulp.task('dist', function () {
var js = streamqueue({objectMode: true},
gulp.src(['src/**/*.js']),
gulp.src('tpls/env.js')
.pipe(template({
apiUrl: env.DIST_API_URL
})),
gulp.src('src/**/*.tpl.html')
.pipe(templateCache())
)
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(concat('app.js'))
.pipe(gulp.dest('dist'))

var css = gulp.src('src/styles/main.styl')
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(styl())
.pipe(autoprefixer())
.pipe(minifyCss())
.pipe(gulp.dest('dist'))

var index = gulp.src('src/index.html')
.pipe(template({
scripts: ['app.js'],
styles: ['main.css'],
env: 'dist'
}))
.pipe(minifyHtml())
.pipe(gulp.dest('dist'))

return merge(js, css, index)
})

gulp.task('styl', function () {
Expand Down Expand Up @@ -72,7 +107,7 @@ gulp.task('index', function () {
.pipe(template({
scripts: scripts,
styles: styles,
env: env
env: 'build'
}))
.pipe(gulp.dest('build'))
.pipe(livereload())
Expand Down Expand Up @@ -100,13 +135,11 @@ gulp.task('resources', function () {
})

gulp.task('build', function (cb) {
runSequence(['env', 'js', 'styl', 'tpls', 'vendor', 'resources'], 'index', cb)
runSequence(['js', 'styl', 'tpls', 'vendor', 'resources'], 'index', cb)
})

gulp.task('watch', function (cb) {
gulp.watch(['.env', 'tpls/env.js'], ['env'])

gulp.watch('src/**/*.js', ['js'])
gulp.watch(['.env', 'tpls/env.js', 'src/**/*.js'], ['js'])

gulp.watch('src/styles/**/*.styl', ['styl'])

Expand Down
2 changes: 1 addition & 1 deletion electron_src/popup/services/snippet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global angular */
angular.module('codexen.popup')
.constant('apiUrl', 'http://localhost:8000/')
.constant('apiUrl', 'http://codexen-server-dev.elasticbeanstalk.com/')
.config(function ($authProvider, $httpProvider, apiUrl) {
$authProvider.baseUrl = apiUrl

Expand Down
4 changes: 2 additions & 2 deletions gulp-electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function (gulp) {
gulp.task('elec-env', function () {
return gulp.src('tpls/env.js')
.pipe(template({
apiUrl: env.BUILD_API_URL
apiUrl: env.ELEC_API_URL
}))
.pipe(gulp.dest('electron_build/config'))
})
Expand Down Expand Up @@ -78,7 +78,7 @@ module.exports = function (gulp) {
.pipe(template({
scripts: scripts,
styles: styles,
env: env
env: 'build'
}))
.pipe(gulp.dest('electron_build'))
.pipe(livereload())
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,9 @@
"satellizer": "^0.10.1",
"ui-select": "^0.11.2"
},
"devDependencies": {}
"devDependencies": {
"gulp-concat": "^2.5.2",
"gulp-minify-html": "^1.0.3",
"streamqueue": "^1.1.0"
}
}
12 changes: 11 additions & 1 deletion src/controllers/states/SnippetsListController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global angular */
angular.module('codexen')
.controller('SnippetsListController', function ($auth, Snippet, $scope, $state, $scope, $filter, mySnippets) {
.controller('SnippetsListController', function ($auth, Snippet, $scope, $state, $scope, $filter, mySnippets, User) {
var vm = this

vm.isLoading = false
Expand All @@ -12,6 +12,16 @@ angular.module('codexen')
vm.searchSnippets = searchSnippets
vm.searchSnippets()

vm.isAuthenticated = $auth.isAuthenticated()
var reloadUser = function () {
if (vm.isAuthenticated) {
User.me().success(function (data) {
vm.currentUser = data
})
}
}
reloadUser()

// TODO: add Navigation methods
// vm.nextSnippet()
// vm.priorSnippet()
Expand Down
44 changes: 34 additions & 10 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@
<meta name="description" content="CodeXen - Short code storage service">

<title>Codexen!</title>
<link rel="stylesheet" href="vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">


<% if(env === 'dist') { %>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<% } %>

<% if(env === 'build') { %>
<link rel="stylesheet" href="vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
<% } %>

<% styles.forEach(function(style){ %>
<link rel="stylesheet" href="<%=style %>" media="screen" title="no title" charset="utf-8">
<% }) %>
Expand All @@ -22,15 +31,30 @@
<div side-nav id="side-view"></div>
<div ui-view name="main-view" id="main-view"></div>

<script src="vendor/ace.js"></script>
<script src="vendor/angular.js"></script>
<script src="vendor/angular-sanitize.js"></script>
<script src="vendor/angular-ui-router.js"></script>
<script src="vendor/ui-bootstrap-tpls.js"></script>
<script src="vendor/select.js"></script>
<script src="vendor/satellizer.js"></script>
<script src="vendor/angular-md5.js"></script>
<script src="vendor/moment.js"></script>
<% if(env === 'dist') { %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/ace.js" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-sanitize.min.js" charset="utf-8"></script>
<script src="https://cdn.rawgit.com/angular-ui/ui-router/0.2.15/release/angular-ui-router.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.0/ui-bootstrap-tpls.min.js" charset="utf-8"></script>
<script src="https://cdn.rawgit.com/angular-ui/ui-select/v0.12.0/dist/select.min.js" charset="utf-8"></script>
<script src="https://cdn.jsdelivr.net/satellizer/0.11.2/satellizer.min.js"></script>
<script src="https://cdn.rawgit.com/gdi2290/angular-md5/v0.1.7/angular-md5.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js" charset="utf-8"></script>
<% } %>

<% if(env === 'build') { %>
<script src="vendor/ace.js"></script>
<script src="vendor/angular.js"></script>
<script src="vendor/angular-sanitize.js"></script>
<script src="vendor/angular-ui-router.js"></script>
<script src="vendor/ui-bootstrap-tpls.js"></script>
<script src="vendor/select.js"></script>
<script src="vendor/satellizer.js"></script>
<script src="vendor/angular-md5.js"></script>
<script src="vendor/moment.js"></script>
<% } %>


<% scripts.forEach(function(script){ %>
<script src="<%=script %>"></script>
Expand Down
4 changes: 2 additions & 2 deletions src/styles/_bootstrap.styl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
@import '../../node_modules/bootstrap-styl/bootstrap/navs'
@import '../../node_modules/bootstrap-styl/bootstrap/navbar'
// @import '../../node_modules/bootstrap-styl/bootstrap/breadcrumbs'
@import '../../node_modules/bootstrap-styl/bootstrap/pagination'
@import '../../node_modules/bootstrap-styl/bootstrap/pager'
// @import '../../node_modules/bootstrap-styl/bootstrap/pagination'
// @import '../../node_modules/bootstrap-styl/bootstrap/pager'
@import '../../node_modules/bootstrap-styl/bootstrap/labels'
@import '../../node_modules/bootstrap-styl/bootstrap/badges'
@import '../../node_modules/bootstrap-styl/bootstrap/jumbotron'
Expand Down
3 changes: 0 additions & 3 deletions src/tpls/states/home.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
<h1 class="jumbotron">Codexen App <small>v0.1</small></h1>
<p>
App for Code snippets<br>

App: <a href="https://github.com/Rokt33r/codexen-app">Rokt33r/codexen-app</a><br>
Server: <a href="https://github.com/Rokt33r/codexen-server">Rokt33r/codexen-server</a>
</p>

<p>
Expand Down
2 changes: 1 addition & 1 deletion src/tpls/states/snippets.list.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h4>
<li snippet-item="snippet" ng-repeat="snippet in vm.filtered" ui-sref="snippets.detail({id:snippet.id})" ng-class="{active:vm.snippetId===snippet.id}">
<div class="media">
<div class="media-left">
<img width="25" height="25" class="img-circle" src="http://www.gravatar.com/avatar/ea0b6ad1c11700120d1af08810caa19d" alt="" />
<img width="25" height="25" class="img-circle" ng-src="http://www.gravatar.com/avatar/{{ vm.currentUser.email | gravatar }}" alt="" />
</div>
<div class="media-body">
<p ng-bind="snippet.callSign" class="call-sign">
Expand Down

0 comments on commit 9e53bec

Please sign in to comment.