Dr0ptp4kt has submitted this change and it was merged.

Change subject: add Makefile
......................................................................


add Makefile

run `make help` to see a list of targets.

Change-Id: Ifa1ecb652bed0abf3f946a070b5b1cc8648c79fd
---
A Makefile
M README.md
M scripts/uncrustify_all.sh
3 files changed, 127 insertions(+), 35 deletions(-)

Approvals:
  Dr0ptp4kt: Verified; Looks good to me, approved
  Fjalapeno: Looks good to me, but someone else must approve



diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1cdc793
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,114 @@
+XCODE_VERSION = "$(shell xcodebuild -version 2>/dev/null)"
+XC_WORKSPACE = Wikipedia.xcworkspace
+XCODEBUILD_BASE_ARGS = -workspace $(XC_WORKSPACE)
+
+help: ##Show this help
+       @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | 
sed -e 's/##//'
+
+clean: ##Clean the Xcode workspace
+       xcodebuild clean $(XCODEBUILD_BASE_ARGS)
+
+build: ##Fetch code dependencies and build the app for release
+build: get-deps
+       xcodebuild build $(XCODEBUILD_BASE_ARGS) \
+               -scheme Wikipedia \
+               -sdk iphoneos \
+               -configuration Release
+
+build-sim: ##Fetch code dependencies and build the app for debugging in the 
simulator
+build-sim: get-deps
+       xcodebuild build $(XCODEBUILD_BASE_ARGS) \
+               -scheme Wikipedia \
+               -sdk iphonesimulator \
+               -configuration Debug
+
+test: ##Fetch code dependencies and run tests
+test: get-deps
+       xcodebuild test $(XCODEBUILD_BASE_ARGS) \
+               -scheme Wikipedia \
+               -sdk iphonesimulator
+
+lint: ##Lint the native code, requires uncrustify
+       @scripts/uncrustify_all.sh
+
+get-deps: ##Download third-party components (i.e. CocoaPods and npm packages)
+get-deps: check-deps pod npm
+
+check-deps: ##Make sure system prerequisites are installed
+check-deps: xcode-cltools exec-deps node bundler
+
+#!!!!!
+#!!!!! Xcode dependencies
+#!!!!!
+
+xcode-cltools: ##Make sure proper Xcode & command line tools are installed
+       @case $(XCODE_VERSION) in \
+               "Xcode 6"*) echo "Xcode 6 or higher is installed with command 
line tools!" ;; \
+               *) echo "Missing Xcode 6 or higher and/or the command line 
tools."; exit 1;; \
+       esac
+
+#!!!!!
+#!!!!! Executable dependencies
+#!!!!!
+
+# Append additional dependencies as quoted strings (i.e. EXEC_DEPS = "dep1" 
"dep2" ...)
+EXEC_DEPS = "uncrustify"
+
+exec-deps:  ##Check that executable dependencies are installed
+       @for dep in $(EXEC_DEPS); do \
+               if [[ -x $$(which $${dep}) ]]; then \
+                       echo "$${dep} is installed!"; \
+               else \
+                       echo "Missing executable $${dep}, please make sure it's 
installed on your PATH (e.g. via Homebrew)."; \
+                       exit 1; \
+               fi \
+       done
+
+#!!!!!
+#!!!!! Node dependencies
+#!!!!!
+
+NODE_VERSION = "$(shell node -v)"
+NPM_VERSION = "$(shell npm -version)"
+
+npm: ##TODO, run npm install
+
+node: # Make sure node is installed
+       @if [[ $(NODE_VERSION) =~ "v0.10" && $(NPM_VERSION) =~ "1.4" ]]; then \
+               echo "node and npm are installed!" ; \
+       else \
+               echo "Missing node v0.10 and/or higher and npm 1.4 or higher." 
; \
+               exit 1; \
+       fi
+
+#!!!!!
+#!!!!! Ruby dependencies
+#!!!!!
+
+RUBY_VERSION = "$(shell ruby -v)"
+BUNDLER = "$(shell which bundle)"
+
+pod: ##Install native dependencies via CocoaPods
+pod: bundle-install
+       @$(BUNDLER) exec pod install
+
+bundle-install: ##Install gems using Bundler
+bundle-install: bundler
+       @$(BUNDLER) install
+
+bundler: ##Make sure Bundler is installed
+bundler: ruby
+       @if [[ $(BUNDLER) == "" ]]; then \
+               echo "Missing the Bundler Ruby gem." ; \
+               exit 1 ; \
+       else \
+               echo "Bundler is installed!" ; \
+       fi
+
+ruby: ##Make sure Ruby is installed
+       @if [[ $(RUBY_VERSION) == "" ]]; then \
+               echo "Ruby is missing!" ; \
+               exit 1 ; \
+       else \
+               echo "Ruby is installed!" ; \
+       fi
\ No newline at end of file
diff --git a/README.md b/README.md
index 5d2c833..91a65b2 100644
--- a/README.md
+++ b/README.md
@@ -12,19 +12,11 @@
 * Bugs: https://bugzilla.wikimedia.org/enter_bug.cgi?product=Wikipedia%20App
 * IRC chat: #wikimedia-mobile on irc.freenode.net
 
