Browse Source

start a cocoapod. refs #4

Marcus Rohrmoser 5 years ago
parent
commit
166ab74298
7 changed files with 193 additions and 2 deletions
  1. 5 0
      CHANGELOG.md
  2. 0 0
      LICENSE
  3. 26 0
      MROGeometry.podspec
  4. 4 2
      MROGeometry.xcodeproj/project.pbxproj
  5. 0 0
      README.md
  6. 157 0
      Rakefile
  7. 1 0
      VERSION

+ 5 - 0
CHANGELOG.md

@@ -0,0 +1,5 @@
+# MROGeometry CHANGELOG
+
+## 0.1.0
+
+Initial release.

LICENSE.txt → LICENSE


+ 26 - 0
MROGeometry.podspec

@@ -0,0 +1,26 @@
+#
+# Be sure to run `pod lib lint MROGeometry.podspec' to ensure this is a
+# valid spec and remove all comments before submitting the spec.
+#
+# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
+#
+Pod::Spec.new do |s|
+  s.name             = "MROGeometry"
+  s.version          = File.read('VERSION')
+  s.summary          = "C and Objective C math and geometry helpers"
+  s.homepage         = "http://purl.mro.name/ios/MROGeometry"
+  s.license          = 'Human Rights License'
+  s.author           = { "Marcus Rohrmoser" => "mrohrmoser@acm.org" }
+  s.source           = { :git => "https://github.com/mro/MROGeometry.git", :tag => s.version.to_s }
+
+  s.platform     = :ios, '5.0'
+  s.ios.deployment_target = '5.0'
+  s.requires_arc = true
+
+  s.source_files = 'MROGeometry/*.{h,m,c}'
+  s.prefix_header_file = 'MROGeometry/MROGeometry-Prefix.pch'
+
+  s.public_header_files = 'MROGeometry/*CG*.h'
+  # s.frameworks = 'SomeFramework', 'AnotherFramework'
+  # s.dependency 'JSONKit', '~> 1.4'
+end

+ 4 - 2
MROGeometry.xcodeproj/project.pbxproj

@@ -84,10 +84,11 @@
 		1627C7B918BFE26700D0465F /* TrafoParser.rl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TrafoParser.rl; sourceTree = "<group>"; };
 		1627C7CE18BFE2AB00D0465F /* CGPathWriterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGPathWriterTest.m; sourceTree = "<group>"; };
 		1627C7D218BFE70F00D0465F /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
-		1627C7D318BFE70F00D0465F /* README.markdown */ = {isa = PBXFileReference; lastKnownFileType = text; path = README.markdown; sourceTree = "<group>"; };
 		1627C7D418BFEFA600D0465F /* Common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = "<group>"; };
 		1627C7D518BFEFA600D0465F /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
 		1627C7D618BFEFA600D0465F /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
+		1675FF721949C21E00175808 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
+		1675FF731949C41400175808 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
 		16992E8418C0947000701606 /* CGPathWriterTest.PathDataCubicBezierCommands.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CGPathWriterTest.PathDataCubicBezierCommands.svg; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
@@ -117,10 +118,11 @@
 		1627C77518BFE14000D0465F = {
 			isa = PBXGroup;
 			children = (
+				1675FF721949C21E00175808 /* README.md */,
+				1675FF731949C41400175808 /* VERSION */,
 				1627C7D418BFEFA600D0465F /* Common.xcconfig */,
 				1627C7D518BFEFA600D0465F /* Debug.xcconfig */,
 				1627C7D618BFEFA600D0465F /* Release.xcconfig */,
-				1627C7D318BFE70F00D0465F /* README.markdown */,
 				1627C7D218BFE70F00D0465F /* Makefile */,
 				1627C78318BFE14000D0465F /* MROGeometry */,
 				1627C79718BFE14000D0465F /* MROGeometryTests */,

README.markdown → README.md


+ 157 - 0
Rakefile

@@ -0,0 +1,157 @@
+desc "Runs the specs [EMPTY]"
+task :spec do
+  # Provide your own implementation
+end
+
+task :version do
+  git_remotes = `git remote`.strip.split("\n")
+
+  if git_remotes.count > 0
+    puts "-- fetching version number from github"
+    sh 'git fetch'
+
+    remote_version = remote_spec_version
+  end
+
+  if remote_version.nil?
+    puts "There is no current released version. You're about to release a new Pod."
+    version = "0.0.1"
+  else
+    puts "The current released version of your pod is " +
+          remote_spec_version.to_s()
+    version = suggested_version_number
+  end
+
+  puts "Enter the version you want to release (" + version + ") "
+  new_version_number = $stdin.gets.strip
+  if new_version_number == ""
+    new_version_number = version
+  end
+
+  replace_version_number(new_version_number)
+end
+
+desc "Release a new version of the Pod (append repo=name to push to a private spec repo)"
+task :release do
+  # Allow override of spec repo name using `repo=private` after task name
+  repo = ENV["repo"] || "master"
+
+  puts "* Running version"
+  sh "rake version"
+
+  unless ENV['SKIP_CHECKS']
+    if `git symbolic-ref HEAD 2>/dev/null`.strip.split('/').last != 'master'
+      $stderr.puts "[!] You need to be on the `master' branch in order to be able to do a release."
+      exit 1
+    end
+
+    if `git tag`.strip.split("\n").include?(spec_version)
+      $stderr.puts "[!] A tag for version `#{spec_version}' already exists. Change the version in the podspec"
+      exit 1
+    end
+
+    puts "You are about to release `#{spec_version}`, is that correct? [y/n]"
+    exit if $stdin.gets.strip.downcase != 'y'
+  end
+
+  puts "* Running specs"
+  sh "rake spec"
+
+  puts "* Linting the podspec"
+  sh "pod lib lint"
+
+  # Then release
+  sh "git commit #{podspec_path} CHANGELOG.md VERSION -m 'Release #{spec_version}' --allow-empty"
+  sh "git tag -a #{spec_version} -m 'Release #{spec_version}'"
+  sh "git push origin master"
+  sh "git push origin --tags"
+  if repo == "master"
+    sh "pod trunk push #{podspec_path}"
+  else
+    sh "pod repo push #{repo} #{podspec_path}"
+  end
+end
+
+# @return [Pod::Version] The version as reported by the Podspec.
+#
+def spec_version
+  require 'cocoapods'
+  spec = Pod::Specification.from_file(podspec_path)
+  spec.version
+end
+
+# @return [Pod::Version] The version as reported by the Podspec from remote.
+#
+def remote_spec_version
+  require 'cocoapods-core'
+
+  if spec_file_exist_on_remote?
+    remote_spec = eval(`git show origin/master:#{podspec_path}`)
+    remote_spec.version
+  else
+    nil
+  end
+end
+
+# @return [Bool] If the remote repository has a copy of the podpesc file or not.
+#
+def spec_file_exist_on_remote?
+  test_condition = `if git rev-parse --verify --quiet origin/master:#{podspec_path} >/dev/null;
+  then
+  echo 'true'
+  else
+  echo 'false'
+  fi`
+
+  'true' == test_condition.strip
+end
+
+# @return [String] The relative path of the Podspec.
+#
+def podspec_path
+  podspecs = Dir.glob('*.podspec')
+  if podspecs.count == 1
+    podspecs.first
+  else
+    raise "Could not select a podspec"
+  end
+end
+
+# @return [String] The suggested version number based on the local and remote
+#                  version numbers.
+#
+def suggested_version_number
+  if spec_version != remote_spec_version
+    spec_version.to_s()
+  else
+    next_version(spec_version).to_s()
+  end
+end
+
+# @param  [Pod::Version] version
+#         the version for which you need the next version
+#
+# @note   It is computed by bumping the last component of
+#         the version string by 1.
+#
+# @return [Pod::Version] The version that comes next after
+#                        the version supplied.
+#
+def next_version(version)
+  version_components = version.to_s().split(".");
+  last = (version_components.last.to_i() + 1).to_s
+  version_components[-1] = last
+  Pod::Version.new(version_components.join("."))
+end
+
+# @param  [String] new_version_number
+#         the new version number
+#
+# @note   This methods replaces the version number in the podspec file
+#         with a new version number.
+#
+# @return void
+#
+def replace_version_number(new_version_number)
+  File.open('VERSION', "w") { |file| file.puts new_version_number }
+end

+ 1 - 0
VERSION

@@ -0,0 +1 @@
+0.1.0