Skip to content

Commit

Permalink
Made the write_gemfile method magical
Browse files Browse the repository at this point in the history
  • Loading branch information
augustf committed Jul 15, 2012
1 parent ed2ba9c commit 9dbaeb8
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions app/controllers/concerto_plugins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,29 @@ def destroy

def write_Gemfile
open('Gemfile-plugins', 'w+') { |f|
ConcertoPlugin.all.each do |plugin|
f << "\ngem \"#{plugin.gem_name}\", \"#{plugin.gem_version}\"\n"
ConcertoPlugin.all.each do |plugin|
gem_args = Array.new
gem_args << "\"#{plugin.gem_name}\""

unless plugin.gem_version.blank?
gem_args << "\"#{plugin.gem_version}\""
end

if plugin.source == "git" and not plugin.source_url.blank?
gem_args << ":git => \"#{plugin.source_url}\""
end

if plugin.source == "path" and not plugin.source_url.blank?
gem_args << ":path => \"#{plugin.source_url}\""
end

f << "\ngem " + gem_args.join(", ") +"\n"
end
}
if plugin.source == "git" || plugin.source == "path"
system("gem install #{plugin.gem_name}")
end
}
system("bundle update")
end

end

0 comments on commit 9dbaeb8

Please sign in to comment.