diff --git a/EasyAbout.podspec b/EasyAbout.podspec new file mode 100644 index 0000000..17fbf0e --- /dev/null +++ b/EasyAbout.podspec @@ -0,0 +1,19 @@ + +Pod::Spec.new do |s| + + s.name = "EasyAbout" + s.version = "1.0.0" + s.summary = "A way to easily add Cocoapod licenses and App Version to your iOS App using the Settings Bundle" + s.homepage = "https://github.com/JARMourato/EasyAbout" + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.author = { "João Mourato" => "joao.armourato@gmail.com" } + s.platform = :ios + s.source = { :git => "https://github.com/JARMourato/EasyAbout.git", :tag => s.version.to_s } + s.preserve_paths = 'README.md', 'settings-script.sh' + s.source_files = 'Placeholder.h' + s.requires_arc = true + s.resource_bundle = { 'Settings' => ['*.plist', '../Pods-acknowledgements.plist'] } + s.prepare_command = 'chmod u+x $(pwd)/settings-script.sh' + +end + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9fc4af1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016 JARMourato + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Placeholder.h b/Placeholder.h new file mode 100644 index 0000000..7a404af --- /dev/null +++ b/Placeholder.h @@ -0,0 +1,5 @@ +// +// Placeholder.h +// +// Dummy file to pass CocoaPods validation. +// diff --git a/Pods-acknowledgements.plist b/Pods-acknowledgements.plist new file mode 120000 index 0000000..c1c9b9d --- /dev/null +++ b/Pods-acknowledgements.plist @@ -0,0 +1 @@ +../Target Support Files/Pods/Pods-acknowledgements.plist \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..97d253c --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +EasyAbout +====================== + +## Install + +Add to podfile : + +```ruby +platform :ios + +pod 'EasyAbout' + +``` + +Add a new run script: + +```ruby +"${SRCROOT}/Pods/EasyAbout/settings-script.sh" +``` + + + +## License + +**EasyAbout** is available under the MIT license. See the [LICENSE](https://github.com/JARMourato/AcknowledgementsBundle/blob/master/LICENSE) file for more info. + + diff --git a/Root.plist b/Root.plist new file mode 100644 index 0000000..dde63eb --- /dev/null +++ b/Root.plist @@ -0,0 +1,33 @@ + + + + + StringsTable + Root + PreferenceSpecifiers + + + Type + PSGroupSpecifier + Title + About + + + Type + PSChildPaneSpecifier + Title + Version + File + Version + + + Type + PSChildPaneSpecifier + Title + Licenses + File + Pods-acknowledgements + + + + diff --git a/Version.plist b/Version.plist new file mode 100644 index 0000000..2ec8cbe --- /dev/null +++ b/Version.plist @@ -0,0 +1,49 @@ + + + + + Title + Version + StringsTable + Version + PreferenceSpecifiers + + + Type + PSGroupSpecifier + Title + Info + + + Type + PSTitleValueSpecifier + Title + Version + Key + CFBundleShortVersionString + DefaultValue + - + + + Type + PSTitleValueSpecifier + Title + Build + Key + CFBundleVersion + DefaultValue + - + + + Type + PSTitleValueSpecifier + Title + Hash + Key + CFBundleHash + DefaultValue + - + + + + diff --git a/settings-script.sh b/settings-script.sh new file mode 100644 index 0000000..74db437 --- /dev/null +++ b/settings-script.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +INFOPLISTPATH="${TARGET_BUILD_DIR}/${EXECUTABLE_NAME}.app/Info.plist" +VERSION_LIST_PATH="${TARGET_BUILD_DIR}/${EXECUTABLE_NAME}.app/Settings.bundle/Version.plist" + +# Location of PlistBuddy +PLISTBUDDY="/usr/libexec/PlistBuddy" + +BUILD_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $INFOPLISTPATH) +BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $INFOPLISTPATH) +# Get the current git commmit hash (first 7 characters of the SHA) +GITREVSHA=$(git --git-dir="${PROJECT_DIR}/.git" --work-tree="${PROJECT_DIR}" rev-parse --short HEAD) + +echo "INFOPLISTPATH = ${INFOPLISTPATH}" +echo "VERSION_LIST_PATH = ${VERSION_LIST_PATH}" +echo "BUILD_VERSION = ${BUILD_VERSION}" +echo "BUILD_NUMBER = ${BUILD_NUMBER}" +echo "GIT SHA = ${GITREVSHA}" + + +# Set the Git hash in the info plist for reference +$PLISTBUDDY -c "Set :PreferenceSpecifiers:1:DefaultValue $BUILD_VERSION" "${VERSION_LIST_PATH}" +$PLISTBUDDY -c "Set :PreferenceSpecifiers:2:DefaultValue $BUILD_NUMBER" "${VERSION_LIST_PATH}" +$PLISTBUDDY -c "Set :PreferenceSpecifiers:3:DefaultValue $GITREVSHA" "${VERSION_LIST_PATH}"