Class: Yuzu::Command::Create
- Inherits:
-
ConfiglessCommand
- Object
- ConfiglessCommand
- Yuzu::Command::Create
- Includes:
- Yuzu::Content
- Defined in:
- lib/yuzu/commands/create.rb
Overview
Create produces a new content such as a new yuzu website project or new blog post.
Class Method Summary collapse
Instance Method Summary collapse
- #index ⇒ Object
-
#initialize(args) ⇒ Create
constructor
A new instance of Create.
-
#post ⇒ Object
Produces a new blog post with the name given on the command line.
Methods inherited from ConfiglessCommand
Constructor Details
#initialize(args) ⇒ Create
Returns a new instance of Create.
10 11 12 |
# File 'lib/yuzu/commands/create.rb', line 10 def initialize(args) @args = args end |
Class Method Details
.help(method) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/yuzu/commands/create.rb', line 52 def self.help method case method when :index %Q{Create a new website project in the current directory.} when :post %Q{Creates a new blog post with the date prepended to the file name. Pass a quoted string, capitalized, for the title of the post.} else "No help available for #{method}." end end |
Instance Method Details
#index ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/yuzu/commands/create.rb', line 14 def index sample_project = nil sample_project_name = @args.length > 0 ? @args[0] : "default" $stderr.puts "Creating a new Yuzu '#{sample_project_name}' project in this directory..." if SampleProject.exists?(sample_project_name) sample_project = SampleProject.new(sample_project_name) sample_project.deliver! else raise RuntimeError, "Sample project called #{sample_project_name} was not found." end $stderr.puts "Done!" $stderr.puts $stderr.puts "Now try:" $stderr.puts $stderr.puts " yuzu preview" $stderr.puts preview_url = sample_project.new_config['services']['preview']['link_root'] + '/index.html' $stderr.puts "And point your web browser to #{preview_url}" $stderr.puts "to see your new Yuzu site." $stderr.puts $stderr.puts "Remember to edit yuzu.yml to set your site settings, preview path, and remote host." end |
#post ⇒ Object
Produces a new blog post with the name given on the command line.
43 44 45 46 47 48 49 50 |
# File 'lib/yuzu/commands/create.rb', line 43 def post # TODO re-enable blog post creation. Requires a config file. #if @args.length > 0 # new_post = BlogPost.new(@args.first, @config) #else # @stderr.puts 'create:post requires a filename. Try yuzu create:post "Post Title Here"' #end end |