lib/dvm/cli.rb in dvm-0.0.1 vs lib/dvm/cli.rb in dvm-0.0.2

- old
+ new

@@ -43,12 +43,12 @@ def shared_dirs %w(public/upload log) end def shared_files - Dir.glob(current_path('config', '*.example')).collect do |c| - File.join 'config', File.basename(c, File.extname(c)) + Dir.glob(current_path('config', '**', '*.example')).collect do |c| + File.join 'config', c.split('config')[1][1..-1].split('.')[0..-2].join('.') end end def version(order) @@ -78,12 +78,13 @@ version end def copy_config - Dir.glob(current_path('config', '*.example')).each do |c| - FileUtils.cp c, share_path('config', File.basename(c, '.example')) + Dir.glob(current_path('config', '**', '*.example')).each do |c| + puts c + FileUtils.cp c, share_path('config', c.split('config')[1][1..-1].split('.')[0..-2].join('.')) end end def link_current(v) @@ -117,16 +118,34 @@ puts '======= Deploy success ======' end + def pull + `cd #{scm};git pull` + end + + + def update + pull + link_current checkout + link_shared + `cd #{current};RAILS_ENV=production bundle install` + `cd #{current};vam install` + `cd #{current};RAILS_ENV=production rake assets:precompile` + + puts '======= Deploy success ======' + end + + def self.run(argv) if argv.length >0 action = argv[0] if action == 'remote' puts '1' - elsif action == 'deploy' + elsif action == 'update' + CLI.new(Dir.getwd, '').update else root = Dir.getwd repo = action if action.start_with? 'g:'