lib/motion/project/sparkle.rb in motion-sparkle-0.0.2 vs lib/motion/project/sparkle.rb in motion-sparkle-0.0.3
- old
+ new
@@ -61,10 +61,26 @@
@config.info_plist['SUPublicDSAKeyFile'] = path_in_resources_folder
end
# File manipulation and certificates
+ def add_to_gitignore
+ @ignorable = ['sparkle/release','sparkle/release/*','sparkle/config/dsa_priv.pem']
+ return unless File.exist?(gitignore_path)
+ File.open(gitignore_path, 'r') do |f|
+ f.each_line do |line|
+ @ignorable.delete(line) if @ignorable.include?(line)
+ end
+ end
+ File.open(gitignore_path, 'a') do |f|
+ @ignorable.each do |i|
+ f << "#{i}\n"
+ end
+ end if @ignorable.any?
+ `cat #{gitignore_path}`
+ end
+
def create_sparkle_folder
create_config_folder
create_release_folder
end
@@ -98,11 +114,11 @@
App.info "Sparkle", "Generated private and public certificates.
Details:
* Private certificate: ./#{private_key_path}
* Public certificate: ./#{public_key_path}
Warning:
-ADD YOUR PRIVATE CERTIFICATE TO YOUR GITIGNORE OR EQUIVALENT AND BACK IT UP!
+ADD YOUR PRIVATE CERTIFICATE TO YOUR `.gitignore` OR EQUIVALENT AND BACK IT UP!
KEEP IT PRIVATE AND SAFE!
If you lose it, your users will be unable to upgrade.
"
end
@@ -116,9 +132,13 @@
"/usr/bin/openssl"
end
def project_path
@project_path ||= Pathname.new(@config.project_dir)
+ end
+
+ def gitignore_path
+ project_path + ".gitignore"
end
def sparkle_release_path
project_path + RELEASE_PATH
end