fastlane-plugin-gs_versioning 0.2.2 → 0.3.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: 627606e876c8ac81211f1923a920149544c8c93a
4
- data.tar.gz: 1e53aee29e9f0d46b81b9e228bf14331b7026570
3
+ metadata.gz: 1ab7f4a9482544f4db952eca2bde1a7108bccf89
4
+ data.tar.gz: 0aabb04ff31727ada399b5735586432e08bd7be3
5
5
  SHA512:
6
- metadata.gz: 0629eea388be5e979061781dfa18e90140be7a5eba1c6b2a74f40702a04ad30e267c973dbb71ca4d6dbe258401dfdbaab11afb26e97b1d06ea5c8a0dce97635c
7
- data.tar.gz: e001ffaa77fba5c470ea51a3c69c663da76b1721059ae8fa9e49c4b9ecc6f36cc7d8088b0f74e740237eddc266153c3afa494ceec2469e2ee413bc86f91a256a
6
+ metadata.gz: 0e36ac3b0e14f7a1b8e7c025f411e698defaca5938151c36c039c52990451c33d2d5ce1ebeebf5995b8f825e71d86a6aa5ad4352c77a6dd38288f551ee21e6f5
7
+ data.tar.gz: d8bb132a31627f35328f64fa56c4cb9f4e68bc293a47066ed2440f78d3f4e2d82f71beb1b88c19fc13df83ed097c4df854eeb4908169db7cef3e0f2e42b09777
@@ -3,43 +3,46 @@ module Fastlane
3
3
  class GsGetBetaVersionAction < Action
4
4
  def self.run(params)
5
5
  require 'json'
6
- jsonstr = FileHelper.read(params[:path]) #TODO: впилить проверку если не указан путь
7
- # UI.message(params[:path])
8
- UI.message(jsonstr)
9
- json = JSON.parse(jsonstr)
10
- v = Version.parse(json[params[:project_name]])
6
+ v = GSVersionApiProvider.getVersion(params[:project_name])
7
+ if v.nil?
8
+ jsonstr = FileHelper.read(params[:path]) # TODO: впилить проверку если не указан путь
9
+ UI.error('USING LOCAL JSON FILE!!!')
10
+ UI.message(jsonstr)
11
+ json = JSON.parse(jsonstr)
12
+ v = Version.parse(json[params[:project_name]])
13
+ end
11
14
  v["beta"]
12
15
  end
13
16
 
14
-
15
17
  def self.description
16
- "Plugin for GradoService versioning system"
18
+ 'Plugin for GradoService versioning system'
17
19
  end
18
20
 
19
21
  def self.authors
20
- ["SAVeselovskiy"]
22
+ ['SAVeselovskiy']
21
23
  end
24
+
22
25
  def self.return_value
23
26
  # If your method provides a return value, you can describe here what it does
24
27
  end
25
28
 
26
29
  def self.details
27
30
  # Optional:
28
- "Plugin for GradoService versioning system"
31
+ 'Plugin for GradoService versioning system'
29
32
  end
30
33
 
31
34
  def self.available_options
32
35
  [
33
- FastlaneCore::ConfigItem.new(key: :path,
34
- env_name: "GS_VERSIONS_FILE_PATH",
35
- description: "path to versions file",
36
- optional: false,
37
- type: String),
38
- FastlaneCore::ConfigItem.new(key: :project_name,
39
- env_name: "ALIAS",
40
- description: "project name for versions file access",
41
- optional: false,
42
- type: String)
36
+ FastlaneCore::ConfigItem.new(key: :path,
37
+ env_name: "GS_VERSIONS_FILE_PATH",
38
+ description: "path to versions file",
39
+ optional: false,
40
+ type: String),
41
+ FastlaneCore::ConfigItem.new(key: :project_name,
42
+ env_name: "ALIAS",
43
+ description: "project name for versions file access",
44
+ optional: false,
45
+ type: String)
43
46
  ]
44
47
  end
45
48
 
@@ -3,10 +3,14 @@ module Fastlane
3
3
  class GsGetRcVersionAction < Action
4
4
  def self.run(params)
