Adding 'yadr' command for managing plugins (wip)

This commit is contained in:
yan
2011-12-07 20:34:25 -08:00
parent 0741bb0a71
commit acb81bb874
36 changed files with 3874 additions and 15 deletions

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../../lib")
VERSION="0.0.2" # just to test it
require 'git-style-binary/command'

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../../lib")
require 'git-style-binary/command'
GitStyleBinary.command do
short_desc "download a flickr image"
banner <<-EOS
SYNOPSIS
#{command.full_name} #{all_options_string} url
Downloads an image from flickr
EOS
run do |command|
puts "would download: #{command.argv.inspect}"
end
end

View File

@@ -0,0 +1,42 @@
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../../lib")
require 'git-style-binary/command'
GitStyleBinary.primary do
version "0.0.1 (c) 2009 Nate Murray - local"
opt :test_primary, "test an option on the primary", :type => String
action do
@categories = ["sports", "news"]
end
before_run do |cmd|
puts "before_run command #{cmd}"
end
after_run do |cmd|
puts "after_run command #{cmd}"
end
run do |command|
puts "Primary Options: #{command.opts.inspect}"
end
end
# OR
# require 'git-style-binary/primary'
# command = GitStyleBinary::primary("wordpress") do
# version "#{$0} 0.0.1 (c) 2009 Nate Murray"
# banner <<-EOS
# usage: #{$0} #{all_options.collect(:&to_s).join(" ")} COMMAND [ARGS]
#
# The wordpress subcommands commands are:
# {subcommand_names.pretty_print}
#
# See 'wordpress help COMMAND' for more information on a specific command.
# EOS
# opt :verbose, "verbose", :default => false
# opt :dry, "dry run", :default => false
# opt :test_global, "a basic global string option", :type => String
# end

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../../lib")
require 'git-style-binary/command'
GitStyleBinary.command do
short_desc "do something with categories"
banner <<-EOS
SYNOPSIS
#{command.full_name} #{all_options_string}
Does something with categories
EOS
run do |command|
puts "does something with categories"
puts @categories.join(" ")
end
end

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../../lib")
require 'git-style-binary/command'
GitStyleBinary.command do
short_desc "list blog postings"
banner <<-EOS
SYNOPSIS
#{command.full_name} #{all_options_string}
Lists the posts on the blog
EOS
run do |command|
puts "listing blog posts"
end
end

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../../lib")
require 'git-style-binary/command'
GitStyleBinary.command do
short_desc "create a blog post"
banner <<-EOS
SYNOPSIS
#{command.full_name} #{all_options_string} {content|STDIN}
EOS
opt :blog, "short name of the blog to use", :default => 'default'
opt :category, "tag/category. specify multiple times for multiple categories", :type => String, :multi => true
opt :title, "title for the post", :required => true, :type => String
opt :type, "type of the content [html|xhtml|text]", :default => 'html', :type => String
run do |command|
command.die :type, "type must be one of [html|xhtml|text]" unless command.opts[:type] =~ /^(x?html|text)$/i
puts "Subcommand name: #{command.name.inspect}"
puts "Options: #{command.opts.inspect}"
puts "Remaining arguments: #{command.argv.inspect}"
end
end