Permalink
Browse files

Merge branch 'charles-proxy' of github.com:mattheath/pivotal_workstation

  • Loading branch information...
2 parents 44bf85f + b895d2a commit cc2ebf7fe7d9722386ba80ba5135977a82eb5219 Abhi Hiremagalur and Brian Cunnie committed Mar 15, 2013
Showing with 133 additions and 0 deletions.
  1. +4 −0 attributes/charles_proxy.rb
  2. +45 −0 recipes/charles_proxy.rb
  3. +84 −0 templates/default/com.xk72.charles.config.erb
@@ -0,0 +1,4 @@
+node.default["charles_proxy"]["download_uri"]="http://www.charlesproxy.com/assets/release/3.6.5/charles-proxy_3.6.5.zip"
+node.default["charles_proxy"]["sha"]="2d9360ac63b826f6f190af8bb6ff9493bbc5e3e28ff45345ffc267ee72e5f335"
+node.default["charles_proxy"]["app_path"]="/Applications/Charles.app"
+node.default["charles_proxy"]["config_path"]="/Users/#{WS_USER}/Library/Preferences/com.xk72.charles.config"
View
@@ -0,0 +1,45 @@
+# Recipe to install Charles Proxy
+# http://www.charlesproxy.com/
+#
+# If you already have a license name and key, specify these in the
+# node_attributes section of your `soloistrc` file to preinstall your
+# license. eg:
+#
+# node_attributes:
+# charles_proxy:
+# license_name: Your Name
+# license_key: 7ad6c7a6c87...
+
+remote_file "#{Chef::Config[:file_cache_path]}/charles_proxy.zip" do
+ source node["charles_proxy"]["download_uri"]
+ owner WS_USER
+ checksum node["charles_proxy"]["sha"]
+ not_if { File.exists?("#{Chef::Config[:file_cache_path]}/charles_proxy.zip") }
+end
+
+execute "unzip charles_proxy" do
+ command "unzip #{Chef::Config[:file_cache_path]}/charles_proxy.zip -d #{Chef::Config[:file_cache_path]}/"
+ user WS_USER
+ not_if { File.exists?("#{Chef::Config[:file_cache_path]}/Charles.app") }
+end
+
+execute "copy charles_proxy to /Applications" do
+ command "mv #{Chef::Config[:file_cache_path]}/Charles.app #{Regexp.escape(node["charles_proxy"]["app_path"])}"
+ user WS_USER
+ group "admin"
+ not_if { File.exists?(node["charles_proxy"]["app_path"]) }
+end
+
+template node["charles_proxy"]["config_path"] do
+ source "com.xk72.charles.config.erb"
+ cookbook 'pivotal_workstation'
+ owner WS_USER
+ mode "0777"
+ not_if { File.exists?(node["charles_proxy"]["config_path"]) || node["charles_proxy"]["license_key"] == nil || node["charles_proxy"]["license_name"] == nil }
+end
+
+ruby_block "test to see if Charles.app was installed" do
+ block do
+ raise "Charles.app was not installed" unless File.exists?(node["charles_proxy"]["app_path"])
+ end
+end
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<java version="1.6.0_37" class="java.beans.XMLDecoder">
+ <object class="com.xk72.charles.config.CharlesConfiguration">
+ <void property="registrationConfiguration">
+ <void property="key">
+ <string><%= node['charles_proxy']['license_key'] %></string>
+ </void>
+ <void property="name">
+ <string><%= node['charles_proxy']['license_name'] %></string>
+ </void>
+ </void>
+ <void property="startupConfiguration">
+ <void property="lastCheckUpdates">
+ <object class="java.util.Date">
+ <long>1359896490377</long>
+ </object>
+ </void>
+ <void property="mainWindow">
+ <object class="java.awt.Rectangle">
+ <int>499</int>
+ <int>98</int>
+ <int>600</int>
+ <int>440</int>
+ </object>
+ </void>
+ </void>
+ <void property="toolConfiguration">
+ <void property="configs">
+ <void method="put">
+ <string>Map Remote</string>
+ <object class="com.xk72.charles.tools.MapTool$MapConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Auto Save</string>
+ <object class="com.xk72.charles.tools.AutoSaveTool$AutoSaveConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Reverse Proxies</string>
+ <object class="com.xk72.charles.tools.ReverseProxiesTool$ReverseProxiesConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Block Cookies</string>
+ <object class="com.xk72.charles.tools.lib.SelectedHostsToolConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Mirror</string>
+ <object class="com.xk72.charles.tools.MirrorTool$MirrorConfiguration"/>
+ </void>
+ <void method="put">
+ <string>DNS Spoofing</string>
+ <object class="com.xk72.charles.tools.DNSSpoofingTool$DNSSpoofingConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Port Forwarding</string>
+ <object class="com.xk72.charles.tools.PortForwardingTool$PortForwardingConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Breakpoints</string>
+ <object class="com.xk72.charles.tools.breakpoints.BreakpointsTool$BreakpointsConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Client Process</string>
+ <object class="com.xk72.charles.tools.lib.SelectedHostsToolConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Rewrite</string>
+ <object class="com.xk72.charles.tools.rewrite.RewriteConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Map Local</string>
+ <object class="com.xk72.charles.tools.MapLocalTool$MapLocalConfiguration"/>
+ </void>
+ <void method="put">
+ <string>Black List</string>
+ <object class="com.xk72.charles.tools.BlacklistTool$BlacklistConfiguration"/>
+ </void>
+ <void method="put">
+ <string>No Caching</string>
+ <object class="com.xk72.charles.tools.lib.SelectedHostsToolConfiguration"/>
+ </void>
+ </void>
+ </void>
+ </object>
+</java>

0 comments on commit cc2ebf7

Please sign in to comment.