blade 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13e36bbff4397c76e84b595980f6d3d948643999
4
- data.tar.gz: 8991cb92ce7c3d242afc120b562367bd4211cf94
3
+ metadata.gz: c4352cd3ff4ece43dcda74a6c572f4a652c3e665
4
+ data.tar.gz: 7f84ef562f2722c1751266ce657d877096f7a7a5
5
5
  SHA512:
6
- metadata.gz: 94ebc239ab10c1c34082585e1b50b2d21c7933511dce753516d97e4ca2c3bbaf22ea688a2334adb74cb7996ca21a1bc6e1fc3d55260ed58628222d25cf3c243e
7
- data.tar.gz: a29c07dab604f5bd3619fc732dd123e94188a0fc0de2456200024f15d96e4d0eea331d86864bf3dd48a25192ef4f7db2b0d8d4bb94b8ed485580f93981f26490
6
+ metadata.gz: a9250ca2c28ec1d5c213ffa4d04afad63d4eaf74f0c8bb0c986dee200e0e607b7e5c639b5ba94f6d9e6039bfdc72d45b4b078f1e103e50fc0dd35750ef63724a
7
+ data.tar.gz: f566443fc75edb14e0df4ffca50cabd1865b58a12f12a376c1c1551aefb7c9311361daf4f4099a9ec1951d6f3ca060d67fbd6c6829f5e0a9aa8462fd04ab8df4
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 Javan Makhmali
3
+ Copyright (c) 2016 Javan Makhmali
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1 +1,68 @@
1
- Blade: A [Sprockets](https://github.com/rails/sprockets) test runner and toolkit.
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
@@ -87,6 +87,11 @@ module Blade
87
87
  load_adapter
88
88
  end
89
89
 
90
+ def build
91
+ initialize!
92
+ Assets.build
93
+ end
94
+
90
95
  def url(path = "/")
91
96
  "http://localhost:#{config.port}#{path}"
92
97
  end
@@ -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
- FileUtils.cp(compile_path.join(fingerprint_path), dist_path.join(logical_path))
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
@@ -13,8 +13,7 @@ class Blade::CLI < Thor
13
13
 
14
14
  desc "build", "Build assets"
15
15
  def build
16
- Blade.initialize!
17
- Blade::Assets.build
16
+ Blade.build
18
17
  end
19
18
 
20
19
  desc "config", "Inspect Blade.config"
@@ -1,3 +1,3 @@
1
1
  module Blade
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
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.3
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-23 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler