Skip to content

Commit a4e9cee

Browse files
author
root
committed
Fix #246
1 parent 36adc5d commit a4e9cee

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

Diff for: lib/tasks/redmine_git_hosting.rake

+29-19
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,42 @@ namespace :redmine_git_hosting do
3737
puts "Reloading defaults from init.rb..."
3838
RedmineGitolite::GitHosting.logger.warn { "Reloading defaults from init.rb from command line" }
3939

40+
## Get default config from init.rb
4041
default_hash = Redmine::Plugin.find("redmine_git_hosting").settings[:default]
4142

4243
if default_hash.nil? || default_hash.empty?
4344
puts "No defaults specified in init.rb!"
44-
else
45-
changes = 0
46-
valuehash = (Setting.plugin_redmine_git_hosting).clone
47-
default_hash.each do |key,value|
48-
if valuehash[key] != value
49-
puts "Changing '#{key}' : '#{valuehash[key]}' => '#{value}'\n"
50-
valuehash[key] = value
51-
changes += 1
52-
end
45+
exit 1
46+
end
47+
48+
## Refresh Settings cache
49+
Setting.check_cache
50+
51+
## Get actual values
52+
valuehash = (Setting.plugin_redmine_git_hosting).clone
53+
54+
## Update!
55+
changes = 0
56+
default_hash.each do |key, value|
57+
if valuehash[key] != value
58+
puts "Changing '#{key}' : '#{valuehash[key]}' => '#{value}'\n"
59+
valuehash[key] = value
60+
changes += 1
5361
end
54-
if changes == 0
55-
puts "No changes necessary.\n"
56-
else
57-
puts "Committing changes ... "
58-
begin
59-
Setting.plugin_redmine_git_hosting = valuehash
60-
puts "Success!\n"
61-
rescue => e
62-
puts "Failure.\n"
63-
end
62+
end
63+
64+
if changes == 0
65+
puts "No changes necessary.\n"
66+
else
67+
puts "Committing changes ... "
68+
begin
69+
Setting.plugin_redmine_git_hosting = valuehash
70+
puts "Success!\n"
71+
rescue => e
72+
puts "Failure.\n"
6473
end
6574
end
75+
6676
puts "Done!"
6777
end
6878

0 commit comments

Comments
 (0)