asset 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f17565f109c0b351777b0d7cfa88144524534ed
4
- data.tar.gz: be03e366951fb2b26382bc2b07b4ed64f1973779
3
+ metadata.gz: c8bb24feacfd52ac3d781e350fb69baf17d96efa
4
+ data.tar.gz: fe54f8ba994df28627af3deb0fa2ce2a4df8cc41
5
5
  SHA512:
6
- metadata.gz: 284bbb2daa6970e6b1f90a812b19120a7d77d857f5b338bfdc69610c868da2ce684933e2f19258ec1b8fdb4c6e38e89ecfa5fd9a744ede4f7a7dab22e31b3088
7
- data.tar.gz: f86dbc037a1e5f703a674ad1f7b604b5ae3fa26660c9aaa62372a440c79f049b343c64a9555d36cd40ff6b36b20c844272413b2a86030db9176cdb7e8c2a4327
6
+ metadata.gz: 6cf5ec7f3b08f25ff879f960e894c6d49654a1e9264b5edaa938a732eb5f00f5acf14c7f140e7e800b30830d2befc30b81bec9420741b150be7f4a987aea64ef
7
+ data.tar.gz: f52fd0cffd5a48b9305010751025ed34a51958be0fc69f9a2f31e995a6c1941795adbf24b88b549022c60962692de0842daeec4c1af84835b8e45534888b64a5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ **Version 0.1.9** - *2017-01-19*
2
+
3
+ - Added auto-reload with listen gem for development mode
4
+
1
5
  **Version 0.1.8** - *2017-01-19*
2
6
 
3
7
  - Removed tilt as dependency, using Sass only
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- gem 'rerun' #, :git => 'https://github.com/fugroup/rerun'
6
+ gem 'rerun'
7
7
  gem 'rb-fsevent'
8
8
  gem 'terminal-notifier'
9
9
  end
data/asset.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'asset'
3
- s.version = '0.1.8'
3
+ s.version = '0.1.9'
4
4
  s.date = '2017-01-19'
5
5
  s.summary = "Compress and serve your CSS and JS assets automatically"
6
6
  s.description = "The only thing you need for your assets."
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_development_dependency 'request_store', '>= 0'
21
21
  s.add_development_dependency 'fuprint', '>= 0'
22
22
  s.add_development_dependency 'futest', '>= 0'
23
+ s.add_development_dependency 'listen', '>= 0'
23
24
 
24
25
  s.homepage = 'https://github.com/fugroup/asset'
25
26
  s.license = 'MIT'
data/lib/asset.rb CHANGED
@@ -10,7 +10,7 @@ module Asset
10
10
  autoload :Uglifier, 'uglifier'
11
11
  autoload :Sass, 'sass'
12
12
 
13
- class << self; attr_accessor :mode, :path, :cache, :favicon, :robots, :manifest, :bundle, :images, :debug; end
13
+ class << self; attr_accessor :mode, :path, :cache, :favicon, :robots, :manifest, :bundle, :images, :listener, :debug; end
14
14
 
15
15
  # Default is development
16
16
  @mode = ENV['RACK_ENV'] || 'development'
@@ -27,6 +27,9 @@ module Asset
27
27
  # Send /robots.txt to a standard robots txt with reference to /sitemap.xml
28
28
  @robots = true
29
29
 
30
+ # Reset the assets on change in development mode
31
+ @listener = true
32
+
30
33
  # Debug option
31
34
  @debug = false
32
35
  end
@@ -34,15 +37,21 @@ end
34
37
  require_relative 'assets/util'
35
38
  require_relative 'assets/item'
36
39
 
37
- # Load the manifest
38
- ::Asset.manifest = ::Asset::Util.load_manifest
39
-
40
- # Load the bundle
41
- ::Asset.bundle = YAML.load_file(File.join(::Asset.path, 'manifest.yml'))
42
-
43
- # Load the images
44
- ::Asset.images = ::Asset::Util.load_images
40
+ ::Asset::Util.setup!
45
41
 
46
42
  require_relative 'assets/helpers'
47
43
  require_relative 'assets/filters'
48
44
  require_relative 'assets/router'
45
+
46
+ # Run a listener to automatically reload the assets on change
47
+ if ::Asset.listener and ::Asset.mode == 'development'
48
+ autoload :Listen, 'listen'
49
+
50
+ if defined?(Listen)
51
+ # Reload assets on change
52
+ listener = Listen.to(::Asset.path) do |modified, added, removed|
53
+ ::Asset::Util.setup!
54
+ end
55
+ listener.start
56
+ end
57
+ end
data/lib/assets/util.rb CHANGED
@@ -1,6 +1,18 @@
1
1
  module Asset
2
2
  class Util
3
3
 
4
+ # Setup assets
5
+ def self.setup!
6
+ # Load the manifest
7
+ ::Asset.manifest = load_manifest
8
+
9
+ # Load the bundle
10
+ ::Asset.bundle = YAML.load_file(File.join(::Asset.path, 'manifest.yml'))
11
+
12
+ # Load the images
13
+ ::Asset.images = load_images
14
+ end
15
+
4
16
  # Get timestamp
5
17
  def self.mtime(path)
6
18
  File.mtime(asset_path(path)).utc
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: listen
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: The only thing you need for your assets.
168
182
  email: vidar@fugroup.net
169
183
  executables: []