Skip to content

Commit

Permalink
Option to add --nofetch (#22)
Browse files Browse the repository at this point in the history
* Added cordova_no_fetch option

* Upped version to 1.0.1
  • Loading branch information
pimverlangen authored and Almouro committed Feb 12, 2018
1 parent c20bb60 commit 35ab44c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Which will produce:
| **build_number** | Build Number for iOS and Android | CORDOVA_BUILD_NUMBER | |
| **browserify** | Specifies whether to browserify build or not | CORDOVA_BROWSERIFY | *false* |
| **cordova_prepare** | Specifies whether to run `cordova prepare` before building | CORDOVA_PREPARE | *true* |
| **cordova_no_fetch** | Specifies whether to run `cordova platform add` with `--nofetch` parameter | CORDOVA_NO_FETCH | *false* |

## Run tests for this plugin

Expand Down
21 changes: 17 additions & 4 deletions lib/fastlane/plugin/cordova/actions/cordova_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class CordovaAction < Action
key_password: 'password',
keystore_alias: 'alias',
build_number: 'versionCode',
min_sdk_version: 'gradleArg=-PcdvMinSdkVersion'
min_sdk_version: 'gradleArg=-PcdvMinSdkVersion',
cordova_no_fetch: 'cordovaNoFetch'
}

IOS_ARGS_MAP = {
Expand Down Expand Up @@ -58,9 +59,14 @@ def self.get_ios_args(params)
return self.get_platform_args(params, IOS_ARGS_MAP)
end

def self.check_platform(platform)
def self.check_platform(params)
platform = params[:platform]
if platform && !File.directory?("./platforms/#{platform}")
sh "cordova platform add #{platform}"
if params[:cordova_no_fetch]
sh "cordova platform add #{platform} --nofetch"
else
sh "cordova platform add #{platform}"
end
end
end

Expand Down Expand Up @@ -103,7 +109,7 @@ def self.set_build_paths(is_release)
end

def self.run(params)
self.check_platform(params[:platform])
self.check_platform(params)
self.build(params)
self.set_build_paths(params[:release])
end
Expand Down Expand Up @@ -231,6 +237,13 @@ def self.available_options
description: "Overrides the value of minSdkVersion set in AndroidManifest.xml",
default_value: '',
is_string: false
),
FastlaneCore::ConfigItem.new(
key: :cordova_no_fetch,
env_name: "CORDOVA_NO_FETCH",
description: "Call `cordova platform add` with `--nofetch` parameter",
default_value: false,
is_string: false
)
]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fastlane/plugin/cordova/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Fastlane
module Cordova
VERSION = "1.0.0"
VERSION = "1.0.1"
end
end

0 comments on commit 35ab44c

Please sign in to comment.