5
5
  require 'json'
6
- jsonstr = FileHelper.read(params[:path]) #TODO: впилить проверку если не указан путь
7
- UI.message(jsonstr)
8
- json = JSON.parse(jsonstr)
9
- v = Version.parse(json[params[:project_name]])
6
+ v = GSVersionApiProvider.getVersion(params[:project_name])
7
+ if v.nil?
8
+ jsonstr = FileHelper.read(params[:path]) # TODO: впилить проверку если не указан путь
9
+ UI.error('USING LOCAL JSON FILE!!!')
10
+ UI.message(jsonstr)
11
+ json = JSON.parse(jsonstr)
12
+ v = Version.parse(json[params[:project_name]])
13
+ end
10
14
  v["rc"]
11
15
  end
12
16
 
@@ -17,6 +21,7 @@ module Fastlane
17
21
  def self.authors
18
22
  ["SAVeselovskiy"]
19
23
  end
24
+
20
25
  def self.return_value
21
26
  # If your method provides a return value, you can describe here what it does
22
27
  end
@@ -28,16 +33,16 @@ module Fastlane
28
33
 
29
34
  def self.available_options
30
35
  [
31
- FastlaneCore::ConfigItem.new(key: :path,
32
- env_name: "GS_VERSIONS_FILE_PATH",
33
- description: "path to versions file",
34
- optional: false,
35
- type: String),
36
- FastlaneCore::ConfigItem.new(key: :project_name,
37
- env_name: "ALIAS",
38
- description: "project name for versions file access",
39
- optional: false,
40
- type: String)
36
+ FastlaneCore::ConfigItem.new(key: :path,
37
+ env_name: "GS_VERSIONS_FILE_PATH",
38
+ description: "path to versions file",
39
+ optional: false,
40
+ type: String),
41
+ FastlaneCore::ConfigItem.new(key: :project_name,
42
+ env_name: "ALIAS",
43
+ description: "project name for versions file access",
44
+ optional: false,
45
+ type: String)
41
46
  ]
42
47
  end
43
48
 
@@ -3,10 +3,14 @@ module Fastlane
3
3
  class GsGetReleaseVersionAction < Action
4
4
  def self.run(params)
5
5
  require 'json'
6
- jsonstr = FileHelper.read(params[:path]) #TODO: впилить проверку если не указан путь
7
- UI.message(jsonstr)
8
- json = JSON.parse(jsonstr)
9
- v = Version.parse(json[params[:project_name]])
6
+ v = GSVersionApiProvider.getVersion(params[:project_name])
7
+ if v.nil?
8
+ jsonstr = FileHelper.read(params[:path]) # TODO: впилить проверку если не указан путь
9
+ UI.error('USING LOCAL JSON FILE!!!')
10
+ UI.message(jsonstr)
11
+ json = JSON.parse(jsonstr)
12
+ v = Version.parse(json[params[:project_name]])
13
+ end
10
14
  v["release"]
11
15
  end
12
16
 
@@ -17,6 +21,7 @@ module Fastlane
17
21
  def self.authors
18
22
  ["SAVeselovskiy"]
19
23
  end
24
+
20
25
  def self.return_value
21
26
  # If your method provides a return value, you can describe here what it does
22
27
  end
@@ -28,16 +33,16 @@ module Fastlane
28
33
 
29
34
  def self.available_options
30
35
  [
31
- FastlaneCore::ConfigItem.new(key: :path,
32
- env_name: "GS_VERSIONS_FILE_PATH",
33
- description: "path to versions file",
34
- optional: false,
35
- type: String),
36
- FastlaneCore::ConfigItem.new(key: :project_name,
37
- env_name: "ALIAS",
38
- description: "project name for versions file access",
39
- optional: false,
40
- type: String)
36
+ FastlaneCore::ConfigItem.new(key: :path,
37
+ env_name: "GS_VERSIONS_FILE_PATH",
38
+ description: "path to versions file",
39
+ optional: false,
40
+ type: String),
41
+ FastlaneCore::ConfigItem.new(key: :project_name,
42
+ env_name: "ALIAS",
43
+ description: "project name for versions file access",
44
+ optional: false,
45
+ type: String)
41
46
  ]
