Skip to content

Commit

Permalink
notify immediately, fix indentation, update copyright, additional OSs f…
Browse files Browse the repository at this point in the history
…ixes #1
  • Loading branch information
djoos committed Feb 22, 2013
1 parent 2d9bf1b commit 64b8ff0
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 59 deletions.
12 changes: 7 additions & 5 deletions README.md
Expand Up @@ -16,11 +16,13 @@ Requirements

## Platforms:

* Ubuntu
* Debian
* RHEL
* Ubuntu
* CentOS
* RHEL
* Fedora
* Scientific
* Amazon

Attributes
==========
Expand All @@ -36,8 +38,8 @@ Usage

1) include `recipe[yasm]` in a run list
2) tweak the attributes via attributes/default.rb
--- OR ---
override the attribute on a higher level (http://wiki.opscode.com/display/chef/Attributes#Attributes-AttributesPrecedence)
--- OR ---
override the attribute on a higher level (http://wiki.opscode.com/display/chef/Attributes#Attributes-AttributesPrecedence)

References
==========
Expand All @@ -49,7 +51,7 @@ License and Authors

Author: David Joos <david@escapestudios.com>
Author: Escape Studios Development <dev@escapestudios.com>
Copyright: 2012, Escape Studios
Copyright: 2012-2013, Escape Studios

Unless otherwise noted, all files are released under the MIT license,
possible exceptions will contain licensing information in them.
Expand Down
2 changes: 1 addition & 1 deletion attributes/default.rb
Expand Up @@ -2,7 +2,7 @@
# Cookbook Name:: yasm
# Attributes:: default
#
# Copyright 2012, Escape Studios
# Copyright 2012-2013, Escape Studios
#

default[:yasm][:install_method] = :package
Expand Down
24 changes: 12 additions & 12 deletions libraries/helpers.rb
Expand Up @@ -2,22 +2,22 @@
# Cookbook Name:: yasm
# Library:: helpers
#
# Copyright 2012, Escape Studios
# Copyright 2012-2013, Escape Studios
#

module YASM
module Helpers
#Returns an array of package names that will install YASM on a node.
#Package names returned are determined by the platform running this recipe.
def yasm_packages
value_for_platform(
[ "ubuntu" ] => { "default" => [ "yasm" ] },
"default" => [ "yasm" ]
)
end
end
module Helpers
#Returns an array of package names that will install YASM on a node.
#Package names returned are determined by the platform running this recipe.
def yasm_packages
value_for_platform(
[ "ubuntu" ] => { "default" => [ "yasm" ] },
"default" => [ "yasm" ]
)
end
end
end

class Chef::Recipe
include YASM::Helpers
include YASM::Helpers
end
10 changes: 4 additions & 6 deletions metadata.rb
Expand Up @@ -3,13 +3,11 @@
license "MIT"
description "Installs/Configures yasm"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.0.1"
version "0.0.2"

supports "ubuntu"
supports "debian"
supports "centos"
supports "redhat"
supports "fedora"
%w{ debian ubuntu centos redhat fedora scientific amazon }.each do |os|
supports os
end

depends "build-essential"
depends "git"
10 changes: 5 additions & 5 deletions recipes/default.rb
Expand Up @@ -2,12 +2,12 @@
# Cookbook Name:: yasm
# Recipe:: default
#
# Copyright 2012, Escape Studios
# Copyright 2012-2013, Escape Studios
#

case node[:yasm][:install_method]
when :source
include_recipe "yasm::source"
when :package
include_recipe "yasm::package"
when :source
include_recipe "yasm::source"
when :package
include_recipe "yasm::package"
end
8 changes: 4 additions & 4 deletions recipes/package.rb
Expand Up @@ -2,11 +2,11 @@
# Cookbook Name:: yasm
# Recipe:: package
#
# Copyright 2012, Escape Studios
# Copyright 2012-2013, Escape Studios
#

yasm_packages.each do |pkg|
package pkg do
action :upgrade
end
package pkg do
action :upgrade
end
end
52 changes: 26 additions & 26 deletions recipes/source.rb
Expand Up @@ -2,50 +2,50 @@
# Cookbook Name:: yasm
# Recipe:: source
#
# Copyright 2012, Escape Studios
# Copyright 2012-2013, Escape Studios
#

include_recipe "build-essential"
include_recipe "git"

yasm_packages.each do |pkg|
package pkg do
action :purge
end
package pkg do
action :purge
end
end

creates_yasm = "#{node[:yasm][:prefix]}/bin/yasm"

file "#{creates_yasm}" do
action :nothing
action :nothing
end

git "#{Chef::Config[:file_cache_path]}/yasm" do
repository node[:yasm][:git_repository]
reference node[:yasm][:git_revision]
action :sync
notifies :delete, "file[#{creates_yasm}]", :immediately
repository node[:yasm][:git_repository]
reference node[:yasm][:git_revision]
action :sync
notifies :delete, "file[#{creates_yasm}]", :immediately
end

#write the flags used to compile to disk
template "#{Chef::Config[:file_cache_path]}/yasm-compiled_with_flags" do
source "compiled_with_flags.erb"
owner "root"
group "root"
mode 0600
variables(
:compile_flags => node[:yasm][:compile_flags]
)
notifies :delete, "file[#{creates_yasm}]", :immediately
source "compiled_with_flags.erb"
owner "root"
group "root"
mode 0600
variables(
:compile_flags => node[:yasm][:compile_flags]
)
notifies :delete, "file[#{creates_yasm}]", :immediately
end

bash "compile_yasm" do
cwd "#{Chef::Config[:file_cache_path]}/yasm"
code <<-EOH
autoreconf
automake --add-missing
./configure --prefix=#{node[:yasm][:prefix]} #{node[:yasm][:compile_flags].join(' ')}
make clean && make && make install
EOH
not_if {::File.exist?(creates_yasm)}
end
cwd "#{Chef::Config[:file_cache_path]}/yasm"
code <<-EOH
autoreconf
automake --add-missing
./configure --prefix=#{node[:yasm][:prefix]} #{node[:yasm][:compile_flags].join(' ')}
make clean && make && make install
EOH
creates "#{creates_yasm}"
end

0 comments on commit 64b8ff0

Please sign in to comment.