polyfillrb 1.1.0 → 1.1.1
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 +4 -4
- data/lib/polyfillrb/rails/railtie.rb +11 -6
- data/lib/polyfillrb/version.rb +1 -1
- data/lib/polyfillrb.rb +19 -0
- 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: edfcba7ec251b2519a9708b364a9cd5ff51546b8
|
4
|
+
data.tar.gz: 4eead90487c33c0bafb7060e6dfa30b670721c88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c23aa0a2daeee7b4f2bc92f1e984505fa83c16a6086150bfeb4055caf4cffe419785149a510c9a2ecc0d27aff0dbe6e7c5151ad9a995a0d6c0af84e5743b5e1
|
7
|
+
data.tar.gz: e08fa060a29457c6d725553cc27d7c5f73d76df6d959bea6fc439845b301bff464cc1cba9b031a24a75f95c1af71a1714896ea66652f529ae0681945bd428580
|
@@ -12,15 +12,20 @@ module Polyfillrb
|
|
12
12
|
end
|
13
13
|
|
14
14
|
# Preload the application with polyfills
|
15
|
-
|
15
|
+
config.to_prepare do
|
16
16
|
|
17
17
|
# clone polyfill
|
18
|
-
|
19
|
-
|
18
|
+
if !::Polyfillrb.has_installed_service?
|
19
|
+
::Rails.logger.info "Gathering Polyfill Library..."
|
20
|
+
%x( cd #{::Polyfillrb::PROJECT_DIRECTORY} && git clone git@github.com:Financial-Times/polyfill-service.git )
|
21
|
+
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
if !::Polyfillrb.has_built_sources?
|
24
|
+
# build the npm locals
|
25
|
+
::Rails.logger.info "Buidling Polyfills...\n this may take a minute\n You're server may not respond until this is done"
|
26
|
+
%x( cd #{::Polyfillrb::PROJECT_DIRECTORY}/polyfill-service && [ -d "node_modules" ] || npm install && grunt buildsources )
|
27
|
+
::Rails.logger.info " Done! Polyfills are built. You're server should be back in action"
|
28
|
+
end
|
24
29
|
|
25
30
|
end
|
26
31
|
|
data/lib/polyfillrb/version.rb
CHANGED
data/lib/polyfillrb.rb
CHANGED
@@ -4,9 +4,28 @@ module Polyfillrb
|
|
4
4
|
|
5
5
|
PROJECT_DIRECTORY = File.expand_path(File.dirname(__FILE__))
|
6
6
|
|
7
|
+
|
8
|
+
# Method to get the polyfills
|
9
|
+
#
|
10
|
+
# Params
|
11
|
+
# ua -> User Agent String
|
12
|
+
# minify -> Boolean if code should be minified or not
|
13
|
+
#
|
14
|
+
# returns String
|
7
15
|
def self.get_polyfills(ua, minify=false)
|
8
16
|
return %x( node #{PROJECT_DIRECTORY}/polyfill.js -p "#{ua}" #{minify})
|
9
17
|
end
|
10
18
|
|
19
|
+
|
20
|
+
# Detects if the service has been downloaded from git yet
|
21
|
+
def self.has_installed_service?
|
22
|
+
Dir.exist?(PROJECT_DIRECTORY+'/polyfill-service/')
|
23
|
+
end
|
24
|
+
|
25
|
+
# Detects if the service has installed it's dependencies
|
26
|
+
def self.has_built_sources?
|
27
|
+
Dir.exist?(PROJECT_DIRECTORY+'/polyfill-service/node_modules/')
|
28
|
+
end
|
29
|
+
|
11
30
|
end
|
12
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyfillrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blaine Kasten
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|