42
47
  end
43
48
 
@@ -1,52 +1,5 @@
1
1
  module Fastlane
2
2
  module Actions
3
- class Version
4
- attr_accessor :minor, :major, :build
5
-
6
- def initialize(major, minor, build)
7
- # assign instance avriables
8
- @major, @minor, @build = major,minor,build
9
- end
10
- def self.parse(parsed)
11
- #TODO: впилить проверку на правильный формат
12
- {"beta" => self.parse_beta(parsed), "rc" => self.parse_rc(parsed),"release" => self.parse_release(parsed)}
13
- end
14
- def to_s
15
- self.major.to_s + "." + self.minor.to_s + "." + self.build.to_s
16
- end
17
- def self.parse_beta(parsed)
18
- beta_version = parsed["beta"]
19
- self.parse_string(beta_version)
20
- end
21
- def self.parse_rc(parsed)
22
- rc_version = parsed["rc"]
23
- self.parse_string(rc_version)
24
- end
25
- def self.parse_release(parsed)
26
- release_version = parsed["release"]
27
- self.parse_string(release_version)
28
- end
29
- def self.parse_string(str)
30
- v_elements = str.split(pattern='.')
31
- build_value = v_elements[1].split(pattern='(')[1].split(pattern=')')[0]
32
- Version.new(v_elements[0].to_i,v_elements[1].to_i,build_value.to_i)
33
- end
34
- def <= (other)
35
- if @major < other.major
36
- return true
37
- elsif @major == other.major && @minor < other.minor
38
- return true
39
- elsif @major == other.major && @minor == other.minor && @build < other.build
40
- return true
41
- elsif @major == other.major && @minor == other.minor && @build == other.build
42
- return true
43
- end
44
- false
45
- end
46
- def toString
47
- res = @major.to_s + '.' + @minor.to_s + '(' + @build.to_s + ')'
48
- end
49
- end
50
3
  class FileHelper
51
4
  def self.read(path)
52
5
  file = File.open(path, "r+")
@@ -54,6 +7,7 @@ module Fastlane
54
7
  file.close
55
8
  res
56
9
  end
10
+
57
11
  def self.write(path, str)
58
12
  file = File.open(path, "w+")
59
13
  file.write(str)
@@ -63,11 +17,8 @@ module Fastlane
63
17
  class GsIncrementBetaVersionAction < Action
64
18
  def self.run(params)
65
19
  require 'json'
66
- require 'fastlane/plugin/versioning/actions/get_version_number_from_plist'
67
- jsonstr = FileHelper.read(params[:path]) #TODO: впилить проверку если не указан путь
68
- json = JSON.parse(jsonstr)
69
- UI.message(json[params[:project_name]])
70
- v = Version.parse(json[params[:project_name]])
20
+ require 'gs_get_beta_version'
21
+ v = Fastlane::Actions::GsGetBetaVersionAction.run(params)
71
22
  if v["rc"].major > v["beta"].major || (v["rc"].minor > v["beta"].minor && v["rc"].major == v["beta"].major)
72
23
  v["beta"].minor = v["rc"].minor
73
24
  v["beta"].major = v["rc"].major
@@ -98,10 +49,10 @@ module Fastlane
98
49
  def self.available_options
