appmake 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -28,3 +28,7 @@ Run `bundle exec appmake init` to bootstrap app directory structure. Next issue
28
28
  3. Commit your changes (`git commit -am 'Add some feature'`)
29
29
  4. Push to the branch (`git push origin my-new-feature`)
30
30
  5. Create new Pull Request
31
+
32
+ ## Authors
33
+
34
+ **appmake** is being developed by Sebastian Sito and Sławomir Kołodziej
data/appmake.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'appmake/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "appmake"
8
8
  gem.version = Appmake::VERSION
9
- gem.authors = ["Sebastian Sito"]
9
+ gem.authors = ["Sebastian Sito", "Sławomir Kołodziej"]
10
10
  gem.email = ["sebastian@hypenode.com"]
11
11
  gem.description = %q{Appmake allows you to easily develop single-page apps in HTML5}
12
12
  gem.summary = %q{Appmake app bootstrapper}
data/bin/appmake CHANGED
File without changes
@@ -17,7 +17,7 @@ module Appmake
17
17
 
18
18
  def self.compile
19
19
  Basic.new.say_status :compile, "JS"
20
- system("webmake js/app.js public/app.js")
20
+ system("npm run-script build")
21
21
  end
22
22
  end
23
23
  end
@@ -16,8 +16,8 @@ module Appmake
16
16
  end
17
17
 
18
18
  def self.compile
19
- Basic.new.say_status :compile, "CSS"
20
- system("node bin/compile_templates.js &> /dev/null")
19
+ Basic.new.say_status :compile, "TPL"
20
+ system("npm run-script tpl")
21
21
  end
22
22
  end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Appmake
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/appmake.rb CHANGED
@@ -14,16 +14,16 @@ module Appmake
14
14
 
15
15
  desc "init", "initialize new application"
16
16
  def init
17
- empty_directory "bin"
18
- template"templates/bin/compile_templates.js.tt", "bin/compile_templates.js"
17
+ template "templates/package.json.tt", "package.json"
18
+ template "templates/README.md.tt", "README.md"
19
+ system "npm install"
19
20
 
20
21
  empty_directory "css"
21
- template"templates/css/app.scss.tt", "css/app.scss"
22
- template"templates/css/body.scss.tt", "css/body.scss"
22
+ template "templates/css/app.scss.tt", "css/app.scss"
23
+ template "templates/css/body.scss.tt", "css/body.scss"
23
24
 
24
25
  empty_directory "js"
25
- template"templates/js/lib/doT.js.tt", "js/lib/doT.js"
26
- template"templates/js/app.js.tt", "js/app.js"
26
+ template "templates/js/app.js.tt", "js/app.js"
27
27
 
28
28
  empty_directory "tpl"
29
29
  template "templates/tpl/welcome.html.tt", "tpl/welcome.html"
@@ -31,6 +31,7 @@ module Appmake
31
31
  empty_directory "public"
32
32
  template "templates/public/index.html.tt", "public/index.html"
33
33
 
34
+
34
35
  Listeners::Css.compile
35
36
  Listeners::Tpl.compile
36
37
  Listeners::Js.compile
@@ -0,0 +1,3 @@
1
+ # MyApp
2
+
3
+ Build with Appmake [https://github.com/sebastiansito/appmake]()
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "myapp",
3
+ "author": "",
4
+ "version": "0.0.1",
5
+ "preferGlobal": "true",
6
+ "dependencies": {
7
+ "webmake": ">= 0.3.14",
8
+ "dot-module": ">= 0.0.1"
9
+ },
10
+ "scripts": {
11
+ "tpl": "dot-module -d tpl/ -o js/templates.js",
12
+ "build": "webmake js/app.js public/app.js --sourcemap",
13
+ "deploy": "webmake js/app.js public/app.js"
14
+ },
15
+ "engines": { "node": "*" }
16
+ }
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appmake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sebastian Sito
9
+ - Sławomir Kołodziej
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-01-15 00:00:00.000000000 Z
13
+ date: 2013-01-20 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: thor
@@ -95,11 +96,11 @@ files:
95
96
  - lib/appmake/listeners/js.rb
96
97
  - lib/appmake/listeners/tpl.rb
97
98
  - lib/appmake/version.rb
98
- - templates/bin/compile_templates.js.tt
99
+ - templates/README.md.tt
99
100
  - templates/css/app.scss.tt
100
101
  - templates/css/body.scss.tt
101
102
  - templates/js/app.js.tt
102
- - templates/js/lib/doT.js.tt
103
+ - templates/package.json.tt
103
104
  - templates/public/index.html.tt
104
105
  - templates/tpl/welcome.html.tt
105
106
  homepage: https://github.com/sebastiansito/appmake
@@ -1,64 +0,0 @@
1
- var app_dir = __dirname + '/../',
2
- tpl_dir = app_dir + 'tpl/',
3
- js_dir = app_dir + 'js/',
4
-
5
- fs = require('fs'),
6
- dot = require('../js/lib/doT.js'),
7
-
8
- templates = {};
9
-
10
- walk();
11
- fs.writeFile(js_dir + 'templates.js', buildModule(templates));
12
-
13
-
14
- function walk(subdir) {
15
- var dir = tpl_dir,
16
- files;
17
-
18
- if (subdir)
19
- dir += subdir;
20
-
21
- files = fs.readdirSync(dir);
22
- files.forEach(function (filename) {
23
- var stats = fs.statSync(dir + filename);
24
-
25
- if (stats.isDirectory()) {
26
- if (subdir) filename = subdir + filename;
27
- filename += '/';
28
-
29
- walk(filename);
30
- }
31
-
32
- if (!isHTML(filename))
33
- return;
34
-
35
- readFile(filename, subdir, fs.readFileSync(dir + filename));
36
- });
37
- }
38
-
39
- function readFile (filename, dir, data) {
40
- var name = filename.split('.').slice(0, -1).join('.'),
41
- compiled = dot.template(data).toString().replace(/^function anonymous/, 'function ');
42
-
43
- if (dir)
44
- name = dir + name;
45
-
46
- templates[name] = compiled;
47
- }
48
-
49
- function isHTML(name) {
50
- if (!~name.indexOf('.'))
51
- return false;
52
-
53
- return name.split('.').slice(-1)[0].toLowerCase() === 'html';
54
- }
55
-
56
- function buildModule() {
57
- var content = [],
58
- n;
59
-
60
- for (n in templates)
61
- content.push('"' + n + '": ' + templates[n]);
62
-
63
- return ['module.exports = {', content.join(','), '};'].join('').replace(/(\n|\r|\r\n)/, '');
64
- }
@@ -1,135 +0,0 @@
1
- // doT.js
2
- // 2011, Laura Doktorova, https://github.com/olado/doT
3
- // Licensed under the MIT license.
4
-
5
- (function() {
6
- "use strict";
7
-
8
- var doT = {
9
- version: '1.0.0',
10
- templateSettings: {
11
- evaluate: /\{\{([\s\S]+?\}?)\}\}/g,
12
- interpolate: /\{\{=([\s\S]+?)\}\}/g,
13
- encode: /\{\{!([\s\S]+?)\}\}/g,
14
- use: /\{\{#([\s\S]+?)\}\}/g,
15
- useParams: /(^|[^\w$])def(?:\.|\[[\'\"])([\w$\.]+)(?:[\'\"]\])?\s*\:\s*([\w$\.]+|\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})/g,
16
- define: /\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,
17
- defineParams:/^\s*([\w$]+):([\s\S]+)/,
18
- conditional: /\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,
19
- iterate: /\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,
20
- varname: 'it',
21
- strip: true,
22
- append: true,
23
- selfcontained: false
24
- },
25
- template: undefined, //fn, compile template
26
- compile: undefined //fn, for express
27
- };
28
-
29
- if (typeof module !== 'undefined' && module.exports) {
30
- module.exports = doT;
31
- } else if (typeof define === 'function' && define.amd) {
32
- define(function(){return doT;});
33
- } else {
34
- (function(){ return this || (0,eval)('this'); }()).doT = doT;
35
- }
36
-
37
- function encodeHTMLSource() {
38
- var encodeHTMLRules = { "&": "&#38;", "<": "&#60;", ">": "&#62;", '"': '&#34;', "'": '&#39;', "/": '&#47;' },
39
- matchHTML = /&(?!#?\w+;)|<|>|"|'|\//g;
40
- return function() {
41
- return this ? this.replace(matchHTML, function(m) {return encodeHTMLRules[m] || m;}) : this;
42
- };
43
- }
44
- String.prototype.encodeHTML = encodeHTMLSource();
45
-
46
- var startend = {
47
- append: { start: "'+(", end: ")+'", endencode: "||'').toString().encodeHTML()+'" },
48
- split: { start: "';out+=(", end: ");out+='", endencode: "||'').toString().encodeHTML();out+='"}
49
- }, skip = /$^/;
50
-
51
- function resolveDefs(c, block, def) {
52
- return ((typeof block === 'string') ? block : block.toString())
53
- .replace(c.define || skip, function(m, code, assign, value) {
54
- if (code.indexOf('def.') === 0) {
55
- code = code.substring(4);
56
- }
57
- if (!(code in def)) {
58
- if (assign === ':') {
59
- if (c.defineParams) value.replace(c.defineParams, function(m, param, v) {
60
- def[code] = {arg: param, text: v};
61
- });
62
- if (!(code in def)) def[code]= value;
63
- } else {
64
- new Function("def", "def['"+code+"']=" + value)(def);
65
- }
66
- }
67
- return '';
68
- })
69
- .replace(c.use || skip, function(m, code) {
70
- if (c.useParams) code = code.replace(c.useParams, function(m, s, d, param) {
71
- if (def[d] && def[d].arg && param) {
72
- var rw = (d+":"+param).replace(/'|\\/g, '_');
73
- def.__exp = def.__exp || {};
74
- def.__exp[rw] = def[d].text.replace(new RegExp("(^|[^\\w$])" + def[d].arg + "([^\\w$])", "g"), "$1" + param + "$2");
75
- return s + "def.__exp['"+rw+"']";
76
- }
77
- });
78
- var v = new Function("def", "return " + code)(def);
79
- return v ? resolveDefs(c, v, def) : v;
80
- });
81
- }
82
-
83
- function unescape(code) {
84
- return code.replace(/\\('|\\)/g, "$1").replace(/[\r\t\n]/g, ' ');
85
- }
86
-
87
- doT.template = function(tmpl, c, def) {
88
- c = c || doT.templateSettings;
89
- var cse = c.append ? startend.append : startend.split, needhtmlencode, sid = 0, indv,
90
- str = (c.use || c.define) ? resolveDefs(c, tmpl, def || {}) : tmpl;
91
-
92
- str = ("var out='" + (c.strip ? str.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g,' ')
93
- .replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,''): str)
94
- .replace(/'|\\/g, '\\$&')
95
- .replace(c.interpolate || skip, function(m, code) {
96
- return cse.start + unescape(code) + cse.end;
97
- })
98
- .replace(c.encode || skip, function(m, code) {
99
- needhtmlencode = true;
100
- return cse.start + unescape(code) + cse.endencode;
101
- })
102
- .replace(c.conditional || skip, function(m, elsecase, code) {
103
- return elsecase ?
104
- (code ? "';}else if(" + unescape(code) + "){out+='" : "';}else{out+='") :
105
- (code ? "';if(" + unescape(code) + "){out+='" : "';}out+='");
106
- })
107
- .replace(c.iterate || skip, function(m, iterate, vname, iname) {
108
- if (!iterate) return "';} } out+='";
109
- sid+=1; indv=iname || "i"+sid; iterate=unescape(iterate);
110
- return "';var arr"+sid+"="+iterate+";if(arr"+sid+"){var "+vname+","+indv+"=-1,l"+sid+"=arr"+sid+".length-1;while("+indv+"<l"+sid+"){"
111
- +vname+"=arr"+sid+"["+indv+"+=1];out+='";
112
- })
113
- .replace(c.evaluate || skip, function(m, code) {
114
- return "';" + unescape(code) + "out+='";
115
- })
116
- + "';return out;")
117
- .replace(/\n/g, '\\n').replace(/\t/g, '\\t').replace(/\r/g, '\\r')
118
- .replace(/(\s|;|\}|^|\{)out\+='';/g, '$1').replace(/\+''/g, '')
119
- .replace(/(\s|;|\}|^|\{)out\+=''\+/g,'$1out+=');
120
-
121
- if (needhtmlencode && c.selfcontained) {
122
- str = "String.prototype.encodeHTML=(" + encodeHTMLSource.toString() + "());" + str;
123
- }
124
- try {
125
- return new Function(c.varname, str);
126
- } catch (e) {
127
- if (typeof console !== 'undefined') console.log("Could not create a template function: " + str);
128
- throw e;
129
- }
130
- };
131
-
132
- doT.compile = function(tmpl, def) {
133
- return doT.template(tmpl, null, def);
134
- };
135
- }());