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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83b52ea541bf7e5477966fac05ba3a4d330f8e20
4
- data.tar.gz: 89bb0281f93563920c8045c9ca3f1c97c71f8e22
3
+ metadata.gz: edfcba7ec251b2519a9708b364a9cd5ff51546b8
4
+ data.tar.gz: 4eead90487c33c0bafb7060e6dfa30b670721c88
5
5
  SHA512:
6
- metadata.gz: 4dba32c66efc3ff13f2ef3e7d6ff5c548da9a4655bcae4bcc6b04b84cfabcd4b5d7d8d0c86e9f9d7d6a54e0e6edef3fb990b1dde847996f1b3aa307684b2713d
7
- data.tar.gz: 0bdb15103e6cf9b009cd44d8970397f6751d3425f969aa871596579994ae8e2c027283725936efe9d5084c66190f3b0c1cf11253ff129199c1d228e9442b0e2d
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
- initializer "polyfillrb.configure_rails_initialization" do |app|
15
+ config.to_prepare do
16
16
 
17
17
  # clone polyfill
18
- ::Rails.logger.info "Gathering Polyfill Library..."
19
- %x( cd #{Polyfillrb::PROJECT_DIRECTORY} && git clone git@github.com:Financial-Times/polyfill-service.git )
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
- # build the npm locals
22
- ::Rails.logger.info "Buidling Polyfills...\n this may take a minute"
23
- %x( cd #{Polyfillrb::PROJECT_DIRECTORY}/polyfill-service && [ -d "node_modules" ] || npm install && grunt buildsources )
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
 
@@ -1,3 +1,3 @@
1
1
  module Polyfillrb
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
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.0
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-10 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler