@@ -76,46 +76,22 @@ namespace :click do
76
76
77
77
desc 'Setup Click to Globalize plugin (alias for click:install).'
78
78
task :setup => :install
79
-
79
+
80
80
desc 'Install Click to Globalize plugin.'
81
81
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/*" ]
84
84
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 "\n Click to Globalize was correctly installed." +
94
- "\n Remember 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
95
87
end
96
-
88
+
97
89
desc 'Uninstall Click to Globalize plugin.'
98
90
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 "\n Click to Globalize was correctly uninstalled."
91
+ targets = Dir [ "#{ Rails . root } /public/**/click_to_globalize.*" ]
92
+ FileUtils . rm targets
117
93
end
118
-
94
+
119
95
desc 'Show the diffs for each file, camparing the app files with the plugin ones.'
120
96
task :diff do
121
97
files . each do |file , path |
0 commit comments