Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ドッグフーディング用機能開発のススメ

fromkk
November 25, 2016

 ドッグフーディング用機能開発のススメ

チームで開発してると自分の把握してない場所でバグが発生している事がある。そんな時に原因を探す為にアプリの中にGitのブランチを表示させたらどうかという提案です。

fromkk

November 25, 2016
Tweet

More Decks by fromkk

Other Decks in Technology

Transcript

  1. खॱ • Xcode಺ʹ Branch.plist ͱ͍͏ϑΝΠϧΛ࡞੒ • Edit Scheme ʹҠಈ •

    εΩʔϜΛ Shared ʹมߋ • Build -> Pre Actions ΛΫϦοΫ • ϏϧυλʔήοτΛ Provide build setting from *** ʹมߋ • Scheme/Build/Pre-actions/Run Script ʹ࣍ͷίʔυΛ௥Ճ ※ https://github.com/fromkk/GitBranchName ʹαϯϓϧΛΞοϓ͍ͯ͠·͢ʂ (C) fromkk. 2016 9
  2. खॱ branch="master" if [ ! -z "${CIRCLE_BRANCH+x}" ]; then branch=$CIRCLE_BRANCH

    elif [ ! -z "${TRAVIS_BRANCH+x}" ]; then branch=$TRAVIS_BRANCH elif [ ! -z "${BITRISE_GIT_BRANCH+x}" ]; then branch=$BITRISE_GIT_BRANCH else git_path=$(which git) if [ -e $git_path ]; then branch=$($git_path --git-dir=$PROJECT_DIR/.git rev-parse --abbrev-ref HEAD) fi fi plistName=$PROJECT_DIR/Branch plistPath=$plistName.plist if [ ! -e $plistPath ]; then touch $plistPath fi chmod u+wr,g+wr,o+r $plistPath defaults write $plistName "branch" $branch (C) fromkk. 2016 10
  3. खॱ struct Branch { private enum Constants { static let

    defaultBranch: String = "master" static let plistFileName: String = "Branch" static let branchNameKey: String = "branch" } static var current: String { guard let path: String = Bundle.main.path(forResource: Constants.plistFileName, ofType: "plist") else { return Constants.defaultBranch } guard let plist: [String: String] = NSDictionary(contentsOfFile: path) as? [String: String] else { return Constants.defaultBranch } return plist[Constants.branchNameKey] ?? Constants.defaultBranch } } let branch: String = Branch.current (C) fromkk. 2016 12