ericpaulbishop / redmine_git_hosting

A ChiliProject/Redmine plugin which makes configuring your own git hosting easy.
185 stars 37 forks source link

install error in chiliproject when migrate_plugins #159

Open farseerfc opened 12 years ago

farseerfc commented 12 years ago

I was install this in chiliproject. I typed

root@valkyrie:chiliproject# RAILS_ENV=production bundle exec rake db:migrate_plugins

And it gives me:

rake aborted!
/home/chiliproject/vendor/plugins/redmine_git_hosting/lib/git_hosting.
rb:62: syntax error, unexpected ':', expecting keyword_then or ';' or '\n'
/home/chiliproject/vendor/plugins/redmine_git_hosting/lib/git_hosting.
rb:86: syntax error, unexpected ':', expecting keyword_then or ';' or '\n'
/home/chiliproject/vendor/plugins/redmine_git_hosting/lib/git_hosting.
rb:105: syntax error, unexpected keyword_end, expecting $end

Tasks: TOP => db:migrate_plugins => db:migrate:plugins => environment
(See full trace by running task with --trace)

Is this some Version Error?

Flast commented 12 years ago

I encountered same problem in my environment (with Ruby 1.9.3p194).

Workaround is here and it seems to work fine for me. (only remove trailing colon)

diff --git lib/git_adapter_hooks.rb lib/git_adapter_hooks.rb
index 0288f12..deed32b 100755
--- lib/git_adapter_hooks.rb
+++ lib/git_adapter_hooks.rb
@@ -8,7 +8,7 @@ module GitHosting
        @@check_hooks_installed_cached = nil

        def self.check_hooks_installed
-           if not @@check_hooks_installed_cached.nil? and (Time.new - @@check_hooks_installed_stamp <= 0.5):
+           if not @@check_hooks_installed_cached.nil? and (Time.new - @@check_hooks_installed_stamp <= 0.5)
                return @@check_hooks_installed_cached
            end

diff --git lib/git_hosting.rb lib/git_hosting.rb
index 8bcea34..adaaef8 100755
--- lib/git_hosting.rb
+++ lib/git_hosting.rb
@@ -59,7 +59,7 @@ module GitHosting
    @@sudo_git_to_web_user_stamp = nil
    @@sudo_git_to_web_user_cached = nil
    def self.sudo_git_to_web_user
-       if not @@sudo_git_to_web_user_cached.nil? and (Time.new - @@sudo_git_to_web_user_stamp <= 0.5):
+       if not @@sudo_git_to_web_user_cached.nil? and (Time.new - @@sudo_git_to_web_user_stamp <= 0.5)
            return @@sudo_git_to_web_user_cached
        end
        logger.info "Testing if git user(\"#{git_user}\") can sudo to web user(\"#{web_user}\")"
@@ -83,7 +83,7 @@ module GitHosting
    @@sudo_web_to_git_user_stamp = nil
    @@sudo_web_to_git_user_cached = nil
    def self.sudo_web_to_git_user
-       if not @@sudo_web_to_git_user_cached.nil? and (Time.new - @@sudo_web_to_git_user_stamp <= 0.5):
+       if not @@sudo_web_to_git_user_cached.nil? and (Time.new - @@sudo_web_to_git_user_stamp <= 0.5)
            return @@sudo_web_to_git_user_cached
        end
        logger.info "Testing if web user(\"#{web_user}\") can sudo to git user(\"#{git_user}\")"

However, I'm not ruby programmer and I don't know about backward compatibility.

farseerfc commented 12 years ago

Thanks, this works for me! But why it seems like python ...