Chef meetup vol2_higanwoks

  • Published on
    22-May-2015

  • View
    318

  • Download
    0

Embed Size (px)

Transcript

  • 1. Knife PluginChef Casual Talks Vol.2 (2013.5.20)HiganWorks LLC @sawanobolyMonday, May 20, 13

2. HiganWorks / () Avatar2sawanoboly@githubsawanoboly@twitteryukihiko.sawanobori@facebookMonday, May 20, 13 3. Chef3Monday, May 20, 13 4. Cookbook4Monday, May 20, 13 5. Chef:Gira(ClosedService) (Post&Trigger) Notication MapReduce kvmjoyent (Role) Chef/Capistrano /5HTTP(S)Rails APPsRDBMS(Cluster)MongoDB/RedisSMTP/Nagios/APNSetc..Monday, May 20, 13 6. KnifeMonday, May 20, 13 7. Knife ChefServerCRUD Node APICRUD Rubygems7Monday, May 20, 13 8. :Knife-ZCloudjp JoyentSmartMachineAPI Bootstrap & Role(IPBoot)8Monday, May 20, 13 9. Knife Plugin1/3 class NodeEdit #=> `knife node edit` KnifeOK banner #=> help9Monday, May 20, 13 10. Knife Plugin2/3 knife.rb `knife[:optionname] = hogehoge ` Knife#optionOK10option :twitter_consumer_key, :short => "-K CONSUMER_KEY", :long => "--twitter_consumer_key", :description => "Your Twitter Consumer Key", :proc => Proc.new { |key| Chef::Config[:knife][:twitter_consumer_key] = key }Monday, May 20, 13 11. Knife Plugin3/3 UI HighLine(gem) ANSI HignLine#list...11Monday, May 20, 13 12. knife-twitterhttps://github.com/higanworks/knife-twitterMonday, May 20, 13 13. knifetweet API#=> Twitter `knife twitter post`-m TEXT `knife twitter tl` (timeline)-m 13Monday, May 20, 13 14. Post(1)14class Chef class Knife class TwitterPost < Knife include TwitterBasebanner "knife twitter post (options)"def run t_configure begin Twitter.update(locate_config_value(:twitter_message)) ui.info("Tweet Success! #=> #{locate_config_value(:twitter_message)}")knife twitter post#run #ui Monday, May 20, 13 15. Post(2)15option :twitter_message, :short => "-m TWEET_MEAASAGE", :long => "--twitter_message", :description => "Your Tweet", :proc => Proc.new { |message| Chef::Config[:knife][:twitter_message] = message }, :default => "Tweet with knife-twitter " + ::Knife::Twitter::VERSION + " " + Time.now.to_sCLdefaultMonday, May 20, 13 16. TimeLine(1)16banner "knife twitter tl (options)"def run t_configure begin if locate_config_value(:twitter_mentions) timeline = Twitter.mentions_timeline else timeline = Twitter.home_timeline endtimelineMonday, May 20, 13 17. TimeLine(2)17tl_list = []timeline.map do |tl| tl_list