Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
Cleaning up, adding travis.yml for foodcritic.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkocher committed Apr 11, 2012
1 parent ad4aa00 commit 20ddefa
Show file tree
Hide file tree
Showing 24 changed files with 49 additions and 48 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
@@ -0,0 +1,3 @@
script: "gem install foodcritic -v 1.1.0 && foodcritic -f any ."
rvm:
- 1.9.3
File renamed without changes.
4 changes: 2 additions & 2 deletions attributes/default.rb
Expand Up @@ -16,5 +16,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
default[:pivotal_workstation][:base_dir] = "/Applications"
default[:pivotal_workstation][:cache_dir] = Chef::Config[:file_cache_path]
default['pivotal_workstation']['base_dir'] = "/Applications"
default['pivotal_workstation']['cache_dir'] = Chef::Config['file_cache_path']
2 changes: 1 addition & 1 deletion attributes/versions.rb
@@ -1,4 +1,4 @@
node.default[:versions]= {
node.default['versions']= {
"homebrew" => "36aa3c27aac6c673f409aef2da921137b2ef7967",
"rvm" => "b8c97c1020f86e76eb5862f8a603a58d56060a93",
"Pivotal-Preferences-RubyMine" => "d0eb393ab3d4c92ac80ce3135aa9f71e59cccbd3",
Expand Down
2 changes: 1 addition & 1 deletion libraries/version.rb
Expand Up @@ -4,6 +4,6 @@ def marker_version_string_for(application_name)
end

def version_string_for(application_name)
node[:versions][application_name] || raise("you must define a version for #{application_name} in attributes.")
node['versions'][application_name] || raise("you must define a version for #{application_name} in attributes.")
end
end
2 changes: 1 addition & 1 deletion recipes/add_ops_user.rb
Expand Up @@ -18,7 +18,7 @@
uid uid
home "/Users/#{username}"
shell "/bin/bash"
not_if "id #{username}"
not_if { system("id #{username}") }
end

#create the user's home directory
Expand Down
10 changes: 4 additions & 6 deletions recipes/gem_no_rdoc_no_ri.rb
Expand Up @@ -6,9 +6,7 @@
content "install: --no-rdoc --no-ri\nupdate: --no-rdoc --no-ri\n"
end

unless File.exists?("#{WS_HOME}/.gemrc")
execute "link .gemrc to /etc/gemrc" do
command "ln -s /etc/gemrc #{WS_HOME}/.gemrc"
user WS_USER
end
end
link "#{WS_HOME}/.gemrc" do
to "/etc/gemrc"
owner WS_USER
end
2 changes: 1 addition & 1 deletion recipes/git_projects.rb
@@ -1,6 +1,6 @@
include_recipe "pivotal_workstation::workspace_directory"

node.git_projects.each do |repo_name, repo_address|
node['git_projects'].each do |repo_name, repo_address|
execute "clone #{repo_name}" do
command "git clone #{repo_address} #{repo_name}"
user WS_USER
Expand Down
6 changes: 3 additions & 3 deletions recipes/github_for_mac.rb
@@ -1,17 +1,17 @@
unless File.exists?(node["github_for_mac_app_path"])

remote_file "/tmp/github_for_mac.zip" do
remote_file "#{Chef::Config[:file_cache_path]}/github_for_mac.zip" do
source node["github_for_mac_download_uri"]
owner WS_USER
end

execute "unzip github_for_mac" do
command "unzip /tmp/github_for_mac.zip -d /tmp/"
command "unzip #{Chef::Config[:file_cache_path]}/github_for_mac.zip -d #{Chef::Config[:file_cache_path]}/"
user WS_USER
end

execute "copy github_for_mac to /Applications" do
command "mv /tmp/GitHub.app #{Regexp.escape(node["github_for_mac_app_path"])}"
command "mv #{Chef::Config[:file_cache_path]}/GitHub.app #{Regexp.escape(node["github_for_mac_app_path"])}"
user WS_USER
group "admin"
end
Expand Down
12 changes: 6 additions & 6 deletions recipes/github_ssh_keys.rb
Expand Up @@ -48,13 +48,13 @@
end

execute "create SSH key pair for Github" do
command "ssh-keygen -N '' -f #{WS_HOME}/.ssh/id_github_#{node["github_project"] || node[:fqdn]}"
command "ssh-keygen -N '' -f #{WS_HOME}/.ssh/id_github_#{node["github_project"] || node['fqdn']}"
user WS_USER
not_if "test -e #{WS_HOME}/.ssh/id_github_#{node["github_project"] || node[:fqdn]}"
not_if "test -e #{WS_HOME}/.ssh/id_github_#{node["github_project"] || node['fqdn']}"
end

execute "symlink Github key for git-project" do
command "ln -nfs #{WS_HOME}/.ssh/id_github_{#{node["github_project"] || node[:fqdn]},current}"
command "ln -nfs #{WS_HOME}/.ssh/id_github_{#{node["github_project"] || node['fqdn']},current}"
user WS_USER
end

Expand All @@ -67,15 +67,15 @@

# add ssh keys to github account if possible
if node["github_username"].to_s != "" && node["github_password"].to_s != ""
github_name="#{WS_USER}@#{node[:fqdn]}"
github_name="#{WS_USER}@#{node['fqdn']}"
curl_options = %[--retry 3 --retry-delay 5 --retry-max-time 30 --connect-timeout 5 --max-time 30 -u "#{node["github_username"]}:#{node["github_password"]}"]
execute "upload ssh key to github if it does not already exist there" do
not_if <<-SH
curl #{curl_options} https://api.github.com/user/keys | grep "`cat #{WS_HOME}/.ssh/id_github_#{node["github_project"] || node[:fqdn]}.pub` | cut -f 2 -d ' '`"
curl #{curl_options} https://api.github.com/user/keys | grep "`cat #{WS_HOME}/.ssh/id_github_#{node["github_project"] || node["fqdn"]}.pub` | cut -f 2 -d ' '`"
SH
command <<-SH
curl -X POST --verbose #{curl_options} \
--data "{ \\"key\\": \\"`cat #{WS_HOME}/.ssh/id_github_#{node["github_project"] || node[:fqdn]}.pub`\\", \\"title\\": \\"#{github_name}\\" }" \
--data "{ \\"key\\": \\"`cat #{WS_HOME}/.ssh/id_github_#{node["github_project"] || node["fqdn"]}.pub`\\", \\"title\\": \\"#{github_name}\\" }" \
https://api.github.com/user/keys
SH
end
Expand Down
8 changes: 4 additions & 4 deletions recipes/gitx.rb
Expand Up @@ -6,23 +6,23 @@

unless File.exists?(GITX_PATH)

remote_file "/tmp/gitx.zip" do
remote_file "#{Chef::Config[:file_cache_path]}/gitx.zip" do
source node["gitx_download_location"]
owner WS_USER
end

directory "/tmp/GitX.app" do
directory "#{Chef::Config[:file_cache_path]}/GitX.app" do
action :delete
recursive true
end

execute "unzip gitx" do
command "unzip /tmp/gitx.zip -d /tmp/"
command "unzip #{Chef::Config[:file_cache_path]}/gitx.zip -d #{Chef::Config[:file_cache_path]}/"
user WS_USER
end

execute "copy gitx to /Applications" do
command "rsync -a /tmp/GitX.app /Applications"
command "rsync -a #{Chef::Config[:file_cache_path]}/GitX.app /Applications"
user WS_USER
group "admin"
end
Expand Down
6 changes: 3 additions & 3 deletions recipes/homebrew.rb
Expand Up @@ -10,16 +10,16 @@
# recipe creates it, and that's a pre-req. Also, things like
# MacFuse, Audacity, and others tend to put things in /usr/local

git "/tmp/homebrew" do
git "#{Chef::Config[:file_cache_path]}/homebrew" do
repository "https://github.com/mxcl/homebrew.git"
revision homebrew_git_revision_hash
destination "/tmp/homebrew"
destination "#{Chef::Config[:file_cache_path]}/homebrew"
action :sync
user WS_USER
end

execute "Copying homebrew's .git to /usr/local" do
command "rsync -axSH /tmp/homebrew/ /usr/local/"
command "rsync -axSH #{Chef::Config[:file_cache_path]}/homebrew/ /usr/local/"
user WS_USER
end

Expand Down
4 changes: 2 additions & 2 deletions recipes/jumpcut.rb
@@ -1,7 +1,7 @@
ruby_block "Install Jumpcut" do
block do
system("cd /tmp/ && curl -L 'http://downloads.sourceforge.net/project/jumpcut/jumpcut/0.63/Jumpcut_0.63.tgz?r=http%3A%2F%2Fjumpcut.sourceforge.net%2F&ts=1319134739&use_mirror=iweb' | gunzip | tar xf -")
system("mv /tmp/Jumpcut.app /Applications")
system("cd #{Chef::Config[:file_cache_path]}/ && curl -L 'http://downloads.sourceforge.net/project/jumpcut/jumpcut/0.63/Jumpcut_0.63.tgz?r=http%3A%2F%2Fjumpcut.sourceforge.net%2F&ts=1319134739&use_mirror=iweb' | gunzip | tar xf -")
system("mv #{Chef::Config[:file_cache_path]}/Jumpcut.app /Applications")
system("chown -R #{WS_USER} /Applications/Jumpcut.app")
end
not_if {File.exists?("/Applications/Jumpcut.app")}
Expand Down
4 changes: 2 additions & 2 deletions recipes/mouse_locator.rb
@@ -1,13 +1,13 @@
unless File.exists?(node['mouse_locator_dst'])

remote_file "/tmp/mouse_locator.dmg" do
remote_file "#{Chef::Config[:file_cache_path]}/mouse_locator.dmg" do
source node["mouse_locator_download_uri"]
mode "0644"
action :create_if_missing
end

execute "mount mouse_locator dmg" do
command "hdid /tmp/mouse_locator.dmg"
command "hdid #{Chef::Config[:file_cache_path]}/mouse_locator.dmg"
user WS_USER
end

Expand Down
2 changes: 1 addition & 1 deletion recipes/mysql.rb
Expand Up @@ -34,7 +34,7 @@
execute "load the mysql plist into the mac daemon startup thing" do
command "launchctl load -w #{WS_HOME}/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
user WS_USER
not_if "launchctl list com.mysql.mysqld"
not_if { system("launchctl list com.mysql.mysqld") }
end

ruby_block "Checking that mysql is running" do
Expand Down
2 changes: 1 addition & 1 deletion recipes/osx_updates.rb
@@ -1,7 +1,7 @@
# This is a theorteically flawed chef recipe. This installs anything apple thinks
# is a good idea. Please understand why you shouldn't use this before using it.

last_update_touchfile = "/tmp/last_software_update"
last_update_touchfile = "#{Chef::Config[:file_cache_path]}/last_software_update"

execute "Check & install all available OS X updates from Apple" do
command "softwareupdate -i -a && touch #{last_update_touchfile}"
Expand Down
6 changes: 3 additions & 3 deletions recipes/pivotal_logos.rb
Expand Up @@ -40,7 +40,7 @@
end
end

template "/tmp/jpegphoto.dsimport" do
template "#{Chef::Config[:file_cache_path]}/jpegphoto.dsimport" do
source "pivotal_logos-dsimport.erb"
owner WS_USER
end
Expand All @@ -52,10 +52,10 @@
# ->Users & Groups
# ->select your username->click on icon->click "Edit Picture..."
# ->set your picture to the one you want. Then:
# dscl . read /Users/$USER JPEGPhoto |tail +2 |xxd -r -p > /tmp/precious.jpeg
# dscl . read /Users/$USER JPEGPhoto |tail +2 |xxd -r -p > #{Chef::Config[:file_cache_path]}/precious.jpeg
execute("dscl . delete /Users/#{WS_USER} JPEGPhoto")
execute("dscl . create /Users/#{WS_USER} Picture \"#{WS_HOME}/Pictures/Icons/tracker_dot.png\"")
execute("dsimport /tmp/jpegphoto.dsimport /Local/Default M")
execute("dsimport #{Chef::Config[:file_cache_path]}/jpegphoto.dsimport /Local/Default M")

gem_package("plist")

Expand Down
2 changes: 1 addition & 1 deletion recipes/rubymine_preferences_pivotal.rb
Expand Up @@ -2,7 +2,7 @@
rubymine_version_string = version_string_for("RubyMine-VersionString")

run_unless_marker_file_exists("#{marker_version_string_for("Pivotal-Preferences-RubyMine")}-#{rubymine_version_string}") do
download_dir = "/tmp/Pivotal-Preferences-RubyMine"
download_dir = "#{Chef::Config[:file_cache_path]}/Pivotal-Preferences-RubyMine"
rubymine_preferences_dir = "#{WS_HOME}/Library/Preferences/RubyMine#{rubymine_version_string}"

execute "reset dir" do
Expand Down
4 changes: 2 additions & 2 deletions recipes/selenium_webdriver.rb
Expand Up @@ -2,12 +2,12 @@

run_unless_marker_file_exists("selenium_webdriver_13_0_775_3") do
execute "download webdriver" do
command "curl -o /tmp/webdriver.zip #{webdriver_location}"
command "curl -o #{Chef::Config[:file_cache_path]}/webdriver.zip #{webdriver_location}"
user WS_USER
end

execute "unzip" do
command "unzip -o /tmp/webdriver.zip chromedriver -d /usr/bin/"
command "unzip -o #{Chef::Config[:file_cache_path]}/webdriver.zip chromedriver -d /usr/bin/"
end
end

Expand Down
4 changes: 2 additions & 2 deletions recipes/sizeup.rb
@@ -1,6 +1,6 @@
unless File.exists?("/Applications/SizeUp.app")

remote_file "/tmp/sizeup.zip" do
remote_file "#{Chef::Config[:file_cache_path]}/sizeup.zip" do
source node["sizeup_download_uri"]
mode "0644"
end
Expand All @@ -13,7 +13,7 @@
end

execute "unzip sizeup" do
command "unzip /tmp/sizeup.zip SizeUp.app/* -d /Applications/"
command "unzip #{Chef::Config[:file_cache_path]}/sizeup.zip SizeUp.app/* -d /Applications/"
user WS_USER
end
end
2 changes: 1 addition & 1 deletion recipes/ssl_certificate.rb
Expand Up @@ -2,7 +2,7 @@
ca_path = node["ssl_settings"]["ca_path"]

run_unless_marker_file_exists("ssl_certificate") do
["/usr/local", "/usr/local/etc", cert_path, "#{ca_path}", "#{ca_path}/keys", "#{ca_path}/requests", "#{ca_path}/certs", "#{ca_path}/newcerts"].each do |dir|
["/usr/local", "/usr/local/etc", cert_path, ca_path, "#{ca_path}/keys", "#{ca_path}/requests", "#{ca_path}/certs", "#{ca_path}/newcerts"].each do |dir|
directory dir do
recursive true
owner WS_USER
Expand Down
4 changes: 2 additions & 2 deletions recipes/textmate.rb
Expand Up @@ -2,12 +2,12 @@

unless File.exists?("/Applications/TextMate.app")
execute "download text mate to temp dir" do
command "curl -L -o /tmp/textmate.zip http://download.macromates.com/TextMate_1.5.10.zip"
command "curl -o #{Chef::Config[:file_cache_path]}/textmate.zip http://download.macromates.com/TextMate_1.5.10.zip"
user WS_USER
end

execute "extract text mate to /Applications" do
command 'unzip -o /tmp/textmate.zip -x __MACOSX* -d /Applications/'
command 'unzip -o #{Chef::Config[:file_cache_path]}/textmate.zip -x __MACOSX* -d /Applications/'
user WS_USER
end

Expand Down
4 changes: 2 additions & 2 deletions recipes/textmate_plugins.rb
@@ -1,11 +1,11 @@
run_unless_marker_file_exists("textmate_plugins_0") do
execute "download ProjectPlus to temp dir" do
command "curl -o /tmp/projectplus.dmg http://ciaranwal.sh/projectplus-files/ProjectPlus-1.3.dmg"
command "curl -o #{Chef::Config[:file_cache_path]}/projectplus.dmg http://ciaranwal.sh/projectplus-files/ProjectPlus-1.3.dmg"
user WS_USER
end

execute "mount dmg" do
command "hdid /tmp/projectplus.dmg"
command "hdid #{Chef::Config[:file_cache_path]}/projectplus.dmg"
user WS_USER
end

Expand Down
2 changes: 1 addition & 1 deletion recipes/vim.rb
Expand Up @@ -21,7 +21,7 @@
end
end

git "#{node["vim_home"]}" do
git node["vim_home"] do
repository "git://github.com/pivotal/vim-config.git"
branch "master"
revision node["vim_hash"] || "HEAD"
Expand Down

0 comments on commit 20ddefa

Please sign in to comment.