File tree 1 file changed +29
-19
lines changed
1 file changed +29
-19
lines changed Original file line number Diff line number Diff line change @@ -37,32 +37,42 @@ namespace :redmine_git_hosting do
37
37
puts "Reloading defaults from init.rb..."
38
38
RedmineGitolite ::GitHosting . logger . warn { "Reloading defaults from init.rb from command line" }
39
39
40
+ ## Get default config from init.rb
40
41
default_hash = Redmine ::Plugin . find ( "redmine_git_hosting" ) . settings [ :default ]
41
42
42
43
if default_hash . nil? || default_hash . empty?
43
44
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
53
61
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 "
64
73
end
65
74
end
75
+
66
76
puts "Done!"
67
77
end
68
78
You can’t perform that action at this time.
0 commit comments