Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Created January 9, 2012 21:34
Show Gist options
  • Save jtimberman/1585062 to your computer and use it in GitHub Desktop.
Save jtimberman/1585062 to your computer and use it in GitHub Desktop.
% shef
This is shef, the Chef shell.
Chef Version: 0.10.8
http://www.opscode.com/chef
http://wiki.opscode.com/display/chef/Home
run `help' for help, `exit' or ^D to quit.
chef > recipe
chef:recipe > require 'pry'
=> true
chef:recipe > f = file "/tmp/foo"
=> <file[/tmp/foo] @name: "/tmp/foo" @noop: nil @before: nil @params: {} @provider: nil @allowed_actions: [:nothing, :create, :delete, :touch, :create_if_missing] @action: "create" @updated: false @updated_by_last_action: false @supports: {} @ignore_failure: false @retries: 0 @retry_delay: 2 @immediate_notifications: [] @delayed_notifications: [] @source_line: "(irb#1):3:in `irb_binding'" @resource_name: :file @path: "/tmp/foo" @backup: 5 @cookbook_name: nil @recipe_name: nil @enclosing_provider: nil>
chef:recipe > f.pry
[1] pry(#<Chef::Resource::File>)> ls
Chef::Mixin::CheckHelper methods: set_if_args
Chef::Mixin::ParamsValidate methods: set_or_return validate
Chef::Mixin::Language methods: data_bag data_bag_item platform? search value_for_platform
Chef::Mixin::ConvertToClassName methods: convert_to_class_name convert_to_snake_case filename_to_qualified_string snake_case_basename
Chef::Mixin::Deprecation methods: deprecated_ivar
Chef::Resource methods: action add_notification allowed_actions allowed_actions= cookbook_name cookbook_name= defined_at delayed_notifications enclosing_provider enclosing_provider= epic_fail ignore_failure immediate_notifications inspect is load_prior_resource method_missing name node noop not_if not_if_args notifies notifies_delayed notifies_immediately only_if only_if_args params params= provider provider= recipe_name recipe_name= resolve_notification_references resource_name resources retries retries= retry_delay retry_delay= run_action run_context run_context= should_skip? source_line source_line= subscribes supports to_hash to_json to_s to_text updated updated= updated? updated_by_last_action updated_by_last_action?
Chef::Resource::File methods: backup checksum content group mode owner path
self methods: __binding_impl__
instance variables: @action @allowed_actions @backup @before @cookbook_name @delayed_notifications @enclosing_provider @ignore_failure @immediate_notifications @name @node @noop @not_if @only_if @params @path @provider @recipe_name @resource_name @retries @retry_delay @run_context @source_line @supports @updated @updated_by_last_action
locals: _ _dir_ _ex_ _file_ _in_ _out_ _pry_
[2] pry(#<Chef::Resource::File>)> to_hash
=> {:name=>"/tmp/foo",
:noop=>nil,
:before=>nil,
:params=>{},
:provider=>nil,
:allowed_actions=>[:nothing, :create, :delete, :touch, :create_if_missing],
:action=>"create",
:updated=>false,
:updated_by_last_action=>false,
:supports=>{},
:ignore_failure=>false,
:retries=>0,
:retry_delay=>2,
:immediate_notifications=>[],
:delayed_notifications=>[],
:source_line=>"(irb#1):3:in `irb_binding'",
:resource_name=>:file,
:path=>"/tmp/foo",
:backup=>5,
:cookbook_name=>nil,
:recipe_name=>nil,
:enclosing_provider=>nil}
[3] pry(#<Chef::Resource::File>)> content "This is a file"
=> "This is a file"
[4] pry(#<Chef::Resource::File>)> run_action(:create)
[Mon, 09 Jan 2012 14:30:47 -0700] INFO: Processing file[/tmp/foo] action create ((irb#1) line 3)
[Mon, 09 Jan 2012 14:30:47 -0700] INFO: file[/tmp/foo] created file /tmp/foo
=> nil
[5] pry(#<Chef::Resource::File>)> ^D
=> <file[/tmp/foo] @name: "/tmp/foo" @noop: nil @before: nil @params: {} @provider: nil @allowed_actions: [:nothing, :create, :delete, :touch, :create_if_missing] @action: "create" @updated: true @updated_by_last_action: true @supports: {} @ignore_failure: false @retries: 0 @retry_delay: 2 @immediate_notifications: [] @delayed_notifications: [] @source_line: "(irb#1):3:in `irb_binding'" @resource_name: :file @path: "/tmp/foo" @backup: 5 @cookbook_name: nil @recipe_name: nil @enclosing_provider: nil @content: "This is a file" @owner: nil @group: nil @mode: nil>
chef:recipe > IO.read("/tmp/foo")
=> "This is a file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment