rubber 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ 3.0.1 (04/27/2015)
2
+
3
+ Improvements:
4
+ ============
5
+
6
+ [core] Force reload of Rubber config between Spring sessions in Rails 4+. <ef18da4>
7
+
8
+
1
9
  3.0.0 (04/24/2015)
2
10
 
3
11
  This is a major Rubber release in 3 years. Most of the Rubber internals haven't changed from the 2.x series. However,
data/lib/rubber.rb CHANGED
@@ -13,8 +13,8 @@ module Rubber
13
13
 
14
14
  @@root = project_root
15
15
  @@env = project_env
16
- Object.const_set('RUBBER_ENV', project_env)
17
- Object.const_set('RUBBER_ROOT', File.expand_path(project_root))
16
+ Object.const_set(:RUBBER_ENV, project_env)
17
+ Object.const_set(:RUBBER_ROOT, File.expand_path(project_root))
18
18
 
19
19
  if ! defined?(Rails) && ! Rubber::Util::is_bundler?
20
20
  # pull in basic rails env. rubber only needs RAILS_ROOT and RAILS_ENV.
@@ -34,8 +34,8 @@ module Rubber
34
34
  end
35
35
 
36
36
  # conveniences for backwards compatibility with old names
37
- Object.const_set('RUBBER_CONFIG', self.config)
38
- Object.const_set('RUBBER_INSTANCES', self.instances)
37
+ Object.const_set(:RUBBER_CONFIG, self.config)
38
+ Object.const_set(:RUBBER_INSTANCES, self.instances)
39
39
 
40
40
  end
41
41
 
@@ -80,6 +80,18 @@ module Rubber
80
80
  # create a new instance per thread
81
81
  Rubber::ThreadSafeProxy.new { Rubber::Cloud::get_provider(self.config.cloud_provider || "aws", self.config, capistrano) }
82
82
  end
83
+
84
+ def self.reset
85
+ [:RUBBER_ENV, :RUBBER_ROOT, :RUBBER_CONFIG, :RUBBER_INSTANCES].each do |const|
86
+ Object.send(:remove_const, const) if Object.constants.include?(const)
87
+ end
88
+
89
+ Rubber::Configuration.reset
90
+
91
+ synchronize do
92
+ @config = nil
93
+ end
94
+ end
83
95
 
84
96
  end
85
97
 
@@ -5,15 +5,20 @@ require 'rubber/generator'
5
5
 
6
6
  module Rubber
7
7
  module Configuration
8
+ extend MonitorMixin
8
9
 
9
10
  @@configurations = {}
10
11
 
11
12
  def self.get_configuration(env=nil, root=nil)
12
13
  key = "#{env}-#{root}"
13
- unless @@configurations[key]
14
- @@configurations[key] = ConfigHolder.new(env, root)
15
- @@configurations[key].load()
14
+
15
+ synchronize do
16
+ unless @@configurations[key]
17
+ @@configurations[key] = ConfigHolder.new(env, root)
18
+ @@configurations[key].load()
19
+ end
16
20
  end
21
+
17
22
  return @@configurations[key]
18
23
  end
19
24
 
@@ -30,6 +35,12 @@ module Rubber
30
35
  Rubber::Configuration.get_configuration(Rubber.env).instance
31
36
  end
32
37
 
38
+ def self.reset
39
+ synchronize do
40
+ @@configurations.clear
41
+ end
42
+ end
43
+
33
44
  class ConfigHolder
34
45
  def initialize(env=nil, root=nil)
35
46
  @env = env
@@ -2,13 +2,16 @@ require 'rubber'
2
2
  require 'rails'
3
3
 
4
4
  module Rubber
5
-
6
5
  class Railtie < Rails::Railtie
7
-
8
6
  config.before_configuration do
9
7
  Rubber::initialize(Rails.root, Rails.env)
10
8
  end
11
-
12
9
  end
10
+ end
13
11
 
12
+ if defined?(Spring)
13
+ Spring.after_fork do
14
+ Rubber.reset
15
+ Rubber::initialize(Rails.root, Rails.env)
16
+ end
14
17
  end
@@ -1,3 +1,3 @@
1
1
  module Rubber
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubber
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-04-24 00:00:00.000000000 Z
13
+ date: 2015-04-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano
@@ -720,7 +720,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
720
720
  version: '0'
721
721
  segments:
722
722
  - 0
723
- hash: -1209637678339755634
723
+ hash: 1883985794562211035
724
724
  requirements: []
725
725
  rubyforge_project:
726
726
  rubygems_version: 1.8.23.2