This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (setq user-full-name "Adam Jacob" | |
| user-mail-address "[email protected]") | |
| (require 'cl) | |
| (setq-default indent-tabs-mode nil) | |
| (setq inhibit-startup-message t | |
| require-final-newline t | |
| backup-directory-alist'((".*" . "~/emacs/backups")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"instance_vars":{"@user":null,"@name":"one","@ignore_failure":false,"@command":"echo 'pants are awesome'","@actions":{},"@action":"run","@timeout":null,"@creates":null,"@noop":null,"@before":null,"@notify_only":false,"@group":null,"@not_if":null,"@node":{"name":null,"chef_type":"node","json_class":"Chef::Node","attributes":{},"recipes":[]},"@returns":0,"@backup":5,"@source_line":"\\/System\\/Library\\/Frameworks\\/Ruby.framework\\/Versions\\/1.8\\/usr\\/lib\\/ruby\\/1.8\\/irb\\/workspace.rb line 52","@environment":null,"@supports":{},"@only_if":null,"@path":null,"@cwd":null,"@updated":false,"@provider":null,"@resource_name":"execute","@allowed_actions":["nothing","run"],"@params":{}},"json_class":"Chef::Resource::Execute"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template "foo" do | |
| self.cookbook_name = "the_right_cookbook" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| $| = 1; | |
| open(BLOCK, "/sbin/service gpm restart|"); | |
| foreach my $line (<BLOCK>) { | |
| print $line; | |
| } | |
| close(BLOCK); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pi[0].close | |
| pi[1].fcntl(Fcntl::F_SETFL, pi[1].fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK) | |
| pi[2].fcntl(Fcntl::F_SETFL, pi[2].fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK) | |
| results = Process.waitpid2(cid).last | |
| b[cid, *pi] | |
| results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add this to spec/spec_helper.rb | |
| module SimpleFromFile | |
| def from_file(filename) | |
| self.instance_eval(IO.read(filename), filename, 1) | |
| end | |
| end | |
| # In your test begin() block | |
| @ohai.extend(SimpleFromFile) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Feature: Manage Files | |
| In order to save time | |
| As a Developer | |
| I want to manage files declaratively | |
| Scenario: Create a file | |
| Given a validated node | |
| And it includes the recipe 'manage_files::create_a_file' | |
| When the node is converged | |
| Then a file named 'create_a_file.txt' exists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %w{chef chef-server}.each do |inc_dir| | |
| $: << File.join(File.dirname(__FILE__), '..', '..', inc_dir, 'lib') | |
| end | |
| require 'spec/expectations' | |
| require 'chef' | |
| require 'chef/config' | |
| require 'chef/client' | |
| require 'tmpdir' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Feature: Manage Files # features/manage_files.feature | |
| In order to save time | |
| As a Developer | |
| I want to manage files declaratively | |
| Scenario: Create a file # features/manage_files.feature:6 | |
| Given a validated node # features/steps/nodes.rb:1 | |
| And it includes the recipe 'manage_files::create_a_file' # features/steps/nodes.rb:9 | |
| When I run the chef-client # features/steps/run_client.rb:1 | |
| Then the run should exit '0' # features/steps/run_client.rb:11 | |
| And a file named 'create_a_file.txt' exists # features/steps/files.rb:1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # in your recipe | |
| r = resources(:package => "sudo") | |
| r.action(:nothing) |