blade 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +68 -1
- data/lib/blade.rb +5 -0
- data/lib/blade/assets/builder.rb +22 -3
- data/lib/blade/cli.rb +1 -2
- data/lib/blade/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4352cd3ff4ece43dcda74a6c572f4a652c3e665
|
4
|
+
data.tar.gz: 7f84ef562f2722c1751266ce657d877096f7a7a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9250ca2c28ec1d5c213ffa4d04afad63d4eaf74f0c8bb0c986dee200e0e607b7e5c639b5ba94f6d9e6039bfdc72d45b4b078f1e103e50fc0dd35750ef63724a
|
7
|
+
data.tar.gz: f566443fc75edb14e0df4ffca50cabd1865b58a12f12a376c1c1551aefb7c9311361daf4f4099a9ec1951d6f3ca060d67fbd6c6829f5e0a9aa8462fd04ab8df4
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1 +1,68 @@
|
|
1
|
-
Blade
|
1
|
+
# Blade
|
2
|
+
### A [Sprockets](https://github.com/rails/sprockets) Toolkit for Building and Testing JavaScript Libraries
|
3
|
+
|
4
|
+
## Getting Started
|
5
|
+
|
6
|
+
Add Blade to your `Gemfile`.
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
source "https://rubygems.org"
|
10
|
+
|
11
|
+
gem 'blade'
|
12
|
+
```
|
13
|
+
|
14
|
+
Create a `.blade.yml` (or `blade.yml`) file in your project’s root, and define your Sprockets [load paths](https://github.com/rails/sprockets#the-load-path) and [logical paths](https://github.com/rails/sprockets#logical-paths). Example:
|
15
|
+
|
16
|
+
```yaml
|
17
|
+
# .blade.yml
|
18
|
+
load_paths:
|
19
|
+
- src
|
20
|
+
- test/src
|
21
|
+
- test/vendor
|
22
|
+
|
23
|
+
logical_paths:
|
24
|
+
- widget.js
|
25
|
+
- test.js
|
26
|
+
```
|
27
|
+
|
28
|
+
## Compiling
|
29
|
+
|
30
|
+
Configure your build paths and [compressors](https://github.com/rails/sprockets#minifying-assets):
|
31
|
+
|
32
|
+
```yaml
|
33
|
+
# .blade.yml
|
34
|
+
…
|
35
|
+
build:
|
36
|
+
logical_paths:
|
37
|
+
- widget.js
|
38
|
+
path: dist
|
39
|
+
js_compressor: uglifier # Optional
|
40
|
+
```
|
41
|
+
|
42
|
+
Run `bundle exec blade build` to compile `dist/widget.js`.
|
43
|
+
|
44
|
+
## Testing Locally
|
45
|
+
|
46
|
+
By default, Blade sets up a test runner using [QUnit](http://qunitjs.com/) via the [blade-qunit_adapter](https://github.com/javan/blade-qunit_adapter) gem.
|
47
|
+
|
48
|
+
Run `bundle exec blade runner` to launch Blade’s test console and open the URL it displays in one or more browsers. Blade detects changes to your logical paths and automatically restarts the test suite.
|
49
|
+
|
50
|
+
![Blade Runner](https://cloud.githubusercontent.com/assets/5355/15481643/8aef7c98-20f9-11e6-9826-80a32ce7568c.png)
|
51
|
+
|
52
|
+
## Testing on CI
|
53
|
+
|
54
|
+
Run `bundle exec blade ci` to start Blade’s test console in non-interactive CI mode, and launch a browser pointed at Blade’s testing URL (usually http://localhost:9876). The process will return `0` on success and non-zero on failure.
|
55
|
+
|
56
|
+
To test on multiple browsers with [Sauce Labs](https://saucelabs.com/), see the [Sauce Labs plugin](https://github.com/blade-sauce_labs_plugin).
|
57
|
+
|
58
|
+
## Projects Using Blade
|
59
|
+
|
60
|
+
* [Trix](https://github.com/basecamp/trix)
|
61
|
+
* [Turbolinks](https://github.com/turbolinks/turbolinks)
|
62
|
+
* [Action Cable](https://github.com/rails/rails/tree/master/actioncable)
|
63
|
+
|
64
|
+
---
|
65
|
+
|
66
|
+
Licensed under the [MIT License](LICENSE.txt)
|
67
|
+
|
68
|
+
© 2016 Javan Makhmali
|
data/lib/blade.rb
CHANGED
data/lib/blade/assets/builder.rb
CHANGED
@@ -6,8 +6,12 @@ class Blade::Assets::Builder
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def build
|
9
|
+
puts "Building assets…"
|
10
|
+
|
9
11
|
clean
|
10
12
|
compile
|
13
|
+
clean_dist_path
|
14
|
+
create_dist_path
|
11
15
|
install
|
12
16
|
end
|
13
17
|
|
@@ -19,11 +23,12 @@ class Blade::Assets::Builder
|
|
19
23
|
end
|
20
24
|
|
21
25
|
def install
|
22
|
-
create_dist_path
|
23
|
-
|
24
26
|
logical_paths.each do |logical_path|
|
25
27
|
fingerprint_path = manifest.assets[logical_path]
|
26
|
-
|
28
|
+
source_path = compile_path.join(fingerprint_path)
|
29
|
+
destination_path = dist_path.join(logical_path)
|
30
|
+
FileUtils.cp(source_path, destination_path)
|
31
|
+
puts "[created] #{destination_path}"
|
27
32
|
end
|
28
33
|
end
|
29
34
|
|
@@ -44,6 +49,20 @@ class Blade::Assets::Builder
|
|
44
49
|
dist_path.mkpath unless dist_path.exist?
|
45
50
|
end
|
46
51
|
|
52
|
+
def clean_dist_path
|
53
|
+
if clean_dist_path?
|
54
|
+
children = dist_path.children
|
55
|
+
dist_path.rmtree
|
56
|
+
children.each do |child|
|
57
|
+
puts "[removed] #{child}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def clean_dist_path?
|
63
|
+
Blade.config.build.clean && dist_path.exist?
|
64
|
+
end
|
65
|
+
|
47
66
|
def dist_path
|
48
67
|
@dist_path ||= Pathname.new(Blade.config.build.path)
|
49
68
|
end
|
data/lib/blade/cli.rb
CHANGED
data/lib/blade/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javan Makhmali
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|