requirejs_optimizer 0.3.2 → 0.4.1

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: cc3b30b24b7c0017959f27256d9d72dc8ab1fd95
4
- data.tar.gz: e843ddd9b04970ffe5f5f08ed8b6ffd2dd29351b
3
+ metadata.gz: a4a1a1a3e6cd182cb16095a5eb99f4217562c1d6
4
+ data.tar.gz: a976e2d233833842712c96fcd484c1179fb75ac5
5
5
  SHA512:
6
- metadata.gz: 214f5e8cf5905ef3acd401bfa3f7f8f83971389f3c7b3434213dbe7500715088734525bb3242ffd3572ed9e1400e41427ea8043452c5dacc632db0a6b866491c
7
- data.tar.gz: 08a3777c998016ba718413000f30cb1dc48d6daf0df28e9d817c2d04c3ea72d10ba95cbdfa5e1d29b3da42d16a6d405ff61b293f5bab677e9622920d0c4d9ea2
6
+ metadata.gz: 4231d43399c67ce921cfbc4e9fdf408ec78e066ae7148e0ae5a140433dc6213aa30311954dd10970b8a75504911f54d7876d18af227f4542781cdb52d821d62b
7
+ data.tar.gz: b95983edcf3685ebf9d690be8bda25c63deecaa99645be8ad347e76dd919fb3803eab780504c4fd181b7213fe8bc56f60e313a004dffad8d8e64edeb72644c87
data/Gemfile CHANGED
@@ -13,4 +13,5 @@ end
13
13
 
14
14
  group :development, :test do
15
15
  gem 'pry'
16
+ gem 'sqlite3'
16
17
  end
data/README.md CHANGED
@@ -91,6 +91,18 @@ If you have a preference, set `Rails.configuration.requirejs_optimizer_runtime`
91
91
 
92
92
  If you're using rhino, you may use the configuration parameter `Rails.configuration.requirejs_optimizer_java_opts` to include java opts (like `-Xmx`) when invoking rhino.
93
93
 
94
+
95
+ ## Overriding the base folder name (by default called "modules")
96
+
97
+ RequirejsOptimizer.base_folder = "some_other_name"
98
+
99
+ You could place the above line into an initializer file called
100
+
101
+ config/initializers/requirejs_optimizer.rb
102
+
103
+ Then "some_other_name" is used in place of "modules" in all the above paths.
104
+
105
+
94
106
  ## Contributing
95
107
 
96
108
  1. Fork it
@@ -11,8 +11,11 @@ class RequirejsOptimizerRailtie < Rails::Railtie
11
11
 
12
12
  config.before_initialize do
13
13
  Rails.application.config.assets.compress = false
14
+ end
15
+
16
+ config.after_initialize do
14
17
  javascripts_root_path = Rails.root.join(*%w(app/assets/javascripts/))
15
- modules_path = javascripts_root_path.join("modules", '**', '*.{coffee,js}')
18
+ modules_path = javascripts_root_path.join(RequirejsOptimizer.base_folder, '**', '*.{coffee,js}')
16
19
 
17
20
  modules = Dir[modules_path].reject { |f| f =~ /require\.build\.js$/ }.map do |path_with_filename|
18
21
  filename = path_with_filename.gsub(/^#{javascripts_root_path}\/?/, '').gsub(/\.coffee$/, '')
@@ -11,7 +11,7 @@ module RequirejsOptimizer
11
11
  private
12
12
 
13
13
  def optimize
14
- optimize_command = "#{runtime_cmdline} #{RequirejsOptimizer.root.join 'bin', 'r.js'} -o app/assets/javascripts/modules/require.build.js"
14
+ optimize_command = "#{runtime_cmdline} #{RequirejsOptimizer.root.join 'bin', 'r.js'} -o app/assets/javascripts/#{RequirejsOptimizer.base_folder}/require.build.js"
15
15
  puts optimize_command
16
16
  puts "\n"
17
17
  system(optimize_command)
@@ -1,3 +1,3 @@
1
1
  module RequirejsOptimizer
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -20,6 +20,9 @@ require "requirejs_optimizer/version"
20
20
 
21
21
  module RequirejsOptimizer
22
22
 
23
+ mattr_accessor :base_folder
24
+ self.base_folder ||= "modules"
25
+
23
26
  def self.root
24
27
  Pathname.new(File.expand_path("../..", __FILE__))
25
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: requirejs_optimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Trimble