linner-hc 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG +129 -0
  6. data/Gemfile +14 -0
  7. data/LICENSE +22 -0
  8. data/README.md +74 -0
  9. data/Rakefile +8 -0
  10. data/bin/linner +11 -0
  11. data/docs/commands.md +29 -0
  12. data/docs/config.md +192 -0
  13. data/lib/linner.rb +261 -0
  14. data/lib/linner/archive.rb +53 -0
  15. data/lib/linner/asset.rb +102 -0
  16. data/lib/linner/bundler.rb +85 -0
  17. data/lib/linner/cache.rb +19 -0
  18. data/lib/linner/command.rb +133 -0
  19. data/lib/linner/compressor.rb +17 -0
  20. data/lib/linner/environment.rb +76 -0
  21. data/lib/linner/helper.rb +39 -0
  22. data/lib/linner/notifier.rb +24 -0
  23. data/lib/linner/reactor.rb +87 -0
  24. data/lib/linner/sprite.rb +127 -0
  25. data/lib/linner/template.rb +77 -0
  26. data/lib/linner/templates/app/images/.gitkeep +0 -0
  27. data/lib/linner/templates/app/images/logo.png +0 -0
  28. data/lib/linner/templates/app/scripts/app.coffee +3 -0
  29. data/lib/linner/templates/app/styles/app.scss +1 -0
  30. data/lib/linner/templates/app/templates/welcome.hbs +1 -0
  31. data/lib/linner/templates/app/views/index.html +21 -0
  32. data/lib/linner/templates/bin/server +3 -0
  33. data/lib/linner/templates/config.yml +54 -0
  34. data/lib/linner/templates/public/.gitkeep +1 -0
  35. data/lib/linner/templates/test/.gitkeep +0 -0
  36. data/lib/linner/templates/vendor/.gitkeep +1 -0
  37. data/lib/linner/version.rb +3 -0
  38. data/lib/linner/wrapper.rb +39 -0
  39. data/linner.gemspec +35 -0
  40. data/linner.gemspec.bak +34 -0
  41. data/spec/fixtures/app.js +1 -0
  42. data/spec/fixtures/config.yml +30 -0
  43. data/spec/linner/asset_spec.rb +33 -0
  44. data/spec/linner/bundler_spec.rb +26 -0
  45. data/spec/linner/environment_spec.rb +22 -0
  46. data/spec/linner/helper_spec.rb +26 -0
  47. data/spec/linner/sprites_spec.rb +23 -0
  48. data/spec/linner/template_spec.rb +16 -0
  49. data/spec/linner/wrapper_spec.rb +20 -0
  50. data/spec/spec_helper.rb +11 -0
  51. data/vendor/config.default.yml +13 -0
  52. data/vendor/livereload.js +1055 -0
  53. data/vendor/require_definition.js +60 -0
  54. metadata +289 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 384e3cd98fa686c846ada7147303cf9018a58d11
4
+ data.tar.gz: 0047e7c8a86c3c7a562413d7c46fc58d5a8d9e3e
5
+ SHA512:
6
+ metadata.gz: 637d2f731536872a2dd9233b49938332ca202fc5d3b62b2901ea8293b60d3dc6e5593390e1403e5edda81c215fdcc73b3c1313e01eed463864cc88fbabeeb8a1
7
+ data.tar.gz: ca4d4ef325d82fab42452de04a9cf1396563786bbf8b909eee0fb379154bef5275512b07788a60e46d8cfb41cbf96d63f29fa69057955f8d0f4140eef9d29b2f
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .DS_Store
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ .sass-cache
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
@@ -0,0 +1,129 @@
1
+ v0.11.1
2
+ - bump babel version to v0.7
3
+ - return non-zero code when build failed
4
+
5
+ v0.11.0
6
+ - supports `es6` and react `jsx` by babel
7
+
8
+ v0.10.0
9
+ - introducing new directive `compile` and `context` to compile files
10
+
11
+ v0.9.1
12
+ - add .yml .yaml and .txt to Tilt templates
13
+
14
+ v0.9.0
15
+ - introducing environment for different environments
16
+
17
+ v0.8.7
18
+ - support CDN in revision plugin
19
+
20
+ v0.8.6
21
+ - always use binary mode on windows
22
+
23
+ v0.8.5
24
+ - fix a windows mime-type bug
25
+
26
+ v0.8.4
27
+ - fix the vendor path for bundles
28
+ - fix the sprite url config, now it's working again
29
+
30
+ v0.8.3
31
+ - fix a windows md5sum bug cause it calculate in text mode by default
32
+
33
+ v0.8.2
34
+ - fix a gzip mime-type bug in linux
35
+
36
+ v0.8.1
37
+ - `tar` now sub prefix with envrionment paths
38
+
39
+ v0.8.0
40
+ - updated all deps
41
+ - use rspec3 to replace the old test code
42
+ - bundles now support tar.gz file
43
+ - add a new directive `tar` to produce tar file
44
+ - remove the old default config entity `paths`, should always have `paths` in groups
45
+
46
+ v0.7.3
47
+ - fix a merge bug from the latest version
48
+
49
+ v0.7.2
50
+ - add a unstrict mode by default to replace the revision, change the original one to strict mode, use `-s` to trigger.
51
+
52
+ v0.7.1
53
+ - prevent multiple instance running error
54
+
55
+ v0.7.0
56
+ - lock the sass version to 3.2.19, cause compass not works perfectly with it
57
+ - remove Hpricot, use plain regex to support revision
58
+ - `revision` now is a hash, support `prefix`, move the `manifest` into `revision`, revision now has a `files` key
59
+
60
+ v0.6.7
61
+ - bypass a windows platform expand_path bug in ruby v2.0.0
62
+
63
+ v0.6.6
64
+ - lock the gem http to v0.5.0 and reel to 0.4.0
65
+
66
+ v0.6.5
67
+ - upgrade uglifier to 2.5.0 cause uglifier 2.2.0 has IE 8 compatibility issues
68
+ - upgrade handlebars.rb to 0.1.2 cause handlebars version updated to 1.3.0
69
+
70
+ v0.6.4
71
+ - copy task now support render and compress
72
+ - fix cache problem when same asset in different linner task
73
+
74
+ v0.6.3
75
+ - support sprite revision
76
+
77
+ v0.6.2
78
+ - fix bin-packing algo problem
79
+ - add auto reload environment support
80
+ - add native path bundle support
81
+
82
+ v0.6.1
83
+ - use `hpricot` to instead of `nokogiri`, because `nokogiri` has parse problem when `revision`
84
+
85
+ v0.6.0
86
+ - add sprites support
87
+
88
+ v0.5.1
89
+ - support handlebars partials. templates start with "_" will be treaded as partials/
90
+
91
+ v 0.5.0
92
+ - linner command now provides `check` and `install` commands to check and install vendor dependencies
93
+
94
+ v 0.4.6
95
+ - compat terminal-notifier with OS X mavericks
96
+
97
+ v 0.4.5
98
+ - bump reel version to 0.4.0
99
+
100
+ v 0.4.4
101
+ - glob pattern need to sort by alphabetically
102
+
103
+ v 0.4.3
104
+ - fix the last `/` in `logical_path`
105
+ - multiple revision file support
106
+
107
+ v 0.4.2
108
+ - use `sleep` to instead of `Process.wait`
109
+
110
+ v 0.4.1
111
+ - `manifest.yml` support
112
+ - lots of badges support
113
+
114
+ v 0.4.0
115
+ - revision support
116
+ - fix memory leak in `cache_miss?`
117
+ - quit `fsevent` process when `ctrl + c` triggered
118
+
119
+ v 0.3.2
120
+ - fix Celluiod logger bug
121
+ - suggest windows user to use jruby instead
122
+
123
+ v 0.3.1
124
+ - add `livereload` support
125
+
126
+ v 0.3.0
127
+ - add `compass` support
128
+ - cache now supports `styles`
129
+ - more readable config file
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in linner.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "bundler"
8
+ gem "rake"
9
+ gem "pry"
10
+ end
11
+
12
+ group :test do
13
+ gem "rspec", ">= 3.0"
14
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Saito
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,74 @@
1
+ # Linner
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/linner.png)](http://badge.fury.io/rb/linner) [![Build Status](https://travis-ci.org/SaitoWu/linner.png)](https://travis-ci.org/SaitoWu/linner) [![Code Climate](https://codeclimate.com/repos/520fd56e56b10241f50f15a3/badges/e8beb45f55b5c1fa6142/gpa.png)](https://codeclimate.com/repos/520fd56e56b10241f50f15a3/feed) [![Dependency Status](https://gemnasium.com/SaitoWu/linner.png)](https://gemnasium.com/SaitoWu/linner)
4
+
5
+ Linner is a full-featured HTML5 application assembler.
6
+
7
+ ![Linner](http://cl.ly/image/2J0d1C0D3S0E/logo.png)
8
+
9
+ #### Screencast
10
+
11
+ [![Screencast](http://cl.ly/image/000k0R400F30/Image%202014-04-29%20at%2010.20.12%20AM.png)](https://vimeo.com/71944672)
12
+
13
+ * Fast!
14
+ * Supports `Sass`, `Compass`, `Coffee`, `ECMAScript 6` and `React`.
15
+ * Supports OS X Lion and Mountaion Lion Notifications.
16
+ * Supports Modular Javascript, All your code will be wrapped by `cmd`.
17
+ * Supports `concat` code by `config file` not `directive processor`.
18
+ * Supports `copy` code from `src` to `dest`.
19
+ * Supports `precompile` Javascript Templates from `src` to `desc`.
20
+ * Supports `sprite` PNG images from `src` to `desc`.
21
+ * Supports `tar` files from `src` to `desc`.
22
+ * Supports Real-time `concat` by `$ linner watch`.
23
+ * Supports `compress` by `$ linner build`.
24
+ * Supports `LiveReload` with [LiveReload Chrome Extention](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei).
25
+
26
+ #### Documents
27
+
28
+ [https://github.com/SaitoWu/linner/tree/master/docs](https://github.com/SaitoWu/linner/tree/master/docs)
29
+
30
+ ## Requirements
31
+
32
+ #### *nix
33
+
34
+ * Ruby 2.0
35
+
36
+ #### Windows
37
+
38
+ * Install [Ruby](http://rubyinstaller.org/downloads/) and [DevKit](http://rubyinstaller.org/downloads/)
39
+ * Install gem `wdm`
40
+ * Install Node.js to make Linner faster
41
+
42
+ ## Installation
43
+
44
+ $ gem install linner
45
+
46
+ ## Usage
47
+
48
+ #### Skeleton
49
+
50
+ $ linner new webapp && cd webapp
51
+
52
+ #### Watch
53
+
54
+ $ linner watch
55
+
56
+ #### Server
57
+
58
+ $ ./bin/server # or server if put "./bin" in your PATH
59
+
60
+ #### Build
61
+
62
+ $ linner build
63
+
64
+ #### Clean
65
+
66
+ $ linner clean
67
+
68
+ ## Contributing
69
+
70
+ 1. Fork it
71
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
72
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
73
+ 4. Push to the branch (`git push origin my-new-feature`)
74
+ 5. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ desc "test"
4
+ task :test do
5
+ sh 'rspec'
6
+ end
7
+
8
+ task :default => [:test]
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Encoding.default_external = Encoding::UTF_8
4
+ Encoding.default_internal = Encoding::UTF_8
5
+
6
+ # Trap interrupts to quit cleanly. See
7
+ # https://twitter.com/mitchellh/status/283014103189053442
8
+ Signal.trap("INT") { abort }
9
+
10
+ require File.dirname(__FILE__) + "/../lib/linner"
11
+ Linner::Command.start
@@ -0,0 +1,29 @@
1
+ # Command
2
+
3
+ ## `linner new <path>`
4
+
5
+ Create new brunch project.
6
+
7
+ ## `linner check`
8
+
9
+ Check linner bundles
10
+
11
+ ## `linner install`
12
+
13
+ Install linner bundles
14
+
15
+ ## `linner watch`
16
+
17
+ Watch linner directory and rebuild if something changed.
18
+
19
+ ## `linner build`
20
+
21
+ Build and Minify a linner project.
22
+
23
+ ## `linner clean`
24
+
25
+ Clean up linner public folder.
26
+
27
+ ## `server`
28
+
29
+ Start up a server at port 3000.
@@ -0,0 +1,192 @@
1
+ # Configuration file
2
+
3
+ Linner use `config.yml` file to config your application.
4
+
5
+ ## `paths`
6
+
7
+ `paths` defines application paths, it contains `app`, `test`, `vendor` and `public` folders.
8
+
9
+ Default:
10
+
11
+ ```yaml
12
+ paths:
13
+ app: "app"
14
+ test: "test"
15
+ vendor: "vendor"
16
+ public: "public"
17
+ ```
18
+
19
+ `linner watch` command will watch `app`, `test` and `vendor` folders, and the builded file will be in `public` folder.
20
+
21
+ ## `groups`
22
+
23
+ `groups` defines application groups, you can define any type of groups in it.
24
+
25
+ Default:
26
+
27
+ ```yaml
28
+ groups:
29
+ scripts:
30
+ paths:
31
+ - "app/scripts"
32
+ order:
33
+ - "vendor/jquery-1.10.2.js"
34
+ - "..."
35
+ styles:
36
+ paths:
37
+ - "app/styles"
38
+ images:
39
+ paths:
40
+ - "app/images"
41
+ views:
42
+ paths:
43
+ - "app/views"
44
+ ```
45
+
46
+ the default configuration defines four groups: `scripts`, `styles`, `images` and `views` group.
47
+
48
+ `paths` defines where can linner find this group's files, It's a `Array`.
49
+
50
+ `concat` defines concatenation of files in Linner. the `Dir.glob` of `value` will be concat to `key` file.
51
+
52
+ `copy` defines copy strategy of files in Linner. The `Dir.glob` of `value` will be copy to `key` folder.
53
+
54
+ `compile` defines compile strategy of files in Linner. The `Dir.glob` of `value` will be compile to `key` folder.
55
+
56
+ `precompile` defines precompile strategy of javascript templates for Linner. The `Dir.glob` of `value` will be concat to `key`.
57
+
58
+ `sprite` defines sprite strategy of images for Linner. The `Dir.glob` of `value` will be sprite to `key`.
59
+
60
+ `tar` defines archive strategy of files in Linner. The `Dir.glob` of `value` will be archive to `key` file.
61
+
62
+ `context` defines the context of the `compile` files, and the value will pass to the render function.
63
+
64
+ `order` defines the order of this group files, and It's very useful when you `concat` your files. for example:
65
+
66
+ ```yaml
67
+ order:
68
+ - "vendor/jquery-1.10.2.js"
69
+ - "..."
70
+ - "vendor/underscore.js"
71
+ ```
72
+
73
+ In the above example, if a group contains 5 files, `vendor/jquery-1.10.2.js` will be the first, and `vendor/underscore.js` will be the last file.
74
+
75
+ ## `sprites`
76
+
77
+ `sprites` defines application sprite stategy. `sprites` support pseudo class of css, if your file's basename end with `_active`, the generated css will be `.active`. if your file's basename end with `_hover`, the generated css will be `:hover`, eg: `arrow_hover.png` will be `.selector-arrow:hover { ... }`
78
+
79
+ Example:
80
+
81
+ ```yaml
82
+ sprites:
83
+ # sprite image output path
84
+ path: "/images/"
85
+ # css selector
86
+ selector: ".icon-"
87
+ ```
88
+
89
+ ## `modules`
90
+
91
+ `modules` defines application module strategy, The default wrapper is `cmd`.
92
+
93
+ Default:
94
+
95
+ ```yaml
96
+ modules:
97
+ wrapper: "cmd"
98
+ ignored: "vendor/**/*"
99
+ definition: "scripts/app.js"
100
+ ```
101
+
102
+ All of your code will be wrapped by `cmd`(Common Module Definition) except `ignored` glob pattern.
103
+
104
+ The definition file will prepend to `definition` field, which will join with `public` folder.
105
+
106
+ ## `revision`
107
+
108
+ `revision` defines application layout page, which contains `link` and `script` tags.
109
+
110
+ Default:
111
+
112
+ ```yaml
113
+ revision:
114
+ prefix: "/public"
115
+ cdn: http://assets.yoursite.com
116
+ manifest: "manifest.yml"
117
+ files:
118
+ - "index.html"
119
+ ```
120
+
121
+ the `prefix` will join with revision hashes.
122
+
123
+ the `cdn` will also join with revision hashes, so it will be like `http://assets.yoursite.com/public/assets/scripts/app.js`.
124
+
125
+ the `manifest` will join with `public` folder, write a manifest file with the name.
126
+
127
+ `index.html` will join with `public` folder. So, by default when you `build` your application, the `public/index.html` file will be rewrote with revision.
128
+
129
+
130
+
131
+ If you don't need `revision` support, it can be `false`.
132
+
133
+ ## `notification`
134
+
135
+ `notification` defines application error notification.
136
+
137
+ Default:
138
+
139
+ ```yaml
140
+ notification: true
141
+ ```
142
+
143
+ ## `bundles`
144
+
145
+ `bundles` defines application's library dependencies, the dependencies will be copied to `vendor` folder.
146
+
147
+ For example:
148
+
149
+ ```yaml
150
+ bundles:
151
+ jquery.js:
152
+ version: 1.10.2
153
+ url: http://code.jquery.com/jquery-1.10.2.js
154
+ underscore.js:
155
+ version: 1.5.2
156
+ url: https://raw.github.com/jashkenas/underscore/1.5.2/underscore.js
157
+ backbone.js:
158
+ version: 1.1.0
159
+ url: https://raw.github.com/jashkenas/backbone/1.1.0/backbone.js
160
+ handlebars.js:
161
+ version: 1.0.0
162
+ url: https://raw.github.com/wycats/handlebars.js/1.0.0/dist/handlebars.js
163
+ ```
164
+
165
+ bundles also supports `tar.gz` file on the internet, you should give it a try.
166
+
167
+ When you use `tar.gz` file, the key of bundle can be a folder name, all the archived files will be decompression to the folder.
168
+
169
+
170
+ ## `environments`
171
+
172
+ `environments` defines application's running environment config, the default environment is `development`.
173
+
174
+ If you use `linner build` to build your webapp, the environment would be `production`.
175
+
176
+ For example:
177
+
178
+ ```yaml
179
+ environments:
180
+ staging:
181
+ revision:
182
+ cdn: http://staging.yoursite.com
183
+ production:
184
+ revision:
185
+ cdn: http://production.yoursite.com
186
+ ```
187
+
188
+ You can use `linner build -e staging` to use the staging environment's variables.
189
+
190
+ When you use `linner watch` to watch the project, it's equals to `linner watch -e development`, and the `development` environment is the default environment, you don't need to write it.
191
+
192
+ When you use `linner build` to build the project, it's equals to `linner build -e produciton`.