gulp_rails 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 380f1be48bd9b22cdfe9c326b1daefd6f0ca5f6a
4
+ data.tar.gz: d32e97b9d605e07d529ab23212bf97f7f2d2b376
5
+ SHA512:
6
+ metadata.gz: 36f27c1570613bf97462e5afc3c8cadf8e5e51baebbafce77a2271d8a4179fb2e29cb9fe63fea745b0f7ede68ff4e6f7c193e28b587f12da1c68bd3ecf2c9eb8
7
+ data.tar.gz: 723cc0010ca782c0d5def10f0025b60c38c2f1bd6eb0d43c947a7d7806d1e85419d2174f16ba0455e77296534e3b03288e9fb28606f4d08be8f8ff842e8eec62
@@ -0,0 +1,14 @@
1
+ require 'gulp_rails/railtie'
2
+
3
+ module GulpRails
4
+
5
+ def self.options
6
+ @options ||= {
7
+ :enabled => true,
8
+ :command => 'gulp',
9
+ :directory => Rails.root.join('frontend'),
10
+ :development_only => true
11
+ }
12
+ end
13
+
14
+ end
@@ -0,0 +1,28 @@
1
+ module GulpRails
2
+ class Middleware
3
+
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+
8
+ def call(env)
9
+ result = @app.call(env)
10
+ if GulpRails.options[:enabled] && (GulpRails.options[:development_only] && Rails.env.development?)
11
+ if result[1]['Content-Type'] =~ /\Atext\/html/
12
+ log "-----> Compiling assets with gulp"
13
+ gulp_output = `cd #{GulpRails.options[:directory]} && #{GulpRails.options[:command]}`
14
+ log gulp_output.strip.split("\n").map { |l| " #{l}"}.join("\n")
15
+ log "-----> Finished compiling with gulp"
16
+ end
17
+ end
18
+ result
19
+ end
20
+
21
+ private
22
+
23
+ def log(line)
24
+ Rails.logger.debug line
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,8 @@
1
+ module GulpRails
2
+ class Railtie < Rails::Railtie
3
+ initializer 'gulp_rails.initialize' do |app|
4
+ require 'gulp_rails/middleware'
5
+ app.config.middleware.use GulpRails::Middleware
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gulp_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Adam Cooke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A library to assist with compiling assets with Rails at request-time.
14
+ email:
15
+ - adam@atechmedia.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/gulp_rails.rb
21
+ - lib/gulp_rails/middleware.rb
22
+ - lib/gulp_rails/railtie.rb
23
+ homepage: http://adamcooke.io
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.2.2
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Compile gulp assets with ease in Rails.
47
+ test_files: []
48
+ has_rdoc: