Skip to content

Commit 9e5f328

Browse files
committed
chore(subtree): merge tomchentw/tc-ng-boilerplate@2cdad49
1 parent dfa7413 commit 9e5f328

25 files changed

+138
-121
lines changed

Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
source 'https://rubygems.org'
22

3-
# Specify your gem's dependencies in ng-form-data.gemspec
43
gemspec

Makefile

+4-15
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ releaseBranch := gh-pages
55
developBranch := master
66

77
testDeps := test.karma test.protractor# test.mocha
8-
releaseStatic := true
98
publishDeps := publish.git publish.bower publish.gems# publish.npm
109

1110
tempFolder := $(shell mktemp -d -t $(shell basename "$PWD"))
@@ -19,8 +18,7 @@ newPublishMsg = "chore(publish): v$(version) by Makefile"
1918
.PHONY: client server lib test
2019

2120
install:
22-
mkdir -p tmp
23-
gem query sass --installed || gem install sass
21+
mkdir -p tmp/public
2422
npm install
2523
$(bin)/bower install
2624

@@ -30,11 +28,11 @@ clean.tmp:
3028
clean: clean.tmp
3129
rm -rf node_modules bower_components
3230

33-
server: install
31+
server: clean.tmp install
3432
$(gulp) --gulpfile ./server/gulpfile.ls server
3533

3634
test.karma: install
37-
$(bin)/karma start test/karma.js
35+
./node_modules/karma/bin/karma start test/karma.js
3836
ifdef TRAVIS
3937
find tmp/coverage -name lcov.info -follow -type f -print0 \
4038
| xargs -0 cat | $(bin)/coveralls
@@ -54,23 +52,14 @@ test.protractor: install
5452
test.mocha: install
5553
$(bin)/mocha test/**/*.ls --compilers ls:LiveScript
5654

57-
test: $(testDeps)
55+
test: clean.tmp $(testDeps)
5856

5957
release: clean.tmp install
6058
NODE_ENV=production $(gulp) --gulpfile ./client/gulpfile.ls client
6159

62-
ifeq (true, $(releaseStatic))
6360
cp -r public/* $(tempFolder)
6461
cp -r tmp/public/* $(tempFolder)
6562
git checkout $(releaseBranch)
66-
else
67-
cp -r public $(tempFolder)
68-
cp -r tmp/public/* $(tempFolder)/public
69-
make clean
70-
cp -r . $(tempFolder)
71-
rm -rf $(tempFolder)/client
72-
git checkout $(releaseBranch)
73-
endif
7463

7564
git clean -f -d
7665
git rm -rf .

README.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# ng-form-data
22
> Distributed via
33
4-
[![Version ](https://img.shields.io/gem/v/ng-form-data.svg) ](https://rubygems.org/gems/ng-form-data)
5-
[![Bower version](https://badge.fury.io/bo/ng-form-data.png)](https://badge.fury.io/bo/ng-form-data)
4+
[![Version ](https://img.shields.io/gem/v/ng-form-data.svg) ](https://rubygems.org/gems/ng-form-data)
5+
[![Bower version](https://badge.fury.io/bo/ng-form-data.svg) ](https://badge.fury.io/bo/ng-form-data)
66

77
> Support input[type="file"] with ng-model and transparently submit with HTML5 FormData
88
9-
[![Travis CI ](https://img.shields.io/travis/tomchentw/ng-form-data/master.svg) ](https://travis-ci.org/tomchentw/ng-form-data)
10-
[![Quality ](https://img.shields.io/codeclimate/github/tomchentw/ng-form-data.svg) ](https://codeclimate.com/github/tomchentw/ng-form-data)
11-
[![Coverage ](https://img.shields.io/coveralls/tomchentw/ng-form-data.svg) ](https://coveralls.io/r/tomchentw/ng-form-data)
12-
[![Dependencies](https://img.shields.io/gemnasium/tomchentw/ng-form-data.svg) ](https://gemnasium.com/tomchentw/ng-form-data)
9+
[![Travis CI ](https://travis-ci.org/tomchentw/ng-form-data.svg?branch=master) ](https://travis-ci.org/tomchentw/ng-form-data)
10+
[![Quality ](https://img.shields.io/codeclimate/github/tomchentw/ng-form-data.svg) ](https://codeclimate.com/github/tomchentw/ng-form-data)
11+
[![Coverage ](https://img.shields.io/coveralls/tomchentw/ng-form-data.svg) ](https://coveralls.io/r/tomchentw/ng-form-data)
12+
[![Dependencies](https://gemnasium.com/tomchentw/ng-form-data.svg) ](https://gemnasium.com/tomchentw/ng-form-data)
1313

1414

1515
## Project philosophy
@@ -30,6 +30,7 @@ Then include them through script tag in your HTML.
3030
### **Rails** projects (Only support 3.1+)
3131

3232
Add this line to your application's Gemfile:
33+
3334
```ruby
3435
gem 'ng-form-data'
3536
```
@@ -42,14 +43,14 @@ Then add these lines to the top of your `app/assets/javascripts/application.js`
4243

4344
```javascript
4445
//= require angular
45-
//= require ng-form-data
46+
//= require tc-ng-boilerplate
4647
```
4748

4849
And include in your `angular` module definition:
49-
50-
/* 'tomchentw.boilerplate' module.
51-
*/
52-
var module = angular.module('my-awesome-project', ['tomchentw.boilerplate']).
50+
51+
```javascript
52+
var module = angular.module('my-awesome-project', ['tomchentw.boilerplate']).
53+
```
5354

5455

5556
## Usage

bower.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"private": false,
2222
"ignore": [
2323
"**/.*",
24-
"app",
2524
"bower_components",
2625
"client",
2726
"config",
@@ -45,9 +44,9 @@
4544
"angular": "~1.2.13"
4645
},
4746
"devDependencies": {
48-
"angular-sanitize": "~1.2.13",
4947
"angular-mocks": "~1.2.13",
5048
"angular-bootstrap": "~0.10.0",
49+
"angular-ga": "~0.1.0",
5150
"twbs-bootstrap-sass": "~3.1.1"
5251
}
5352
}

client/gulpfile.ls

+45-34
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
!function exportedTasksDefinedBeginsHere
22
gulp.task 'client' <[ client:html client:css client:js ]> !(done) ->
33
if config.env.is 'production'
4-
gulp.start 'client:html' done
4+
gulp.start 'client:html' .on 'task_stop' !(event) ->
5+
done! if event.task is 'client:html'
56
else
67
livereload.listen config.port.livereload, done
78

@@ -16,28 +17,27 @@ require! {
1617
path
1718
}
1819
require! {
20+
hljs: 'highlight.js'
1921
gulp
22+
'gulp-livescript'
23+
'gulp-uglify'
24+
'gulp-angular-templatecache'
2025
'gulp-jade'
21-
'gulp-ruby-sass'
26+
'gulp-sass'
2227
'gulp-minify-css'
23-
'gulp-angular-templatecache'
24-
'gulp-uglify'
25-
'gulp-livescript'
2628
'gulp-concat'
27-
'gulp-livereload'
2829
'gulp-rev'
2930
}
3031
require! {
31-
hljs: 'highlight.js'
32-
'tiny-lr'
33-
'connect-livereload'
34-
}
35-
require! {
36-
'../lib/gulpfile'
3732
'../config'
33+
'../lib/gulpfile'
3834
}
39-
40-
const livereload = tiny-lr!
35+
unless config.env.is 'production'
36+
require! {
37+
'tiny-lr'
38+
'gulp-livereload'
39+
}
40+
const livereload = tiny-lr!
4141

4242
function identity
4343
it
@@ -57,7 +57,10 @@ function prependTimestampFactory (filepath)
5757
*/
5858
gulp.task 'client:html:partials' ->
5959
return gulp.src 'client/views/partials/*.jade'
60-
.pipe gulp-jade pretty: true
60+
# {doctype: 'html'} https://github.com/visionmedia/jade/issues/1180#issuecomment-40351567
61+
.pipe gulp-jade do
62+
pretty: true
63+
doctype: 'html'
6164
.pipe gulp.dest 'tmp/.html-cache/partials'
6265

6366
gulp.task 'client:js:partials' ->
@@ -66,29 +69,30 @@ gulp.task 'client:js:partials' ->
6669
.pipe gulp.dest 'tmp/.js-cache/partials'
6770

6871
gulp.task 'client:html' <[ client:html:partials client:js:partials ]> ->
69-
return gulp.src 'client/views/*.jade'
72+
stream = gulp.src 'client/views/*.jade'
7073
.pipe gulp-jade do
7174
pretty: !config.env.is 'production'
75+
doctype: 'html'
7276
locals:
7377
highlight: ->
7478
hljs.highlight do
7579
path.extname it .substr 1
7680
fs.readFileSync it, 'utf8'
7781
.value
78-
javascriptIncludeTag: prependTimestampFactory './tmp/js-manifest/rev-manifest.json'
79-
stylesheetLinkTag: prependTimestampFactory './tmp/css-manifest/rev-manifest.json'
82+
javascriptIncludeTag: prependTimestampFactory './tmp/.js-manifest/rev-manifest.json'
83+
stylesheetLinkTag: prependTimestampFactory './tmp/.css-manifest/rev-manifest.json'
8084

8185
.pipe gulp.dest 'tmp/public'
82-
.pipe gulp-livereload(livereload)
86+
stream.=pipe gulp-livereload(livereload) unless config.env.is 'production'
87+
return stream
8388

8489
gulp.task 'client:css:scss' ->
8590
return gulp.src 'client/stylesheets/application.scss'
86-
.pipe gulp-ruby-sass do
87-
loadPath: [
91+
.pipe gulp-sass do
92+
includePaths: [
8893
path.join ...<[ bower_components twbs-bootstrap-sass vendor assets stylesheets ]>
8994
]
90-
cacheLocation: 'tmp/.sass-cache'
91-
style: if config.env.is 'production' then 'compressed' else 'nested'
95+
outputStyle: if config.env.is 'production' then 'compressed' else 'nested'
9296
.pipe gulp.dest 'tmp/.css-cache'
9397

9498
gulp.task 'client:css:bower_components' ->
@@ -101,20 +105,25 @@ gulp.task 'client:css:bower_components' ->
101105
gulp.task 'client:css' <[ client:css:scss client:css:bower_components ]> ->
102106
stream = gulp.src 'tmp/.css-cache/*.css'
103107
.pipe gulp-concat 'application.css'
104-
stream.=pipe gulp-rev! if config.env.is 'production'
108+
if config.env.is 'production'
109+
stream.=pipe gulp-minify-css!
110+
.pipe gulp-rev!
105111
stream.=pipe gulp.dest 'tmp/public'
106-
.pipe gulp-livereload(livereload)
107112
if config.env.is 'production'
108113
stream.=pipe gulp-rev.manifest!
109-
.pipe gulp.dest 'tmp/css-manifest'
114+
.pipe gulp.dest 'tmp/.css-manifest'
115+
else
116+
stream.=pipe gulp-livereload(livereload)
110117
return stream
111118

112119
gulp.task 'client:templates' ->
113120
stream = gulp.src 'client/templates/**/*.jade'
114-
.pipe gulp-jade pretty: !config.env.is 'production'
121+
.pipe gulp-jade do
122+
pretty: !config.env.is 'production'
123+
doctype: 'html'
115124
.pipe gulp-angular-templatecache do
116125
root: '/'
117-
module: 'tc-spa-boilerplate.templates'
126+
module: 'application.templates'
118127
standalone: true
119128
stream.=pipe gulp-uglify! if config.env.is 'production'
120129
return stream.pipe gulp.dest 'tmp/.js-cache'
@@ -130,10 +139,11 @@ gulp.task 'client:js:ls' ->
130139
return stream.pipe gulp.dest 'tmp/.js-cache'
131140

132141
gulp.task 'client:js:bower_components' ->
133-
# stream = gulp.src [
134-
# ]
135-
# stream.=pipe gulp-uglify! if config.env.is 'production'
136-
# return stream.pipe gulp.dest 'tmp/.js-cache'
142+
stream = gulp.src [
143+
'bower_components/angular-ga/ga.js'
144+
]
145+
stream.=pipe gulp-uglify! if config.env.is 'production'
146+
return stream.pipe gulp.dest 'tmp/.js-cache'
137147

138148
gulp.task 'client:js' <[ lib:js client:templates client:js:ls client:js:bower_components ]> ->
139149
stream = gulp.src [
@@ -144,10 +154,11 @@ gulp.task 'client:js' <[ lib:js client:templates client:js:ls client:js:bower_co
144154
.pipe gulp-concat 'application.js'
145155
stream.=pipe gulp-rev! if config.env.is 'production'
146156
stream.=pipe gulp.dest 'tmp/public'
147-
.pipe gulp-livereload(livereload)
148157
if config.env.is 'production'
149158
stream.=pipe gulp-rev.manifest!
150-
.pipe gulp.dest 'tmp/js-manifest'
159+
.pipe gulp.dest 'tmp/.js-manifest'
160+
else
161+
stream.=pipe gulp-livereload(livereload)
151162
return stream
152163
# define!
153164
exportedTasksDefinedBeginsHere!

client/javascripts/application.ls

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const ImgurInterceptor = 'ImgurInterceptor'
22

3-
angular.module 'demo' <[
3+
angular.module 'application' <[
44
ui.bootstrap
5+
ga
56
ng-form-data
67
]>
78
.config <[

client/javascripts/partials/ctrls.ls

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
angular.module 'demo'
1+
angular.module 'application'
22
.controller 'ImgurCtrl' class
33

44
upload: !->
File renamed without changes.

client/stylesheets/application.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$icon-font-path: 'http://netdna.bootstrapcdn.com/bootstrap/3.0.0/fonts/';
22

3-
@import "bootstrap";
3+
@import "bootstrap_override";
44
@import "footer";
55

66
body { padding-top: 70px; }

client/views/index.jade

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
doctype html
2-
html(ng-app="demo")
2+
html(ng-app="application")
33
head
44
meta(charset="utf-8")
5+
meta(http-equiv="X-UA-Compatible" content="IE=edge")
56
base(href="/")
67
title ng-form-data
8+
meta(name="description" content="Seamless Integration of input[type=\"file\"] using HTML5 FormData")
79
meta(name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0")
810
meta(property="og:type" content="website")
911
meta(property="og:url" content="http://ng-form-data.tomchentw.com")
10-
meta(property="og:title" content="AngularJS upload module")
12+
meta(property="og:title" content="ng-form-data")
1113
meta(property="og:description" content="Seamless Integration of input[type=\"file\"] using HTML5 FormData")
14+
15+
<!-- Place favicon.ico and apple-touch-icon(s) in the root directory -->
16+
1217
link(rel="stylesheet" href="//yandex.st/highlightjs/8.0/styles/default.min.css")
1318
link(rel="stylesheet" href=stylesheetLinkTag("application.css"))
14-
script(type="text/javascript" defer src=javascriptIncludeTag("application.js"))
19+
script(type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js")
20+
script(type="text/javascript" src=javascriptIncludeTag("application.js"))
1521
body
1622
include partials/header
1723

client/views/partials/footer.jade

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ footer
22
.container
33
p
44
| Created by
5-
a(href="https://github.com/tomchentw" target="_blank") @tomchentw
5+
a(ga href="https://github.com/tomchentw" target="_blank") @tomchentw
66
| under
7-
a(href="http://tomchentw.mit-license.org" target="_blank") MIT License
7+
a(ga href="http://tomchentw.mit-license.org" target="_blank") MIT License
88
| and built with
9-
a(href="http://tc-ng-boilerplate.tomchentw.com/" target="_blank") tc-ng-boilerplate
9+
a(ga href="http://tc-ng-boilerplate.tomchentw.com/" target="_blank") tc-ng-boilerplate
1010
ul.list-inline
1111
li
1212
| Thanks to

client/views/partials/header.jade

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
header.navbar.navbar-inverse.navbar-fixed-top(role='navigation')
1+
header.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
22
.container
33
.navbar-header
44
button.navbar-toggle(type="button" ng-click="isCollapse = !isCollapse")
55
span.sr-only Toggle navigation
66
span.icon-bar
77
span.icon-bar
88
span.icon-bar
9-
a.navbar-brand(href="https://github.com/tomchentw/ng-form-data" target="_blank") ng-form-data
9+
a.navbar-brand(ga href="https://github.com/tomchentw/ng-form-data" target="_blank") ng-form-data

client/views/partials/imgur.jade

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
form(role="form" name="imageForm" ng-submit="imgur.upload()")
44
.form-group
55
label(for="image_title") Title
6-
input#image_title.form-control(type="text" ng-model="newImg.title")
6+
input#image_title.form-control(ga type="text" ng-model="newImg.title")
77

88
.form-group
99
label(for="image_description") Description
10-
textarea#image_description.form-control(ng-model="newImg.description")
10+
textarea#image_description.form-control(ga ng-model="newImg.description")
1111

1212
.form-group
1313
label(for="image_file") Image File
14-
input#image_file(type="file" ng-model="newImg.image" required)
14+
input#image_file(ga type="file" ng-model="newImg.image" required)
1515

16-
button.btn.btn-default.pull-right(type="submit") Submit
16+
button.btn.btn-default.pull-right(ga type="submit") Submit
1717
.col-xs-12.col-sm-6
1818
.thumbnail
1919
img(ng-hide="image" src="http://placekitten.com/320/240")
@@ -22,4 +22,4 @@
2222
h3(ng-bind="image.title")
2323
p(ng-bind="image.description")
2424
p
25-
button.btn.btn-primary(ng-click="imgur.delete()") Delete Image
25+
button.btn.btn-primary(ga ng-click="imgur.delete()") Delete Image

0 commit comments

Comments
 (0)