Skip to content

Commit 0d68a1a

Browse files
author
Luca Guidi
committed
Updated install/unistall tasks
1 parent 13b1271 commit 0d68a1a

File tree

5 files changed

+10
-34
lines changed

5 files changed

+10
-34
lines changed

Diff for: templates/click.yml renamed to assets/click.yml

File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: install.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
puts "Click To Globalize was correctly downloaded.\n"+
1+
puts "Click to Globalize was correctly installed.\n"+
22
"To complete the installation run:\n"+
33
"\trake click:setup\n\n"

Diff for: tasks/click_to_globalize.rake

+9-33
Original file line numberDiff line numberDiff line change
@@ -76,46 +76,22 @@ namespace :click do
7676

7777
desc 'Setup Click to Globalize plugin (alias for click:install).'
7878
task :setup => :install
79-
79+
8080
desc 'Install Click to Globalize plugin.'
8181
task :install do
82-
# Create the app/views/shared, if needed.
83-
FileUtils.mkdir(shared_folder) unless File.directory?(shared_folder)
82+
target = "#{Rails.root}/public/"
83+
source = Dir["vendor/plugins/click-to-globalize/assets/*"]
8484

85-
# Copy Click To Globalize files.
86-
files.each do |path|
87-
file = path.split(File::SEPARATOR).last
88-
printf "Copying #{file} ... "
89-
File.cp File.join(templates_root, file), path
90-
puts 'DONE'
91-
end
92-
93-
puts "\nClick to Globalize was correctly installed." +
94-
"\nRemember to edit config/click.yml to add your locales.\n\n"
85+
FileUtils.mkdir_p(target) unless File.directory?(target)
86+
FileUtils.cp_r source, target
9587
end
96-
88+
9789
desc 'Uninstall Click to Globalize plugin.'
9890
task :uninstall do
99-
# Delete Click To Globalize files.
100-
files.each do |path|
101-
file = path.split(File::SEPARATOR).last
102-
exists = File.exists?(path)
103-
printf "Deleting #{file} ... "
104-
File.delete path if exists
105-
puts exists ? 'DONE' : 'SKIPPED'
106-
end
107-
108-
# Remove app/views/shared, if exists and empty.
109-
if File.exists? shared_folder
110-
printf 'Deleting app/views/shared ... '
111-
empty = Dir[shared_folder+'/*'].entries.empty?
112-
Dir.rmdir(shared_folder) if empty
113-
puts empty ? 'DONE' : 'SKIPPED'
114-
end
115-
116-
puts "\nClick to Globalize was correctly uninstalled."
91+
targets = Dir["#{Rails.root}/public/**/click_to_globalize.*"]
92+
FileUtils.rm targets
11793
end
118-
94+
11995
desc 'Show the diffs for each file, camparing the app files with the plugin ones.'
12096
task :diff do
12197
files.each do |file, path|

0 commit comments

Comments
 (0)