fastlane-plugin-msbuild 0.1.1 → 0.1.2

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: 7b24a7379d74fdc7dfce382bd204b760fcb34758
4
- data.tar.gz: 32fdc5dedb1b0d8d5333245e7917679ef75e9e87
3
+ metadata.gz: 83884235202f7c83cd2249c02574ec34c702f322
4
+ data.tar.gz: 277066aa5f726aa108fa584f9022e47d77305411
5
5
  SHA512:
6
- metadata.gz: 7a61aea3d92cd1581b8db2814f16f0231900db209662488a398ccc44302b178d2896799dff53399bf540b4beade7a1b7ca7fa7da6a0d8d9bfd595757808dc741
7
- data.tar.gz: 93dbb4c0f3ddf8ae0a14f72e39574822a819ca81a27c936334fe5fde9e0eac5494320f1da19c1d47c85f79af51bae7cac76f343fde637d9685b9976bfaa728b6
6
+ metadata.gz: d1543b8191203f58a58c50f155f25a8e3483e68ee31d03d1d1f287ecd92a8935d9c7af0dcb1bf47da2799f7d142f841f48f02a0003875febd36a4d3472eb8e53
7
+ data.tar.gz: 3897f69461e1649935db258a7f8039edf2831838bac763cc7f28d25112869503201fc703586f6abf7ee28e11a9001294a1c4f5253ea44c6838c68c1b68fef59d
@@ -0,0 +1,84 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AssemblyInfoPokeVersionAction < Action
4
+ def self.fixup_version_string(version, revision)
5
+ versions = version.split(".")
6
+ versions.fill(0, versions.length...4)
7
+ versions.map! { |x| x == '*' ? '0' : x }
8
+ versions[3] = revision
9
+ version_string = versions.join(".")
10
+ return version_string
11
+ end
12
+
13
+ def self.run(params)
14
+ revision = params[:rev_number]
15
+ version = params[:version_number]
16
+
17
+ if !!revision ^ !!version
18
+ regex = /\[assembly\:\s*AssemblyVersion\("(?<version>\d+\.\d+\.[\d\*]+(\.[\d\*]+)?)\"\)\]/
19
+ text = File.read(params[:file_path])
20
+
21
+ out = File.open(params[:file_path], "w")
22
+ text.each_line do |line|
23
+ match = line.match(regex)
24
+ if match
25
+ version_string = version
26
+ version_string = fixup_version_string(match["version"], revision) if version_string.nil?
27
+ line.gsub!(regex, "[assembly: AssemblyVersion(\"#{version_string}\")]")
28
+ end
29
+ out.puts(line)
30
+ end
31
+ out.close
32
+ else
33
+ UI.error("You should supply rev_number or version_number but not botha")
34
+ raise
35
+ end
36
+ end
37
+
38
+ def self.description
39
+ "Set the version in an AssemblyInfo.cs file. Optionally only set the revision number"
40
+ end
41
+
42
+ def self.authors
43
+ ["fuzzybinary"]
44
+ end
45
+
46
+ def self.details
47
+ "Set the version in an AssemblyInfo.cs file. Optionally only set the revision number"
48
+ end
49
+
50
+ def self.available_options
51
+ [
52
+ FastlaneCore::ConfigItem.new(
53
+ key: :file_path,
54
+ env_name: 'FL_ASSEMBLY_INFO_FILE',
55
+ description: 'path to AssemblyInfo.cs file',
56
+ verify_block: proc do |value|
57
+ UI.user_error!('File not found'.red) unless File.file? value
58
+ end
59
+ ),
60
+
61
+ FastlaneCore::ConfigItem.new(
62
+ key: :rev_number,
63
+ optional: true,
64
+ env_name: 'FL_ASSEMBLY_INFO_REVISION_NUMBER',
65
+ description: 'Revision number',
66
+ type: String
67
+ ),
68
+
69
+ FastlaneCore::ConfigItem.new(
70
+ key: :version_number,
71
+ optional: true,
72
+ env_name: 'FL_ASSEMBLY_INFO_VERSION_NUMBER',
73
+ description: 'The full (4 component) version number for the assembly',
74
+ type: String
75
+ )
76
+ ]
77
+ end
78
+
79
+ def self.is_supported?(platform)
80
+ true
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,69 @@
1
+ require 'nokogiri'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class NuspecPokeVersionAction < Action
6
+ def self.run(params)
7
+ revision = params[:prerelease_version]
8
+ version = params[:version_number]
9
+
10
+ doc = Nokogiri::XML(File.open(params[:file_path]))
11
+
12
+ version_node = doc.at_xpath("/package/metadata/version")
13
+ version_string = version ? version : version_node.content
14
+ if revision
15
+ prerelease_index = version_string.index('-')
16
+ version_string = version_string[0..(prerelease_index - version_string.length - 1)] if prerelease_index
17
+ version_string << "-#{revision}"
18
+ end
19
+ version_node.content = version_string
20
+ File.write(params[:file_path], doc.to_xml)
21
+ end
22
+
23
+ def self.description
24
+ "Set the version in a Nuspec file. Optionally only set the revision number"
25
+ end
26
+
27
+ def self.authors
28
+ ["fuzzybinary"]
29
+ end
30
+
31
+ def self.details
32
+ "Set the version in a Nuspec file. Optionally only set the revision number"
33
+ end
34
+
35
+ def self.available_options
36
+ [
37
+ FastlaneCore::ConfigItem.new(
38
+ key: :file_path,
39
+ env_name: 'FL_NUSPEC_FILE',
40
+ description: 'path to Nuspec file',
41
+ verify_block: proc do |value|
42
+ UI.user_error!('File not found'.red) unless File.file? value
43
+ end
44
+ ),
45
+
46
+ FastlaneCore::ConfigItem.new(
47
+ key: :prerelease_version,
48
+ optional: true,
49
+ env_name: 'FL_NUSPEC_PRERELEASE_VERSION',
50
+ description: 'Prerelease version',
51
+ type: String
52
+ ),
53
+
54
+ FastlaneCore::ConfigItem.new(
55
+ key: :version_number,
56
+ optional: true,
57
+ env_name: 'FL_NUSPEC_VERSION_NUMBER',
58
+ description: 'The full (4 component) version number for the assembly',
59
+ type: String
60
+ )
61
+ ]
62
+ end
63
+
64
+ def self.is_supported?(platform)
65
+ true
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Msbuild
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-msbuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Ward
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: pry
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -103,8 +117,10 @@ files:
103
117
  - LICENSE
104
118
  - README.md
105
119
  - lib/fastlane/plugin/msbuild.rb
120
+ - lib/fastlane/plugin/msbuild/actions/assembly_info_poke_version.rb
106
121
  - lib/fastlane/plugin/msbuild/actions/msbuild_action.rb
107
122
  - lib/fastlane/plugin/msbuild/actions/nuget_pack_action.rb
123
+ - lib/fastlane/plugin/msbuild/actions/nuspec_poke_version.rb
108
124
  - lib/fastlane/plugin/msbuild/helper/msbuild_helper.rb
109
125
  - lib/fastlane/plugin/msbuild/version.rb
110
126
  homepage: https://github.com/willowtreeapps/fastlane-plugin-msbuild