Bgerstle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/202649

Change subject: makefile & fastlane follow-on
......................................................................

makefile & fastlane follow-on

- fix some syntax & rebase errors in the Makefile
- add "make" fn to Fastfile which allows make goals to be invoked from
  the Fastfile
- add linting to pre_check fn
- DRY up the Fastfile a bit
- commit some lint fixes

Change-Id: Ic1ffbe0ffc1659a949a727ddd659cf0ee169054e
---
M Makefile
M MediaWikiKit/MediaWikiKit/MWKImage.m
M Wikipedia/C Methods/WMFArticleParsing.m
M Wikipedia/main.m
M fastlane/Fastfile
5 files changed, 61 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia 
refs/changes/49/202649/1

diff --git a/Makefile b/Makefile
index 7e3862f..48f30fd 100644
--- a/Makefile
+++ b/Makefile
@@ -110,20 +110,34 @@
 #!!!!! Web dependency management
 #!!!!!
 
-CSS_ORIGIN = 
"http://bits.wikimedia.org/en.wikipedia.org/load.php?debug=false&lang=en&only=styles&skin=vector&modules=";
+web: ##Make web assets
+web: css grunt
+
+CSS_ORIGIN = 
http://bits.wikimedia.org/en.wikipedia.org/load.php?debug=false&lang=en&only=styles&skin=vector&modules=
 WEB_ASSETS_DIR = "Wikipedia/assets"
 
-cd "Wikipedia/assets/" && {
-    curl -L -f -o 'styles.css'       "${PREFIX}mobile.app.pagestyles.ios"
-    curl -L -f -o 'abusefilter.css'  "${PREFIX}mobile.app.pagestyles.ios"
-    curl -L -f -o 'preview.css'      "${PREFIX}mobile.app.preview"
-}
+define get_css_module
+curl -s -L -o
+endef
 
+css: ##Download latest stylesheets
+       @echo "Downloading CSS assets..."; \
+       mkdir -p $(WEB_ASSETS_DIR); \
+       cd $(WEB_ASSETS_DIR); \
+       $(get_css_module) 'styles.css' "$(CSS_ORIGIN)mobile.app.pagestyles.ios" 
> /dev/null; \
+       $(get_css_module) 'abusefilter.css' 
"$(CSS_ORIGIN)mobile.app.pagestyles.ios" > /dev/null; \
+       $(get_css_module) 'preview.css' "$(CSS_ORIGIN)mobile.app.preview" > 
/dev/null
 
 NODE_VERSION = "$(shell node -v 2>/dev/null)"
 NPM_VERSION = "$(shell npm -version 2>/dev/null)"
 
-npm: ##TODO, run npm install
+grunt: ##Run grunt
+grunt: npm
+       @cd www && grunt && cd ..
+
+npm: ##Install Javascript dependencies
+npm: node-check
+       @cd www && npm install && cd ..
 
 get-node: ##Install node via Homebrew
        brew install node
diff --git a/MediaWikiKit/MediaWikiKit/MWKImage.m 
b/MediaWikiKit/MediaWikiKit/MWKImage.m
index 90b5335..96a0b49 100644
--- a/MediaWikiKit/MediaWikiKit/MWKImage.m
+++ b/MediaWikiKit/MediaWikiKit/MWKImage.m
@@ -206,6 +206,7 @@
 - (MWKImage*)largestCachedVariant {
     return [self.article.images largestImageVariantForURL:self.sourceURL 
cachedOnly:YES];
 }
+
 - (MWKImage*)smallestCachedVariant {
     return [self.article.images smallestImageVariantForURL:self.sourceURL 
cachedOnly:YES];
 }
diff --git a/Wikipedia/C Methods/WMFArticleParsing.m b/Wikipedia/C 
Methods/WMFArticleParsing.m
index 45a286f..8bee6ea 100644
--- a/Wikipedia/C Methods/WMFArticleParsing.m
+++ b/Wikipedia/C Methods/WMFArticleParsing.m
@@ -111,3 +111,4 @@
         [image save];
     }
 }
+
diff --git a/Wikipedia/main.m b/Wikipedia/main.m
index bcaf60f..798ddc4 100644
--- a/Wikipedia/main.m
+++ b/Wikipedia/main.m
@@ -15,3 +15,4 @@
                                  isUnitTesting ? nil : 
NSStringFromClass([AppDelegate class]));
     }
 }
+
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
index c22ed23..d21e0bb 100644
--- a/fastlane/Fastfile
+++ b/fastlane/Fastfile
@@ -4,16 +4,28 @@
 
 ENV['XCODE_WORKSPACE'] = 'Wikipedia.xcworkspace'
 
-before_all do
-  p ENV
-  reset_git_repo :force unless ENV['NO_RESET']
-  ensure_git_status_clean unless ENV['NO_RESET']
-  cocoapods
-  pre_check
+# Returns true if the `NO_RESET` env var is set to 1
+def reset_disabled?
+  ENV['NO_RESET'] == '1'
+end
+
+# Returns true if the `NO_DEPLOY` env var is set to 1
+def deploy_disabled?
+  ENV['NO_DEPLOY'] == '1'
+end
+
+# Runs goals from the project's Makefile, this requires going up to the 
project directory.
+# :args: Additional arguments to be passed to `make`.
+# Returns The result of the `make` command
+def make(args)
+  # Maybe we should write an "uncrustify" fastlane action?...
+  Dir.chdir '..' do
+    sh 'make ' + args
+  end
 end
 
 def pre_check
-
+  make 'lint'
   xctest({
     scheme: 'Wikipedia',
     destination: "platform=iOS Simulator,name=iPhone 6,OS=8.2",
@@ -21,15 +33,24 @@
     report_path: "build/reports/iOS82/report.xml",
     clean: nil
   })
+end
 
+before_all do
+  p ENV
+  unless reset_disabled?
+    reset_git_repo :force
+    ensure_git_status_clean
+  end
+  pre_check
 end
 
 lane :test do
-  
+  # pre_check already being done in before_all
+  # we can put the pre_check impl here if/when fastlane adds support
+  # for inter-lane dependencies
 end
 
 lane :alpha do
-
   # Download the Certificate for signing
   cert
 
@@ -61,7 +82,7 @@
     # verbose: nil, # this means 'Do Verbose'.
   })
 
-  unless ENV['NO_DEPLOY']
+  unless deploy_disabled?
     # Upload the DSYM to Hockey
     hockey({
       api_token: 'c881c19fd8d0401682c4640b7948ef5e',
@@ -106,7 +127,7 @@
     archive: nil
   })
 
-  unless ENV['NO_DEPLOY']
+  unless deploy_disabled?
     # Upload the DSYM to Hockey
     hockey({
       api_token: 'c881c19fd8d0401682c4640b7948ef5e',
@@ -122,16 +143,14 @@
 lane :appstore do
   snapshot
   frameit
-  unless ENV['NO_DEPLOY']
+  unless deploy_disabled?
     deliver :skip_deploy, :force
   end
 end
 
-after_all do |lane|
+# after_all do |lane|
+# end
 
-end
+# error do |lane, exception|
+# end
 
-
-error do |lane, exception|
-  # Something bad happened
-end

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1ffbe0ffc1659a949a727ddd659cf0ee169054e
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Bgerstle <bgers...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to