fastlane-plugin-android_versioning 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6333c5aac52eaaedce5f2d2fe5b225dddb30a27
4
- data.tar.gz: 238cee201f9cade2f8bb356f9ee934588279a9c8
3
+ metadata.gz: d69aa075985bc7879e590de538aef6063ba89cc5
4
+ data.tar.gz: 45154aef31fc58000c3a6da179aabe80b50565b4
5
5
  SHA512:
6
- metadata.gz: 2ea2e3cb881d543fd4f789078d797b07cf4043ffcff3ba8934a45636694a0ac96248110840174e4d3f4873b50e26c8bf085b5419286d0f45e121e788e4b24cd6
7
- data.tar.gz: eda795b415b473fcee2ecc76c6c8f47517c70b1f3957c11dad5bb8e75373149436a19d96f5119510f455ac02a6d89ae3b971d2109359261543b2390c2e5b0f2f
6
+ metadata.gz: f7b510ff63b91377749d67e85e99b7e12db28320a95329006b7fcc7e9d71af3b8303c4ac07b3de17a530c71a51ff67ee3533464415f9e682d9dc21bbc53e86ed
7
+ data.tar.gz: 76cb8de30f33c41ba9a90fc06233315b7b1c00f7c36ee8707c085c7ed7f1db2289a3a6602b905927d235b070dfd5ae8bc127a52bd33ad2e19cd46548b7476240
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-android_versioning)
4
4
  [![Gem Version](https://badge.fury.io/rb/fastlane-plugin-android_versioning.svg)](https://badge.fury.io/rb/fastlane-plugin-android_versioning)
5
+ [![CircleCI](https://circleci.com/gh/otkmnb2783/fastlane-plugin-android_versioning.svg?style=svg)](https://circleci.com/gh/otkmnb2783/fastlane-plugin-android_versioning)
5
6
 
6
7
  ## Getting Started
7
8
 
@@ -19,7 +20,7 @@ Allows to set/get app version name and version code directly to/from build.gradl
19
20
 
20
21
  ## Example
21
22
 
22
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
23
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane show_version`.
23
24
 
24
25
  **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
25
26
 
@@ -5,17 +5,17 @@ module Fastlane
5
5
  class GetValueFromBuildAction < Action
6
6
  def self.run(params)
7
7
  app_project_dir ||= params[:app_project_dir]
8
+ regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/)
8
9
  value = ""
9
10
  found = false
10
11
  Dir.glob("#{app_project_dir}/build.gradle") do |path|
11
12
  begin
12
13
  File.open(path, 'r') do |file|
13
14
  file.each_line do |line|
14
- unless line.include? "#{params[:key]} " and !found
15
+ unless line.match(regex) and !found
15
16
  next
16
17
  end
17
- components = line.strip.split(' ').reject { |item| item.start_with?("//") }
18
- value = components.last.tr("\"", "").tr("\'", "")
18
+ key, left, value, right, comment = line.match(regex).captures
19
19
  break
20
20
  end
21
21
  file.close
@@ -6,19 +6,18 @@ module Fastlane
6
6
  class SetValueInBuildAction < Action
7
7
  def self.run(params)
8
8
  app_project_dir ||= params[:app_project_dir]
9
+ regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/)
9
10
  found = false
10
11
  Dir.glob("#{app_project_dir}/build.gradle") do |path|
11
12
  begin
12
13
  temp_file = Tempfile.new('versioning')
13
14
  File.open(path, 'r') do |file|
14
15
  file.each_line do |line|
15
- unless line.include? "#{params[:key]} " and !found
16
+ unless line.match(regex) and !found
16
17
  temp_file.puts line
17
18
  next
18
19
  end
19
- components = line.strip.split(' ')
20
- value = components.last.tr("\"", "").tr("\'", "")
21
- line.replace line.sub(value, params[:value].to_s)
20
+ line = line.gsub regex, "\\k<key>\\k<left>#{params[:value]}\\k<right>\\k<comment>"
22
21
  found = true
23
22
  temp_file.puts line
24
23
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AndroidVersioning
3
- VERSION = "0.3.1"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-android_versioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu OHTAKE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-11 00:00:00.000000000 Z
11
+ date: 2018-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  requirements: []
132
132
  rubyforge_project:
133
- rubygems_version: 2.4.5.1
133
+ rubygems_version: 2.6.14.1
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Allows to set/get app version name and version code directly to/from build.gradle