diff --git a/bootstrap.sh b/bootstrap.sh index e6e6332..54bf8f1 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -13,13 +13,15 @@ function generate { } # define variables -PROJECTS_PATH=$1 -PROJECT_NAME=$2 -PROJECT_NAME_WITH_PREFIX=$2-ios -COMMON_REPO_NAME=${3:-$2-common} -DEPLOYMENT_TARGET="12.0" -CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) -TEMPLATES=$CURRENT_DIR/templates +readonly PROJECTS_PATH=$1 +readonly PROJECT_NAME=$2 +readonly PROJECT_NAME_WITH_PREFIX=$2-ios +readonly COMMON_REPO_NAME=${3:-$2-common} +readonly DEPLOYMENT_TARGET="12.0" +readonly CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) +readonly TEMPLATES=$CURRENT_DIR/templates +readonly MATCH_PASSWORD=`pwgen 8 1` +readonly GIT_URL="git@github.com:TouchInstinct/${PROJECT_NAME_WITH_PREFIX}.git" cd $PROJECTS_PATH @@ -35,7 +37,7 @@ rm -rf $(ls) # create git if not exists if [ ! -d .git ]; then git init - git remote add origin git@github.com:TouchInstinct/$PROJECT_NAME_WITH_PREFIX.git + git remote add origin ${GIT_URL} git fetch git checkout -t origin/master else @@ -70,18 +72,18 @@ brew bundle generate "{project_name: $PROJECT_NAME}" $TEMPLATES/Info.mustache $PROJECT_NAME/Info.plist # generate services -DATE_SERVICE_NAME="DateFormattingService" +readonly DATE_SERVICE_NAME="DateFormattingService" generate "{project_name: $PROJECT_NAME}" $TEMPLATES/dateformatservice.mustache $PROJECT_NAME/Services/"$PROJECT_NAME$DATE_SERVICE_NAME".swift -NUMBER_SERVICE_NAME="NumberFormattingService" +readonly NUMBER_SERVICE_NAME="NumberFormattingService" generate "{project_name: $PROJECT_NAME}" $TEMPLATES/numberformatservice.mustache $PROJECT_NAME/Services/"$PROJECT_NAME$NUMBER_SERVICE_NAME".swift -TABLE_CONTENT_CONTROLLER_NAME="TableContentController" +readonly TABLE_CONTENT_CONTROLLER_NAME="TableContentController" generate "{project_name: $PROJECT_NAME}" $TEMPLATES/tablecontentcontroller.mustache $PROJECT_NAME/Controllers/"$PROJECT_NAME$TABLE_CONTENT_CONTROLLER_NAME".swift # generate file for generate xcodeproj -LOWERCASED_PROJECT_NAME=$(echo "$PROJECT_NAME" | tr '[:upper:]' '[:lower:]') +readonly LOWERCASED_PROJECT_NAME=$(echo "$PROJECT_NAME" | tr '[:upper:]' '[:lower:]') generate "{project_name: $PROJECT_NAME, deployment_target: $DEPLOYMENT_TARGET, project_name_lowecased: $LOWERCASED_PROJECT_NAME}" \ $TEMPLATES/project.mustache \ project.yml @@ -103,6 +105,12 @@ bundle exec pod install --repo-update cp $TEMPLATES/gitignore .gitignore cp $TEMPLATES/gitattributes .gitattributes +# configure fastlane + +generate "{git_url: \"$GIT_URL\", match_password: $MATCH_PASSWORD}" $TEMPLATES/fastlane/Matchfile.mustache fastlane/Matchfile + +generate "{project_name: $PROJECT_NAME, project_name_lowecased: $LOWERCASED_PROJECT_NAME}" $TEMPLATES/fastlane/configurations.yaml.mustache fastlane/configurations.yaml + # configure rambafile generate "{project_name: $PROJECT_NAME}" $TEMPLATES/Rambafile.mustache Rambafile bundle exec generamba template install diff --git a/templates/fastlane/Matchfile.mustache b/templates/fastlane/Matchfile.mustache new file mode 100644 index 0000000..74cc4aa --- /dev/null +++ b/templates/fastlane/Matchfile.mustache @@ -0,0 +1,2 @@ +git_url "{{git_url}}" +ENV["MATCH_PASSWORD"] = "{{match_password}}" \ No newline at end of file diff --git a/templates/fastlane/configurations.yaml.mustache b/templates/fastlane/configurations.yaml.mustache new file mode 100644 index 0000000..bb8beed --- /dev/null +++ b/templates/fastlane/configurations.yaml.mustache @@ -0,0 +1,24 @@ +targets: + {{project_name}}: + development: + PROVISIONING_PROFILE_SPECIFIER: "match Development ru.touchin.{{project_name_lowecased}}" + PRODUCT_BUNDLE_IDENTIFIER: "ru.touchin.{{project_name_lowecased}}" + enterprise: + PROVISIONING_PROFILE_SPECIFIER: "match InHouse com.touchin.{{project_name_lowecased}}" + PRODUCT_BUNDLE_IDENTIFIER: "com.touchin.{{project_name_lowecased}}" + appstore: + PROVISIONING_PROFILE_SPECIFIER: "***" + PRODUCT_BUNDLE_IDENTIFIER: "***" + +types: + development: + apple_id: "apple@touchin.ru" + team_id: "D4HA43V467" + itc_team_id: "1426360" + enterprise: + apple_id: "enterpriseapple@touchin.ru" + team_id: "228J5MMU7S" + appstore: + apple_id: "apple@touchin.ru" + team_id: "***" + itc_team_id: "***" \ No newline at end of file