-# Dependencies
-##  [CocoaPods](cocoapods.org) 
-To manage Objective-C dependencies.  See the `Podfile` for a comprehensive 
list.
-## [npm](https://www.npmjs.com/) 
-Manage web dependencies.  See `www/package.json` for a comprehensive list. 
-## [Grunt](http://gruntjs.com)
-Compile LESS files and other grunt work.
-## [Uncrustify](http://uncrustify.sourceforge.net)
-Code Beautifier
-
 # Setup
-## Prerequisites
-Please make sure the following are installed on your system before trying to 
build the project:
+Many tasks associated with project dependencies or building are implemented in 
the `Makefile`. Run `make` or `make help` to see a list of available tasks (or 
targets). The TL;DR; one liner to sanity check the project's build status is: 
`make build-sim`.  Read on for more information about our dependencies and 
setting up the project.
+
+## Dependencies
+Run `make get-deps` to check for and/or install the following dependencies:
 
 - [Xcode 6 or higher](https://itunes.apple.com/us/app/xcode/id497799835) on 
Mac OS X, available on the App Store or 
[developer.apple.com](https://developer.apple.com/) after signing in with your 
Apple ID.
 - Xcode Command Line Tools: On newer OS X versions, you can run `xcode-select 
--install` to install them.  If that doesn't work, you can find instructions 
online for downloading the them via Xcode or the Apple developer portal.
@@ -32,40 +24,26 @@
 
 > _[rbenv](https://github.com/sstephenson/rbenv) is nice for managing mulitple 
 > Ruby versions._
 
-- CocoaPods: Ruby gem for Objective-C dependency management.
+- [CocoaPods](cocoapods.org) is a Ruby gem that the project uses to download 
and integrate third-party iOS components.
 
-> _[Bundler](http://bundler.io/) is recommended for installing Ruby gems 
without `sudo`._
+> _[Bundler](http://bundler.io/) is recommended for installing CocoaPods, 
along with any other RubyGem dependencies declared in the project's `Gemfile`._
 
-- NodeJS: The web portion of the app is built using [npm](npmjs.com) to 
install node packages and [grunt](http://gruntjs.com) to manage tasks.
+- NodeJS: The web assets which are bundled in the app are built using a Node 
toolchain, specifically [grunt](http://gruntjs.com) which is installed using 
[npm](npmjs.com).
 
 > _[nodenv](https://github.com/OiNutter/nodenv) is recommended for managing 
 > multiple node versions._
 
-- [Uncrustify](http://uncrustify.sourceforge.net) for formatting source code 
to conform to our Style Guide. You can install with homebrew  ```brew install 
uncrustify```
+- [uncrustify](http://uncrustify.sourceforge.net) for formatting source code 
to conform to our [Style 
Guide](https://www.mediawiki.org/wiki/Wikimedia_Apps/Team/iOS/ObjectiveCStyleGuide).
 You can install it using homebrew by running: `brew install uncrustify`.
 
-> _[BBUncrustifyPlugin](https://github.com/benoitsan/BBUncrustifyPlugin-Xcode) 
is an easy way to uncrustify files within the Xcode UI.
+> _[BBUncrustifyPlugin](https://github.com/benoitsan/BBUncrustifyPlugin-Xcode) 
is an easy way to uncrustify files within the Xcode UI._
 
 ## Building
-Once all the dependencies are installed, you'll have to do a couple of things 
before firing up Xcode and running the app:
-
-- Setup CocoaPods
-  - Install the **`cocoapods`** gem
-  - Setup the CocoaPods specs repo by running `pod setup` (prepend `bundle 
exec` as needed)
-  - Install our CocoaPods dependencies by going to the repository's root 
directory and running `pod install` (**not** `pod update`)
-- Setup web components (if you're feeling lucky: `cd www && npm install && 
grunt`)
-  - Go into the `www` directory
-  - Run `npm install` to install our node dependencies
-  - Run `grunt` to generate our web assets
-- Open `Wikipedia.xcworkspace` in Xcode.  _Note the use of `.xcworkspace` 
extension—not `.xcodeproj`_
-- Build the project!
-- Profit! (Just kidding, we're non-profit)
-
-If the build failed, we're _really_ sorry! We'll be more than happy to help 
you if you file a bug and/or bug us via IRC or email. See the top of this file 
for our contact information. Please include any console logs and/or Xcode 
screenshots along with a description of your environment.
+Once all the dependencies are installed (via `make get-deps`), you should be 
able to run `make build-sim`, which compiles the project for the iOS simulator. 
If this step doesn't succeed, please file a bug and/or bug us via IRC or email. 
See the top of this file for our contact information. Please include any 
console logs and/or Xcode screenshots along with a description of your 
environment.
 
 ## Running
-Simply run the **Wikipedia** target for the destination of your choosing (i.e. 
simulator or device). Keep in mind that you'll need to provision any physical 
devices with an active [developer 
account](https://developer.apple.com/devcenter/ios/index.action) in order to 
build and run the app on them.
+Use Xcode to run the **Wikipedia** scheme and target for the destination of 
your choosing (i.e. simulator or device). Keep in mind that you'll need to 
provision iOS hardware with an active [developer 
account](https://developer.apple.com/devcenter/ios/index.action) in order to 
build and run the app on it.
 
 ## Testing
-The unit testing target is configured to build & test under the **Wikipedia** 
scheme. Use the Xcode **Product -> Test** menu-bar action (`Cmd + U` for hotkey 
fanatics) to run them. New unit tests (and their application-code dependencies) 
should be added to the **WikipediaUnitTests** target.
+Use the Xcode **Product -> Test** menu-bar action (or `Cmd + U` for hotkey 
fanatics) to run the **WikipediaUnitTests** target in the **Wikipedia** scheme. 
 Tests can also be executed from the command line by running `make test`.
 
 # Filing Bugs
 Please file bugs at 
[bugzilla.wikimedia.org](https://bugzilla.wikimedia.org/enter_bug.cgi?product=Wikipedia%20App);
 use the "iOS App" component.
diff --git a/scripts/uncrustify_all.sh b/scripts/uncrustify_all.sh
index 10358e1..b2ae753 100755
--- a/scripts/uncrustify_all.sh
+++ b/scripts/uncrustify_all.sh
@@ -33,7 +33,7 @@
 rm "$UNCRUSTIFY_FILELIST"
 
 find . -iname "*unc-backup*" -print0 | xargs -0 rm
-echo "Uncrustification completed.\n"
+echo "Uncrustification completed."
 
 # Should be 0 if no files needed to be uncrustifed.
 exit $NO_FILES_NEEDED_UNCRUSTIFY

-- 
To view, visit https://gerrit.wikimedia.org/r/194257
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifa1ecb652bed0abf3f946a070b5b1cc8648c79fd
Gerrit-PatchSet: 7
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Bgerstle <[email protected]>
Gerrit-Reviewer: Bgerstle <[email protected]>
Gerrit-Reviewer: Dr0ptp4kt <[email protected]>
Gerrit-Reviewer: Fjalapeno <[email protected]>
Gerrit-Reviewer: Mhurd <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to