99
50
  [
100
51
  FastlaneCore::ConfigItem.new(key: :path,
101
- env_name: "GS_VERSIONS_FILE_PATH",
102
- description: "path to versions file",
103
- optional: false,
104
- type: String),
52
+ env_name: "GS_VERSIONS_FILE_PATH",
53
+ description: "path to versions file",
54
+ optional: false,
55
+ type: String),
105
56
  FastlaneCore::ConfigItem.new(key: :project_name,
106
57
  env_name: "ALIAS",
107
58
  description: "project name for versions file access",
@@ -3,13 +3,9 @@ module Fastlane
3
3
  class GsIncrementRcVersionAction < Action
4
4
  def self.run(params)
5
5
  require 'json'
6
- require 'fastlane/plugin/versioning/actions/get_version_number_from_plist'
7
- jsonstr = FileHelper.read(params[:path]) #TODO: впилить проверку если не указан путь
8
- UI.message(jsonstr)
9
- json = JSON.parse(jsonstr)
10
- v = Version.parse(json[params[:project_name]])
11
-
12
- build = GetVersionNumberFromPlistAction.run(xcodeproj:ENV["xcodeproj"], target:ENV["target"])
6
+ require 'gs_get_rc_version'
7
+ v = Fastlane::Actions::GsGetRcVersionAction.run(params)
8
+ build = GetVersionNumberFromPlistAction.run(xcodeproj: ENV["xcodeproj"], target: ENV["target"])
13
9
  major = build.split('.')[0].to_i
14
10
  if major > v["rc"].major
15
11
  v["rc"].major = major
@@ -20,7 +16,7 @@ module Fastlane
20
16
  elsif v["release"].major < v["rc"].major || v["release"].minor < v["rc"].minor
21
17
  v["rc"].build += 1
22
18
  else
23
- v["rc"].minor +=1
19
+ v["rc"].minor += 1
24
20
  v["rc"].build = 1
25
21
  end
26
22
  res = v["rc"].toString
@@ -35,6 +31,7 @@ module Fastlane
35
31
  def self.authors
36
32
  ["SAVeselovskiy"]
37
33
  end
34
+
38
35
  def self.return_value
39
36
  # If your method provides a return value, you can describe here what it does
40
37
  end
@@ -46,16 +43,16 @@ module Fastlane
46
43
 
47
44
  def self.available_options
48
45
  [
49
- FastlaneCore::ConfigItem.new(key: :path,
50
- env_name: "GS_VERSIONS_FILE_PATH",
51
- description: "path to versions file",
52
- optional: false,
53
- type: String),
54
- FastlaneCore::ConfigItem.new(key: :project_name,
55
- env_name: "ALIAS",
56
- description: "project name for versions file access",
57
- optional: false,
58
- type: String)
46
+ FastlaneCore::ConfigItem.new(key: :path,
47
+ env_name: "GS_VERSIONS_FILE_PATH",
48
+ description: "path to versions file",
49
+ optional: false,
50
+ type: String),
51
+ FastlaneCore::ConfigItem.new(key: :project_name,
52
+ env_name: "ALIAS",
53
+ description: "project name for versions file access",
54
+ optional: false,
55
+ type: String)
59
56
  ]
60
57
  end
61
58
 
@@ -3,12 +3,8 @@ module Fastlane
3
3
  class GsIncrementReleaseVersionAction < Action
4
4
  def self.run(params)
5
5
  require 'json'
6
- require 'fastlane/plugin/versioning/actions/get_version_number_from_plist'
7
- jsonstr = FileHelper.read(params[:path]) #TODO: впилить проверку если не указан путь
8
- UI.message(jsonstr)
9
- json = JSON.parse(jsonstr)
10
- v = Version.parse(json[params[:project_name]])
11
-
6
+ require 'gs_get_release_version'
7
+ v = Fastlane::Actions::GsGetReleaseVersionAction.run(params)
12
8
  if v["rc"] <= v["release"]
13
9
  raise "Release candidate version lower than release version. You have to send release candidate version
14
10
  on TestFlight and test it first. After that you can send version to review."
@@ -16,7 +12,6 @@ on TestFlight and test it first. After that you can send version to review."
16
12
  v["release"] = v["rc"]
17
13
  end
18
14
 
19
-
20
15
  res = v["release"].toString
21
16
  UI.message("New relese version " + res)
22
17
  v["release"]
@@ -29,6 +24,7 @@ on TestFlight and test it first. After that you can send version to review."
29
24
  def self.authors
30
25
  ["SAVeselovskiy"]
31
26
  end
27
+
32
28
  def self.return_value
33
29
  # If your method provides a return value, you can describe here what it does
34
30
  end
@@ -40,16 +36,16 @@ on TestFlight and test it first. After that you can send version to review."
40
36
 
41
37
  def self.available_options
42
38
  [
43
- FastlaneCore::ConfigItem.new(key: :path,
44
- env_name: "GS_VERSIONS_FILE_PATH",
45
- description: "path to versions file",
46
- optional: false,
47
- type: String),
48
- FastlaneCore::ConfigItem.new(key: :project_name,
49
- env_name: "ALIAS",
50
- description: "project name for versions file access",
51
- optional: false,
52
- type: String)
39
+ FastlaneCore::ConfigItem.new(key: :path,
40
+ env_name: "GS_VERSIONS_FILE_PATH",
41
+ description: "path to versions file",
42
+ optional: false,
43
+ type: String),
44
+ FastlaneCore::ConfigItem.new(key: :project_name,
45
+ env_name: "ALIAS",
46
+ description: "project name for versions file access",
47
+ optional: false,
48
+ type: String)
53
49
  ]
54
50
  end
55
51
 
@@ -7,6 +7,7 @@ module Fastlane
7
7
  file.close
8
8
  res
9
9
  end
10
+
10
11
  def self.write(path, str)
11
12
  file = File.open(path, "w+")
12
13
  file.write(str)
@@ -16,14 +17,16 @@ module Fastlane
16
17
  class GsSaveBetaVersionAction < Action
17
18
  def self.run(params)
18
19
  require 'json'
19
- jsonstr = FileHelper.read(params[:path]) #TODO: впилить проверку если не указан путь
20
+ jsonstr = FileHelper.read(params[:path]) # TODO: впилить проверку если не указан путь
20
21
  json = JSON.parse(jsonstr)
21
22
  UI.message(json[params[:project_name]])
22
23
  res = params[:version].toString
23
24
  UI.message("New beta version " + res)
24
25
  json[params[:project_name]]["beta"] = res
25
- FileHelper.write(params[:path],json.to_json)
26
- UI.message("The gs_versioning plugin is working!")
26
+ FileHelper.write(params[:path], json.to_json)
27
+
28
+ GSVersionApiProvider.updateVersions(params[:project_name])
29
+
27
30
  res
28
31
  end
29
32
 
@@ -46,21 +49,21 @@ module Fastlane
46
49
 
47
50
  def self.available_options
48
51
  [
49
- FastlaneCore::ConfigItem.new(key: :path,
50
- env_name: "GS_VERSIONS_FILE_PATH",
51
- description: "path to versions file",
52
- optional: false,
53
- type: String),
54
- FastlaneCore::ConfigItem.new(key: :version,
55
- env_name: "GS_APP_VERSION",
56
- description: "App version",
57
- optional: false,
58
- type: Version),
59
- FastlaneCore::ConfigItem.new(key: :project_name,
60
- env_name: "ALIAS",
61
- description: "project name for versions file access",
62
- optional: false,
63
- type: String)
52
+ FastlaneCore::ConfigItem.new(key: :path,
53
+ env_name: "GS_VERSIONS_FILE_PATH",
54
+ description: "path to versions file",
55
+ optional: false,
56
+ type: String),
57
+ FastlaneCore::ConfigItem.new(key: :version,
58
+ env_name: "GS_APP_VERSION",
59
+ description: "App version",
60
+ optional: false,
61
+ type: Version),
62
+ FastlaneCore::ConfigItem.new(key: :project_name,
63
+ env_name: "ALIAS",
64
+ description: "project name for versions file access",
65
+ optional: false,
66
+ type: String)
64
67
  ]
65
68
  end
66
69
 
@@ -3,14 +3,14 @@ module Fastlane
3
3
  class GsSaveRcVersionAction < Action
4
4
  def self.run(params)
5
5
  require 'json'
6
- jsonstr = FileHelper.read(params[:path]) #TODO: впилить проверку если не указан путь
6
+ jsonstr = FileHelper.read(params[:path]) # TODO: впилить проверку если не указан путь
7
7
  UI.message(jsonstr)
8
8
  json = JSON.parse(jsonstr)
9
9
  res = params[:version].toString
10
10
  UI.message("New relese_candidate version " + res)
11
11
  json[params[:project_name]]["rc"] = res
12
- FileHelper.write(params[:path],json.to_json)
13
- UI.message("The gs_versioning plugin is working!")
12
+ FileHelper.write(params[:path], json.to_json)
13
+ GSVersionApiProvider.updateVersions(params[:project_name])
14
14
  end
15
15
 
16
16
  def self.description
@@ -20,6 +20,7 @@ module Fastlane
20
20
  def self.authors
21
21
  ["SAVeselovskiy"]
22
22
  end
23
+
23
24
  def self.return_value
24
25
  # If your method provides a return value, you can describe here what it does
25
26
  end
@@ -31,21 +32,21 @@ module Fastlane
31
32
 
32
33
  def self.available_options
33
34
  [
34
- FastlaneCore::ConfigItem.new(key: :path,
35
- env_name: "GS_VERSIONS_FILE_PATH",
36
- description: "path to versions file",
37
- optional: false,
38
- type: String),
39
- FastlaneCore::ConfigItem.new(key: :version,
40
- env_name: "GS_APP_VERSION",
41
- description: "App version",
42
- optional: false,
43
- type: Version),
44
- FastlaneCore::ConfigItem.new(key: :project_name,
45
- env_name: "ALIAS",
46
- description: "project name for versions file access",
47
- optional: false,
48
- type: String)
35
+ FastlaneCore::ConfigItem.new(key: :path,
36
+ env_name: "GS_VERSIONS_FILE_PATH",
37
+ description: "path to versions file",
38
+ optional: false,
39
+ type: String),
40
+ FastlaneCore::ConfigItem.new(key: :version,
41
+ env_name: "GS_APP_VERSION",
42
+ description: "App version",
43
+ optional: false,
44
+ type: Version),
45
+ FastlaneCore::ConfigItem.new(key: :project_name,
46
+ env_name: "ALIAS",
47
+ description: "project name for versions file access",
48
+ optional: false,
49
+ type: String)
49
50
  ]
50
51
  end
51
52
 
@@ -3,50 +3,51 @@ module Fastlane
3
3
  class GsSaveReleaseVersionAction < Action
4
4
  def self.run(params)
5
5
  require 'json'
6
- jsonstr = FileHelper.read(params[:path]) #TODO: впилить проверку если не указан путь
6
+ jsonstr = FileHelper.read(params[:path]) # TODO: впилить проверку если не указан путь
7
7
  UI.message(jsonstr)
8
8
  json = JSON.parse(jsonstr)
9
9
  res = params[:version].toString
10
- UI.message("New relese version " + res)
11
- json[params[:project_name]]["release"] = res
10
+ UI.message('New release version ' + res)
11
+ json[params[:project_name]]['release'] = res
12
12
  # json[params[:project_name]]["beta"] = res
13
- FileHelper.write(params[:path],json.to_json)
14
- UI.message("The gs_versioning plugin is working!")
13
+ FileHelper.write(params[:path], json.to_json)
14
+ GSVersionApiProvider.updateVersions(params[:project_name])
15
15
  end
16
16
 
17
17
  def self.description
18
- "Plugin for GradoService versioning system"
18
+ 'Plugin for GradoService versioning system'
19
19
  end
20
20
 
21
21
  def self.authors
22
- ["SAVeselovskiy"]
22
+ ['SAVeselovskiy']
23
23
  end
24
+
24
25
  def self.return_value
25
26
  # If your method provides a return value, you can describe here what it does
26
27
  end
27
28
 
28
29
  def self.details
29
30
  # Optional:
30
- "Plugin for GradoService versioning system"
31
+ 'Plugin for GradoService versioning system'
31
32
  end
32
33
 
33
34
  def self.available_options
34
35
  [
35
- FastlaneCore::ConfigItem.new(key: :path,
36
- env_name: "GS_VERSIONS_FILE_PATH",
37
- description: "path to versions file",
38
- optional: false,
39
- type: String),
40
- FastlaneCore::ConfigItem.new(key: :version,
41
- env_name: "GS_APP_VERSION",
42
- description: "App version",
43
- optional: false,
44
- type: Version),
45
- FastlaneCore::ConfigItem.new(key: :project_name,
46
- env_name: "ALIAS",
47
- description: "project name for versions file access",
48
- optional: false,
49
- type: String)
36
+ FastlaneCore::ConfigItem.new(key: :path,
37
+ env_name: "GS_VERSIONS_FILE_PATH",
38
+ description: "path to versions file",
39
+ optional: false,
40
+ type: String),
41
+ FastlaneCore::ConfigItem.new(key: :version,
42
+ env_name: "GS_APP_VERSION",
43
+ description: "App version",
44
+ optional: false,
45
+ type: Version),
46
+ FastlaneCore::ConfigItem.new(key: :project_name,
47
+ env_name: "ALIAS",
48
+ description: "project name for versions file access",
49
+ optional: false,
50
+ type: String)
50
51
  ]
51
52
  end
52
53
 
@@ -0,0 +1,7 @@
1
+ module Spaceship
2
+ class GSBotClient < Spaceship::Client
3
+ def self.hostname
4
+ 'http://mobile.geo4.pro/bot/releaseBuilder/'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,133 @@
1
+ class Version
2
+ attr_accessor :minor, :major, :build
3
+
4
+ def initialize(major, minor, build)
5
+ # assign instance avriables
6
+ @major, @minor, @build = major, minor, build
7
+ end
8
+
9
+ def self.parse(parsed)
10
+ #TODO: впилить проверку на правильный формат
11
+ {'beta' => self.parse_beta(parsed), 'rc' => self.parse_rc(parsed), 'release' => self.parse_release(parsed)}
12
+ end
13
+
14
+ def to_s
15
+ self.major.to_s + "." + self.minor.to_s + "." + self.build.to_s
16
+ end
17
+
18
+ def self.parse_beta(parsed)
19
+ beta_version = parsed["beta"]
20
+ self.parse_string(beta_version)
21
+ end
22
+
23
+ def self.parse_rc(parsed)
24
+ rc_version = parsed["rc"]
25
+ self.parse_string(rc_version)
26
+ end
27
+
28
+ def self.parse_release(parsed)
29
+ release_version = parsed["release"]
30
+ self.parse_string(release_version)
31
+ end
32
+
33
+ def self.parse_string(str)
34
+ v_elements = str.split(pattern='.')
35
+ build_value = v_elements[1].split(pattern='(')[1].split(pattern=')')[0]
36
+ Version.new(v_elements[0].to_i, v_elements[1].to_i, build_value.to_i)
37
+ end
38
+
39
+ def <= (other)
40
+ if @major < other.major
41
+ return true
42
+ elsif @major == other.major && @minor < other.minor
43
+ return true
44
+ elsif @major == other.major && @minor == other.minor && @build < other.build
45
+ return true
46
+ elsif @major == other.major && @minor == other.minor && @build == other.build
47
+ return true
48
+ end
49
+ false
50
+ end
51
+
52
+ def toString
53
+ res = @major.to_s + '.' + @minor.to_s + '(' + @build.to_s + ')'
54
+ end
55
+ end
56
+
57
+ class GSVersionValue
58
+ #values stores like {'projectName': {'beta':Version, 'rc':Version, 'release': Version}}
59
+
60
+ @@versions_dict = {}
61
+
62
+ def self.versions_dict
63
+ if @@versions_dict.length == 0
64
+ GSVersionApiProvider.getVersions
65
+ end
66
+ @@versions_dict
67
+ end
68
+
69
+ #projectName string - project alias
70
+ #build string - beta/rc/release
71
+ #value Version object
72
+ def updateValue(projectName, buildType, value)
73
+ @@versions_dict[projectName][buildType] = value
74
+ end
75
+
76
+ def self.parseBackendResponse(body)
77
+ versions = {}
78
+ body.each_key do |key|
79
+ serverValue = body[key]
80
+ localValue = Version.parse({
81
+ 'beta' => serverValue['betaVersionName'],
82
+ 'rc' => serverValue['rcVersionName'],
83
+ 'release' => serverValue['releaseVersionName']
84
+ })
85
+ versions[key] = localValue
86
+ end
87
+ @@versions_dict = versions
88
+ end
89
+
90
+ def self.getVersion(project_name)
91
+ @@versions_dict[project_name]
92
+ end
93
+ end
94
+
95
+ class GSVersionApiProvider
96
+ @@client = Spaceship::GSBotClient.new
97
+
98
+ def self.getVersions()
99
+ url = 'versions'
100
+ response = client.request(:get) do |req|
101
+ req.url url
102
+ req.headers['Content-Type'] = 'application/json'
103
+ end
104
+
105
+ if response.success?
106
+ GSVersionValue.parseBackendResponse(response.body)
107
+ else
108
+ raise(client.class.hostname + url + ' ' + response.status.to_s + ' ' + response.body['message'])
109
+ end
110
+ end
111
+
112
+ def self.updateVersions(projectName, newValue = GSVersionValue.versions_dict[projectName])
113
+ GSVersionValue.versions_dict[projectName] = newValue
114
+ url = 'versions'
115
+ json_params = {
116
+ 'alias' => projectName,
117
+ 'betaVersionName' => newValue['beta'],
118
+ 'rcVersionName' => newValue['rc'],
119
+ 'releaseVersionName' => newValue['release']
120
+ }
121
+ response = client.request(:patch) do |req|
122
+ req.url url
123
+ req.body = json_params
124
+ req.headers['Content-Type'] = 'application/json'
125
+ end
126
+
127
+ if response.success?
128
+ return response
129
+ else
130
+ raise(client.class.hostname + url + ' ' + response.status.to_s + ' ' + response.body['message'])
131
+ end
132
+ end
133
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GsVersioning
3
- VERSION = "0.2.2"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-gs_versioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SAVeselovskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-20 00:00:00.000000000 Z
11
+ date: 2018-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane-plugin-versioning
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: fastlane
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.107.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.107.0
111
111
  description:
@@ -114,6 +114,9 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
+ - LICENSE
118
+ - README.md
119
+ - lib/fastlane/plugin/gs_versioning.rb
117
120
  - lib/fastlane/plugin/gs_versioning/actions/gs_get_beta_version.rb
118
121
  - lib/fastlane/plugin/gs_versioning/actions/gs_get_rc_version.rb
119
122
  - lib/fastlane/plugin/gs_versioning/actions/gs_get_release_version.rb
@@ -124,11 +127,10 @@ files:
124
127
  - lib/fastlane/plugin/gs_versioning/actions/gs_save_beta_version.rb
125
128
  - lib/fastlane/plugin/gs_versioning/actions/gs_save_rc_version.rb
126
129
  - lib/fastlane/plugin/gs_versioning/actions/gs_save_release_version.rb
130
+ - lib/fastlane/plugin/gs_versioning/helper/gs_bot_client.rb
131
+ - lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb
127
132
  - lib/fastlane/plugin/gs_versioning/helper/gs_versioning_helper.rb
128
133
  - lib/fastlane/plugin/gs_versioning/version.rb
129
- - lib/fastlane/plugin/gs_versioning.rb
130
- - README.md
131
- - LICENSE
132
134
  homepage: https://github.com/SAVeselovskiy/gs_versioning
133
135
  licenses:
134
136
  - MIT
@@ -139,19 +141,18 @@ require_paths:
139
141
  - lib
140
142
  required_ruby_version: !ruby/object:Gem::Requirement
141
143
  requirements:
142
- - - '>='
144
+ - - ">="
143
145
  - !ruby/object:Gem::Version
144
146
  version: '0'
145
147
  required_rubygems_version: !ruby/object:Gem::Requirement
146
148
  requirements:
147
- - - '>='
149
+ - - ">="
148
150
  - !ruby/object:Gem::Version
149
151
  version: '0'
150
152
  requirements: []
151
153
  rubyforge_project:
152
- rubygems_version: 2.0.14.1
154
+ rubygems_version: 2.5.2.2
153
155
  signing_key:
154
156
  specification_version: 4
155
157
  summary: Plugin for GradoService versioning system
156
158
  test_files: []
157
- has_rdoc: