linner-hc 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CHANGELOG +129 -0
- data/Gemfile +14 -0
- data/LICENSE +22 -0
- data/README.md +74 -0
- data/Rakefile +8 -0
- data/bin/linner +11 -0
- data/docs/commands.md +29 -0
- data/docs/config.md +192 -0
- data/lib/linner.rb +261 -0
- data/lib/linner/archive.rb +53 -0
- data/lib/linner/asset.rb +102 -0
- data/lib/linner/bundler.rb +85 -0
- data/lib/linner/cache.rb +19 -0
- data/lib/linner/command.rb +133 -0
- data/lib/linner/compressor.rb +17 -0
- data/lib/linner/environment.rb +76 -0
- data/lib/linner/helper.rb +39 -0
- data/lib/linner/notifier.rb +24 -0
- data/lib/linner/reactor.rb +87 -0
- data/lib/linner/sprite.rb +127 -0
- data/lib/linner/template.rb +77 -0
- data/lib/linner/templates/app/images/.gitkeep +0 -0
- data/lib/linner/templates/app/images/logo.png +0 -0
- data/lib/linner/templates/app/scripts/app.coffee +3 -0
- data/lib/linner/templates/app/styles/app.scss +1 -0
- data/lib/linner/templates/app/templates/welcome.hbs +1 -0
- data/lib/linner/templates/app/views/index.html +21 -0
- data/lib/linner/templates/bin/server +3 -0
- data/lib/linner/templates/config.yml +54 -0
- data/lib/linner/templates/public/.gitkeep +1 -0
- data/lib/linner/templates/test/.gitkeep +0 -0
- data/lib/linner/templates/vendor/.gitkeep +1 -0
- data/lib/linner/version.rb +3 -0
- data/lib/linner/wrapper.rb +39 -0
- data/linner.gemspec +35 -0
- data/linner.gemspec.bak +34 -0
- data/spec/fixtures/app.js +1 -0
- data/spec/fixtures/config.yml +30 -0
- data/spec/linner/asset_spec.rb +33 -0
- data/spec/linner/bundler_spec.rb +26 -0
- data/spec/linner/environment_spec.rb +22 -0
- data/spec/linner/helper_spec.rb +26 -0
- data/spec/linner/sprites_spec.rb +23 -0
- data/spec/linner/template_spec.rb +16 -0
- data/spec/linner/wrapper_spec.rb +20 -0
- data/spec/spec_helper.rb +11 -0
- data/vendor/config.default.yml +13 -0
- data/vendor/livereload.js +1055 -0
- data/vendor/require_definition.js +60 -0
- metadata +289 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
require "tilt"
|
2
|
+
require "sass"
|
3
|
+
require "compass/core"
|
4
|
+
require "handlebars.rb"
|
5
|
+
require "coffee_script"
|
6
|
+
require "babel/transpiler"
|
7
|
+
|
8
|
+
module Tilt
|
9
|
+
class YAMLTemplate < PlainTemplate
|
10
|
+
self.default_mime_type = "text/x-yaml"
|
11
|
+
end
|
12
|
+
|
13
|
+
class JavascriptTemplate < PlainTemplate
|
14
|
+
self.default_mime_type = "application/javascript"
|
15
|
+
end
|
16
|
+
|
17
|
+
class BabelTemplate < PlainTemplate
|
18
|
+
self.default_mime_type = "application/javascript"
|
19
|
+
|
20
|
+
def prepare; end
|
21
|
+
|
22
|
+
def evaluate(scope, locals, &block)
|
23
|
+
@output ||= Babel::Transpiler.transform(data, compact: false)["code"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class CSSTemplate < PlainTemplate
|
28
|
+
self.default_mime_type = "text/css"
|
29
|
+
end
|
30
|
+
|
31
|
+
class CompassSassTemplate < SassTemplate
|
32
|
+
self.default_mime_type = "text/css"
|
33
|
+
|
34
|
+
private
|
35
|
+
def sass_options
|
36
|
+
super.merge(
|
37
|
+
style: :expanded,
|
38
|
+
line_numbers: true,
|
39
|
+
load_paths: Linner.env.paths << Compass::Core.base_directory("stylesheets")
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class CompassScssTemplate < CompassSassTemplate
|
45
|
+
self.default_mime_type = "text/css"
|
46
|
+
|
47
|
+
private
|
48
|
+
def sass_options
|
49
|
+
super.merge(:syntax => :scss)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class HandlebarsTemplate < Template
|
54
|
+
self.default_mime_type = "text/template"
|
55
|
+
|
56
|
+
def prepare; end
|
57
|
+
|
58
|
+
def evaluate(scope, locals, &block)
|
59
|
+
@output ||= Handlebars.precompile(data)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
ERBTemplate.default_mime_type = "application/x-eruby"
|
64
|
+
|
65
|
+
register PlainTemplate, "txt"
|
66
|
+
register CSSTemplate, "css"
|
67
|
+
register JavascriptTemplate, "js"
|
68
|
+
register YAMLTemplate, "yml", "yaml"
|
69
|
+
register BabelTemplate, "es6", "es", "jsx"
|
70
|
+
register HandlebarsTemplate, "hbs", "handlebars"
|
71
|
+
|
72
|
+
register CompassSassTemplate, "sass"
|
73
|
+
prefer CompassSassTemplate
|
74
|
+
|
75
|
+
register CompassScssTemplate, "scss"
|
76
|
+
prefer CompassScssTemplate
|
77
|
+
end
|
File without changes
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "icons";
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>Hello world! This is Linner Boilerplate.</p>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<title>Linner boilerplate</title>
|
7
|
+
<meta name="description" content="">
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="/styles/app.css">
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<!--[if lt IE 7]>
|
14
|
+
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
|
15
|
+
<![endif]-->
|
16
|
+
<div class="icon-logo"></div>
|
17
|
+
<script src="/scripts/vendor.js"></script>
|
18
|
+
<script src="/scripts/app.js"></script>
|
19
|
+
<script>require("app")()</script>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
paths:
|
2
|
+
public: "public"
|
3
|
+
groups:
|
4
|
+
scripts:
|
5
|
+
paths:
|
6
|
+
- app/scripts
|
7
|
+
concat:
|
8
|
+
"/scripts/app.js": "app/**/*.{js,coffee}"
|
9
|
+
"/scripts/vendor.js": "vendor/**/*.{js,coffee}"
|
10
|
+
order:
|
11
|
+
- vendor/jquery.js
|
12
|
+
- ...
|
13
|
+
- app/scripts/app.coffee
|
14
|
+
styles:
|
15
|
+
paths:
|
16
|
+
- app/styles
|
17
|
+
concat:
|
18
|
+
"/styles/app.css": "app/styles/**/[a-z]*.{css,scss,sass}"
|
19
|
+
images:
|
20
|
+
paths:
|
21
|
+
- app/images
|
22
|
+
sprite:
|
23
|
+
"../app/images/icons.scss": "app/images/**/*.png"
|
24
|
+
views:
|
25
|
+
paths:
|
26
|
+
- app/views
|
27
|
+
copy:
|
28
|
+
"/": "app/views/**/*.html"
|
29
|
+
templates:
|
30
|
+
paths:
|
31
|
+
- app/templates
|
32
|
+
precompile:
|
33
|
+
"../vendor/templates.js": "app/templates/**/*.hbs"
|
34
|
+
modules:
|
35
|
+
wrapper: cmd
|
36
|
+
ignored: vendor/**/*
|
37
|
+
definition: /scripts/app.js
|
38
|
+
sprites:
|
39
|
+
path: /images/
|
40
|
+
selector: .icon-
|
41
|
+
notification: true
|
42
|
+
bundles:
|
43
|
+
jquery.js:
|
44
|
+
version: 1.10.2
|
45
|
+
url: http://code.jquery.com/jquery-1.10.2.js
|
46
|
+
handlebars.js:
|
47
|
+
version: 1.0.0
|
48
|
+
url: https://raw.github.com/wycats/handlebars.js/1.0.0/dist/handlebars.runtime.js
|
49
|
+
environments:
|
50
|
+
production:
|
51
|
+
revision:
|
52
|
+
manifest: "manifest.yml"
|
53
|
+
files:
|
54
|
+
- index.html
|
@@ -0,0 +1 @@
|
|
1
|
+
.gitkeep
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
.gitkeep
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Linner
|
2
|
+
module Wrapper
|
3
|
+
class Module
|
4
|
+
def self.wrap(name, content)
|
5
|
+
<<-WRAPPER
|
6
|
+
this.require.define({"#{name}":function(exports, require, module){#{content};}});
|
7
|
+
WRAPPER
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.definition
|
11
|
+
File.read(File.join File.dirname(__FILE__), "../../vendor", "require_definition.js")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Template
|
16
|
+
def self.wrap(name, content)
|
17
|
+
<<-WRAPPER
|
18
|
+
templates["#{name}"] = template(#{content});
|
19
|
+
WRAPPER
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.partial_wrap(name, content)
|
23
|
+
<<-PARTIAL
|
24
|
+
Handlebars.registerPartial("#{name}", Handlebars.template(#{content}));
|
25
|
+
PARTIAL
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
def self.definition(content)
|
30
|
+
<<-DEFINITION
|
31
|
+
(function() {
|
32
|
+
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
33
|
+
#{content}
|
34
|
+
})();
|
35
|
+
DEFINITION
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/linner.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "linner/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "linner-hc"
|
8
|
+
spec.version = Linner::VERSION
|
9
|
+
spec.authors = ["znb"]
|
10
|
+
spec.email = ["zhunb319@gmail.com"]
|
11
|
+
spec.description = %q{HTML5 Application Assembler}
|
12
|
+
spec.summary = %q{HTML5 Application Assembler}
|
13
|
+
spec.homepage = "https://github.com/zhunb319/linner-hc"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
|
22
|
+
spec.add_dependency "thor", "~> 0.18"
|
23
|
+
spec.add_dependency "tilt", "~> 2.0.1"
|
24
|
+
spec.add_dependency "reel", "~> 0.5.0"
|
25
|
+
spec.add_dependency "http", "~> 0.7.2"
|
26
|
+
spec.add_dependency "listen", "~> 1.3"
|
27
|
+
spec.add_dependency "uglifier", "~> 2.5.0"
|
28
|
+
spec.add_dependency "cssminify", "~> 1.0.2"
|
29
|
+
spec.add_dependency "chunky_png", "~> 1.3.1"
|
30
|
+
spec.add_dependency "compass-core", "~> 1.0.1"
|
31
|
+
spec.add_dependency "coffee-script", "~> 2.3.0"
|
32
|
+
spec.add_dependency "handlebars.rb", "~> 0.1.2"
|
33
|
+
spec.add_dependency "babel-transpiler", "~> 0.7"
|
34
|
+
spec.add_dependency "terminal-notifier", "~> 1.5"
|
35
|
+
end
|
data/linner.gemspec.bak
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "linner/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "linner-hc"
|
8
|
+
spec.version = Linner::VERSION
|
9
|
+
spec.authors = ["znb"]
|
10
|
+
spec.email = ["zhunb319@gmail.com"]
|
11
|
+
spec.description = %q{HTML5 Application Assembler}
|
12
|
+
spec.summary = %q{HTML5 Application Assembler}
|
13
|
+
spec.homepage = "https://github.com/zhunb319/linner-hc"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "thor", "~> 0.18"
|
22
|
+
spec.add_dependency "tilt", "~> 2.0.1"
|
23
|
+
spec.add_dependency "reel", "~> 0.5.0"
|
24
|
+
spec.add_dependency "http", "~> 0.7.2"
|
25
|
+
spec.add_dependency "listen", "~> 1.3"
|
26
|
+
spec.add_dependency "uglifier", "~> 2.5.0"
|
27
|
+
spec.add_dependency "cssminify", "~> 1.0.2"
|
28
|
+
spec.add_dependency "chunky_png", "~> 1.3.1"
|
29
|
+
spec.add_dependency "compass-core", "~> 1.0.1"
|
30
|
+
spec.add_dependency "coffee-script", "~> 2.3.0"
|
31
|
+
spec.add_dependency "handlebars.rb", "~> 0.1.2"
|
32
|
+
spec.add_dependency "babel-transpiler", "~> 0.7"
|
33
|
+
spec.add_dependency "terminal-notifier", "~> 1.5"
|
34
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log("app.js")
|
@@ -0,0 +1,30 @@
|
|
1
|
+
groups:
|
2
|
+
scripts:
|
3
|
+
paths:
|
4
|
+
- "app/scripts"
|
5
|
+
order:
|
6
|
+
- "vendor/jquery-1.10.2.js"
|
7
|
+
- "..."
|
8
|
+
styles:
|
9
|
+
paths:
|
10
|
+
- "app/styles"
|
11
|
+
images:
|
12
|
+
paths:
|
13
|
+
- "app/images"
|
14
|
+
views:
|
15
|
+
paths:
|
16
|
+
- "app/views"
|
17
|
+
|
18
|
+
bundles:
|
19
|
+
jquery:
|
20
|
+
version: "1.10.2"
|
21
|
+
url: "http://code.jquery.com/jquery-1.10.2.js"
|
22
|
+
underscore:
|
23
|
+
version: "1.5.2"
|
24
|
+
url: https://raw.github.com/jashkenas/underscore/1.5.2/underscore.js
|
25
|
+
backbone:
|
26
|
+
version: "1.1.0"
|
27
|
+
url: "https://raw.github.com/jashkenas/backbone/1.1.0/backbone.js"
|
28
|
+
handlebars:
|
29
|
+
version: "1.0.0"
|
30
|
+
url: "https://raw.github.com/wycats/handlebars.js/1.0.0/dist/handlebars.js"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Asset do
|
4
|
+
def new_asset path
|
5
|
+
Asset.new path
|
6
|
+
end
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@script_asset = new_asset "app/scripts/app.js"
|
10
|
+
@style_asset = new_asset "app/styles/app.css"
|
11
|
+
@dest_asset = new_asset "public/app.js"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return right logical_path" do
|
15
|
+
expect(@script_asset.logical_path).to eq "app.js"
|
16
|
+
expect(@style_asset.logical_path).to eq "app.css"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should return right digest_path" do
|
20
|
+
expect(@dest_asset.digest_path).to eq "public/app-7fa4c57f63cf67c15299ee2c79be22e0.js"
|
21
|
+
expect(@dest_asset.relative_digest_path).to eq "/app-7fa4c57f63cf67c15299ee2c79be22e0.js"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be javascript" do
|
25
|
+
expect(@script_asset.javascript?).to be true
|
26
|
+
expect(@style_asset.stylesheet?).to be true
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should wrapperable" do
|
30
|
+
expect(@script_asset.wrappable?).to be true
|
31
|
+
expect(@style_asset.wrappable?).to be false
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Bundler do
|
4
|
+
before(:each) do
|
5
|
+
env = Environment.new(root.join "config.yml")
|
6
|
+
@bundler = Linner::Bundler.new(env)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should check failure when REPOSITORY is not exist" do
|
10
|
+
clear
|
11
|
+
expect(@bundler.check).to eq [false, "Bundles didn't exsit!"]
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should check failure when jquery is not exist" do
|
15
|
+
FileUtils.mkdir_p File.expand_path("~/.linner/bundles")
|
16
|
+
expect(@bundler.check).to eq [false, "Bundle jquery v1.10.2 didn't match!"]
|
17
|
+
end
|
18
|
+
|
19
|
+
after(:each) do
|
20
|
+
clear
|
21
|
+
end
|
22
|
+
|
23
|
+
def clear
|
24
|
+
FileUtils.rm_rf File.expand_path("~/.linner")
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Environment do
|
4
|
+
before(:each) do
|
5
|
+
@env = Environment.new(root.join "config.yml")
|
6
|
+
@ary = ["app/scripts", "app/styles", "app/images", "app/views"]
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should equals default path folder" do
|
10
|
+
expect(@env.paths).to match @ary
|
11
|
+
expect(@env.app_folder).to eq "app"
|
12
|
+
expect(@env.test_folder).to eq "test"
|
13
|
+
expect(@env.vendor_folder).to eq "vendor"
|
14
|
+
expect(@env.public_folder).to eq "public"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should equals default config" do
|
18
|
+
expect(@env.notification).to be true
|
19
|
+
expect(@env.wrapper).to eq "cmd"
|
20
|
+
expect(@env.groups).to respond_to(:each)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Array do
|
4
|
+
before(:each) do
|
5
|
+
@array = %w[app.js jquery.js bootstrap.css reset.css vendor.js]
|
6
|
+
end
|
7
|
+
|
8
|
+
it "won't change when before and after are empty array" do
|
9
|
+
expect(@array.order_by([])).to eq @array
|
10
|
+
end
|
11
|
+
|
12
|
+
it "will change by before items" do
|
13
|
+
@array.order_by(["jquery.js", "vendor.js"])
|
14
|
+
expect(@array).to eq %w[jquery.js vendor.js app.js bootstrap.css reset.css]
|
15
|
+
end
|
16
|
+
|
17
|
+
it "will change by after items" do
|
18
|
+
@array.order_by(["...", "reset.css", "bootstrap.css"])
|
19
|
+
expect(@array).to eq %w[app.js jquery.js vendor.js reset.css bootstrap.css]
|
20
|
+
end
|
21
|
+
|
22
|
+
it "will change by before and after items" do
|
23
|
+
@array.order_by(["jquery.js", "vendor.js", "...", "reset.css", "bootstrap.css"])
|
24
|
+
expect(@array).to eq %w[jquery.js vendor.js app.js reset.css bootstrap.css]
|
25
|
+
end
|
26
|
+
end
|