Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Running plugins:install with prompt at end of app_helpers

  • Loading branch information...
commit edd7d3b190799fb9ebfdaf62f7ae481a84f1214f 1 parent aa08bc2
Winton Welsh authored
Showing with 25 additions and 21 deletions.
  1. +0 −4 README.markdown
  2. +1 −1  resources/git/plugins.rb
  3. +24 −16 tasks/git.rake
View
4 README.markdown
@@ -19,10 +19,6 @@ Set up a fresh project
rake app_helpers
-### Update plugins (see config/plugins.rb)
-
- rake plugins:update
-
What does it do?
----------------
View
2  resources/git/plugins.rb
@@ -4,7 +4,7 @@
{ :repo => 'git@github.com:winton/cookbook.git' },
{ :repo => 'git@github.com:winton/rails_widget.git' },
{ :repo => 'git@github.com:winton/widgets.git', :to => 'app/widgets/widgets' },
- { :repo => 'git://github.com/mislav/will_paginate.git', :depth => 1, :tag => '2.3.2' },
+ { :repo => 'git://github.com/mislav/will_paginate.git' },
{ :repo => 'git://github.com/rails/rails.git', :to => 'vendor/rails', :depth => 1 },
'haml'
]
View
40 tasks/git.rake
@@ -1,18 +1,22 @@
namespace :app_helpers do
desc 'Copies git assets to app'
- task :git => [ 'app_helpers:git:ignore', 'app_helpers:git:plugins' ]
+ task :git => [ 'app_helpers:git:ignore', 'app_helpers:git:plugins', 'app_helpers:git:plugins:install' ]
namespace :git do
desc 'Copies .gitignore to app'
task :ignore do
- app_helper_resource 'git/ignore', '.gitignore'
+ unless File.exists?('.gitignore')
+ app_helper_resource 'git/ignore', '.gitignore'
+ end
end
desc 'Copy config/plugins.rb to app'
task :plugins do
- app_helper_resource 'git/plugins.rb', 'config/plugins.rb'
+ unless File.exists?('config/plugins.rb')
+ app_helper_resource 'git/plugins.rb', 'config/plugins.rb'
+ end
end
desc 'Removes files from rake app_helpers:git'
@@ -21,21 +25,25 @@ namespace :app_helpers do
`rm config/plugins.rb`
end
- namespace :plugins do
+ namespace :plugins do
desc 'Adds plugins defined in config/plugins.rb'
task :install do
- eval(File.read('config/plugins.rb')).each do |plugin|
- if plugin == 'haml'
- puts plugin
- `haml --rails .`
- next
- end
- puts plugin[:repo]
- install_path = mkdir_p(plugin[:to] || "vendor/plugins/#{File.basename(plugin[:repo], '.git')}")
- Dir.chdir install_path do
- `git init`
- `git remote add origin #{plugin[:repo]}`
- `git pull #{plugin[:depth] ? "--depth #{plugin[:depth]} " : ''}origin #{git_head(plugin)}`
+ puts "Review config/plugins.rb. Install plugins now? (y/n)"
+ yn = STDIN.gets
+ if yn.capitalize == 'Y'
+ eval(File.read('config/plugins.rb')).each do |plugin|
+ if plugin == 'haml'
+ puts plugin
+ `haml --rails .`
+ next
+ end
+ puts plugin[:repo]
+ install_path = mkdir_p(plugin[:to] || "vendor/plugins/#{File.basename(plugin[:repo], '.git')}")
+ Dir.chdir install_path do
+ `git init`
+ `git remote add origin #{plugin[:repo]}`
+ `git pull #{plugin[:depth] ? "--depth #{plugin[:depth]} " : ''}origin #{git_head(plugin)}`
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.