Class: Nanoc3::CLI::Commands::Update
- Cri::Command
- Nanoc3::CLI::Commands::Update
Public Visibility
Public Instance Method Summary
| #aliases | |
|---|---|
| #long_desc | |
| #name | |
| #option_definitions | |
| #run(options, arguments) | |
| #short_desc | |
| #usage |
Public Instance Method Details
aliases
public
aliases
[View source]
11 12 13 |
# File 'lib/nanoc3/cli/commands/update.rb', line 11 def aliases [] end |
long_desc
public
long_desc
[View source]
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/nanoc3/cli/commands/update.rb', line 19 def long_desc 'Update the data stored by the data source to a newer format. The ' + 'format in which data is stored can change between releases, and ' + 'even though backward compatibility is usually preserved, it is ' + 'often a good idea to store the site data in a newer format so newer ' + 'features can be taken advantage of.' + "\n" + 'This command will change data, and it is therefore recommended to ' + 'make a backup in case something goes wrong.' end |
name
public
name
[View source]
7 8 9 |
# File 'lib/nanoc3/cli/commands/update.rb', line 7 def name 'update' end |
option_definitions
public
option_definitions
[View source]
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nanoc3/cli/commands/update.rb', line 34 def option_definitions [ # --vcs { :long => 'vcs', :short => 'c', :argument => :required, :desc => 'select the VCS to use' }, # --yes { :long => 'yes', :short => 'y', :argument => :forbidden, :desc => 'updates the data without warning' } ] end |
run
public
run(options, arguments)
[View source]
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/nanoc3/cli/commands/update.rb', line 49 def run(, arguments) # Check arguments if arguments.size != 0 $stderr.puts "usage: #{usage}" exit 1 end # Make sure we are in a nanoc site directory @base.require_site @base.site.load_data # Set VCS if possible @base.set_vcs([:vcs]) # Check for -y switch unless .has_key?(:yes) $stderr.puts '*************' $stderr.puts '** WARNING **' $stderr.puts '*************' $stderr.puts $stderr.puts 'Are you absolutely sure you want to update the ' + 'content for this site? Updating the site content ' + 'will change the structure of existing data. This ' + 'operation is destructive and cannot be reverted. ' + 'Please do not interrupt this operation; doing so can ' + 'result in data loss. As always, consider making a ' + 'backup copy.' $stderr.puts $stderr.puts 'If this nanoc site is versioned using a VCS ' + 'supported by nanoc, consider using the --vcs option ' + 'to have nanoc perform add/delete/move operations ' + 'using the specified VCS. To get a list of VCSes ' + 'supported by nanoc, issue the "info" command.' $stderr.puts $stderr.puts 'To continue, use the -y/--yes option, like "nanoc3 ' + 'update -y".' exit 1 end # Update @base.site.data_sources.each do |data_source| data_source.update end end |
short_desc
public
short_desc
[View source]
15 16 17 |
# File 'lib/nanoc3/cli/commands/update.rb', line 15 def short_desc 'update the data stored by the data source to a newer version' end |
usage
public
usage
[View source]
30 31 32 |
# File 'lib/nanoc3/cli/commands/update.rb', line 30 def usage "nanoc3 update [options]" end |