rconf 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,7 +1,5 @@
1
1
  source :gemcutter
2
2
 
3
- gem 'json', '> 1.1.6'
4
-
5
3
  #Gems needed to execute the unit specs.
6
4
  group :test do
7
5
  gem 'rspec', '~> 2.5'
data/bin/rconf CHANGED
@@ -183,7 +183,7 @@ where [options] are:
183
183
  # === Return
184
184
  # true:: Always return true
185
185
  def configure(options)
186
- Profile.reset if options[:force]
186
+ Profile.force if options[:force]
187
187
  ProgressReporter.report_to_stdout
188
188
  ProgressReporter.report_to_file(options[:output]) if options[:output]
189
189
  begin
@@ -123,7 +123,7 @@ module RightConf
123
123
  sha = Profile.configurator_signature(key)
124
124
  sig = signature
125
125
  if sha != sig
126
- if only_if.nil? || instance_eval(only_if)
126
+ if only_if.nil? || instance_eval(only_if) || Profile.force?
127
127
  Platform.dispatch(*args) { :run }
128
128
  Profile.set_configurator_signature(key, sig)
129
129
  end
@@ -44,6 +44,7 @@ module RightConf
44
44
  out = Command.execute('rvm', 'list').output
45
45
  if out =~ /^=> #{version.gsub('.', '\\.')}/
46
46
  report_success
47
+ check_rvmrc
47
48
  else
48
49
  report_failure
49
50
  report_check("Switching to #{version}")
@@ -212,20 +213,21 @@ module RightConf
212
213
  # === Return
213
214
  # true:: Always return true
214
215
  def check_rvmrc
215
- return true if File.exist?('.rvmrc')
216
- report_check('Setting up .rvmrc')
217
- begin
218
- File.open('.rvmrc', 'w') do |f|
219
- f.puts "rvm #{version}@#{gemset}"
220
- f.puts "type -P rconf &>/dev/null && { rconf; }"
221
- f.puts "type -P rconf &>/dev/null || { echo 'rconf not installed, skipping (see .rvmrc)'; }"
216
+ if !File.exist?('.rvmrc') || IO.read('.rvmrc') !~ /#{version}@#{gemset}/
217
+ report_check('Setting up .rvmrc')
218
+ begin
219
+ File.open('.rvmrc', 'w') do |f|
220
+ f.puts "rvm #{version}@#{gemset}"
221
+ f.puts "type -P rconf &>/dev/null && { rconf; }"
222
+ f.puts "type -P rconf &>/dev/null || { echo 'rconf not installed, skipping (see .rvmrc)'; }"
223
+ end
224
+ report_success
225
+ post_note "Configuration required switching the active ruby\nPlease run " + 'cd ..;cd -'.blue + ' to activate it and finish configuration'.green
226
+ aborting(true)
227
+ rescue Exception => e
228
+ report_failure
229
+ report_error(e.message)
222
230
  end
223
- report_success
224
- post_note "Configuration required switching the active ruby\nPlease run " + 'cd ..;cd -'.blue + ' to activate it and finish configuration'.green
225
- aborting(true)
226
- rescue Exception => e
227
- report_failure
228
- report_error(e.message)
229
231
  end
230
232
  true
231
233
  end
data/lib/rconf/profile.rb CHANGED
@@ -72,6 +72,24 @@ module RightConf
72
72
  @profile
73
73
  end
74
74
 
75
+ # Force re-configuration even if it was already done
76
+ #
77
+ # === Return
78
+ # true:: Always return true
79
+ def force
80
+ @force = true
81
+ reset
82
+ end
83
+
84
+ # Should next configuration force re-configuration?
85
+ #
86
+ # === Return
87
+ # true:: If re-configuration should be forced
88
+ # false:: Otherwise
89
+ def force?
90
+ res = @force || false
91
+ end
92
+
75
93
  protected
76
94
 
77
95
  # Retrieve profile file path
data/lib/rconf/version.rb CHANGED
@@ -13,7 +13,7 @@ module RightConf
13
13
 
14
14
  MAJOR = 0
15
15
  MINOR = 8
16
- BUILD = 2
16
+ BUILD = 3
17
17
 
18
18
  VERSION = [MAJOR, MINOR, BUILD].map(&:to_s).join('.')
19
19
 
data/spec/profile_spec.rb CHANGED
@@ -18,6 +18,12 @@ describe RightConf::Profile do
18
18
  RightConf::Profile.set_configurator_signature(:test, '42')
19
19
  end
20
20
 
21
+ it 'should reset when forcing re-configuration' do
22
+ flexmock(RightConf::Profile.instance).should_receive(:reset).once
23
+ RightConf::Profile.force
24
+ RightConf::Profile.force?.should be_true
25
+ end
26
+
21
27
  end
22
28
 
23
29
 
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rconf
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 8
9
- - 2
10
- version: 0.8.2
4
+ prerelease:
5
+ version: 0.8.3
11
6
  platform: ruby
12
7
  authors:
13
8
  - Raphael Simon
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-04-16 00:00:00 -07:00
13
+ date: 2011-05-31 00:00:00 -07:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,10 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ~>
28
23
  - !ruby/object:Gem::Version
29
- hash: 9
30
- segments:
31
- - 2
32
- - 5
33
24
  version: "2.5"
34
25
  type: :development
35
26
  version_requirements: *id001
@@ -41,10 +32,6 @@ dependencies:
41
32
  requirements:
42
33
  - - ~>
43
34
  - !ruby/object:Gem::Version
44
- hash: 25
45
- segments:
46
- - 0
47
- - 9
48
35
  version: "0.9"
49
36
  type: :development
50
37
  version_requirements: *id002
@@ -134,23 +121,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
121
  requirements:
135
122
  - - ">="
136
123
  - !ruby/object:Gem::Version
137
- hash: 3
138
- segments:
139
- - 0
140
124
  version: "0"
141
125
  required_rubygems_version: !ruby/object:Gem::Requirement
142
126
  none: false
143
127
  requirements:
144
128
  - - ">="
145
129
  - !ruby/object:Gem::Version
146
- hash: 3
147
- segments:
148
- - 0
149
130
  version: "0"
150
131
  requirements: []
151
132
 
152
133
  rubyforge_project: rconf
153
- rubygems_version: 1.3.7
134
+ rubygems_version: 1.6.2
154
135
  signing_key:
155
136
  specification_version: 3
156
137
  summary: Cross platform environment configuration