magico 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDc0OGZjYWFhYzYxNWY3ZTJjMjY4ZWQ4MTYwZDc5YmU2YTE5ZjllMA==
4
+ OWMxOTFiN2MzNWEwNWE4ZmQ4ZGNlZjRkZjI1ZjhiYzI5MzIzYzgzNA==
5
5
  data.tar.gz: !binary |-
6
- NmI1MDcxNjc4YzRlNWE4ZGQwZjM5YTcxZDk2NjZlM2Q4YzU3ZWM2MA==
6
+ OWY1NTdhMDdiODE2NjFhMTc1ZWM2ZTcxNTM5MzE1YjFlNTBmZTU5OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTIzYzBjN2JmMTc1N2Y2Njg3OWI5MjdjNWIxMjNlMjg3YjI1MmNmNDhmZTEy
10
- NmNiZDE3YjUwMmIxZmMwMjg0YjI5OGY3NDY4OGM1YzllMDNjYzliNmQyM2E0
11
- MWM4ZWY0MTM5NjE2ZTc3MDdlZWMyMTRjYjA0Zjc4YWY2YjhiYzE=
9
+ Y2QxOTMyNTNhMGQ4ZDMwMWE1NDk1NGYwZDc1NDhiNzMyMzEyMGM0YzZjMGNh
10
+ OTE4MDgwNTczODNlMzQyN2M0ZmM1OWFjMGVkNTcyYTFhNDI1ZDQ5NzhjOWVl
11
+ MDZkOTRkNmJjZjJmMDk5NDFmZGZlYmEyOWNhMjBlZDliOTFhNzU=
12
12
  data.tar.gz: !binary |-
13
- NzhmYWI0ZmNlMGZlMjU4YWEyMzJmYjgzYWUwNzhmMjgxMTZlM2IwZDlhZTRk
14
- NTNjYjExZjY0YWZhNGI4ZGU5MTc3MjE5N2QwMzI3YzgxMzc4NzUxY2Q2NzJm
15
- N2FkNGI4YzVkNjk5OTJkNTg2ZmM5OTM1NGUzNjBlMTA2M2Y4YWE=
13
+ YjkxMTIwMzFlYTYzZmE1ODY2Y2RlOTRhMDg5ZmJlYzRmYmM2YTAzYjBlMzhi
14
+ MDQ5OWVkN2MzYTVkZjBhOTkyM2FjOTY2YmE0OTkzYzczNmVlODkyZTM1YTBk
15
+ MGJmNzJmNGNmZTI1N2U1NWYyYzFkNzE2YzczZjE1ODRlOWFjMmU=
data/bin/magico CHANGED
@@ -7,9 +7,9 @@ require 'listen'
7
7
  root_path = File.expand_path(ARGV[0] || '.', Dir.pwd)
8
8
 
9
9
  EM.run {
10
- SKIP_PARTS = %w(erb scss)
10
+ SKIP_PARTS = %w(erb scss css)
11
11
  ws_opts = { :host => "0.0.0.0", :port => 8787 }
12
- @clients = []
12
+ @clients, @lstn = [], nil
13
13
 
14
14
  EventMachine::WebSocket.start(ws_opts) do |ws|
15
15
  ws.onopen { puts "Connection open"; @clients << ws }
@@ -17,13 +17,22 @@ EM.run {
17
17
  end
18
18
 
19
19
  Thread.new do
20
- Listen.to(root_path, filter: /.*\.css.*/) do |m, a, r|
20
+ @lstn = Listen.to(root_path, filter: /.*\.css\.*/) do |m, a, r|
21
21
  (m + a + r).each do |path|
22
22
  parts = File.basename(path).split('.') - SKIP_PARTS
23
23
  @clients.each { |ws| ws.send(parts.join('.')) }
24
24
  end
25
- end
25
+ end.tap(&:start)
26
26
  end
27
27
 
28
+ def shutdown_magico
29
+ puts "Shutting down ... "
30
+ @lstn && @lstn.stop
31
+ EM.stop
32
+ end
33
+
34
+ Signal.trap('INT') { shutdown_magico }
35
+ Signal.trap('TERM'){ shutdown_magico }
36
+
28
37
  puts "Magico is watching and waiting #{root_path}/..."
29
- }
38
+ }
@@ -1,3 +1,3 @@
1
1
  module Magico
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -16,6 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Magico::VERSION
17
17
 
18
18
  gem.add_runtime_dependency 'eventmachine', '>= 0.12.0'
19
- gem.add_runtime_dependency 'em-websocket', '~> 0.3.0'
20
- gem.add_runtime_dependency 'listen', '~> 1.1.0'
19
+ gem.add_runtime_dependency 'em-websocket', '~> 0.5.0'
20
+ gem.add_runtime_dependency 'listen', '~> 3.0'
21
21
  end
@@ -14,8 +14,8 @@ Magico = {
14
14
 
15
15
  socket.onmessage = function(message) {
16
16
  var files = message.data.split(','); // TODO: Use JSON
17
- var filter = new RegExp("(" + files.join('|') + ")");
18
- Magico.reloadStylesheets(filter);
17
+ var re = "(" + files.join('|') + ")(\.self)?\.css";
18
+ Magico.reloadStylesheets(new RegExp(re));
19
19
  };
20
20
  }
21
21
  },
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magico
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Rykov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-07 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.0
33
+ version: 0.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.0
40
+ version: 0.5.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: listen
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 1.1.0
47
+ version: '3.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 1.1.0
54
+ version: '3.0'
55
55
  description: Live stylesheet updates for Rails
56
56
  email:
57
57
  - michael@gemfury.com
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.1.11
92
+ rubygems_version: 2.4.8
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: Instantly autoupdate stylesheets