Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update plugins only if there is a newer version #108

Merged
merged 1 commit into from
Jan 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
timeout => $timeout,
cwd => $destination,
require => Exec["rbenv::plugin::checkout ${user} ${plugin_name}"],
onlyif => 'git remote update; if [ "$(git rev-parse @{0})" = "$(git rev-parse @{u})" ]; then return 0; else return 1; fi ]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why we don't use vcsrepo here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's see if i can patch this up to use vcsrepo instead…


see, #110

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't work.

==> default: Debug: Exec[rbenv::plugin::update vagrant ruby-build](provider=posix): Executing check 'git remote update; if [ "$(git rev-parse @{0})" = "$(git rev-parse @{u})" ]; then return 0; else return 1; fi ]'
==> default: Debug: Executing 'git remote update; if [ "$(git rev-parse @{0})" = "$(git rev-parse @{u})" ]; then return 0; else return 1; fi ]'
==> default: Debug: /Stage[main]/Devops/Devops::Ruby[devops_ruby]/Rbenv::Compile[1.9.3-p547]/Rbenv::Plugin::Rubybuild[rbenv::rubybuild::vagrant]/Rbenv::Plugin[rbenv::plugin::rubybuild::vagrant]/Exec[rbenv::plugin::update vagrant ruby-build]/onlyif: sh: -c: line 0: syntax error near unexpected token `]'

should be something more like this:

test `git remote update 1> /dev/null; if [ "$(git rev-parse @{0})" = "$(git rev-parse @{u})" ]; then echo 0; else echo 1; fi` -eq 1

}

}
5 changes: 4 additions & 1 deletion spec/defines/rbenv__plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
:user => user,
:cwd => target_path,
:require => /rbenv::plugin::checkout #{user} #{plugin_name}/,
:path => ['/bin','/usr/bin','/usr/sbin']
:path => ['/bin','/usr/bin','/usr/sbin'],
:onlyif => 'git remote update; ' \
'if [ "$(git rev-parse @{0})" = "$(git rev-parse @{u})" ]; ' \
'then return 0; else return 1; fi ]'
)
end

Expand Down