fastlane-plugin-xml_editor 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c3d65369e7a52f35e3b95028de08a641df1bbd0
4
- data.tar.gz: 4cecf0ce635245b6863c3312be220c11b3e22e1e
3
+ metadata.gz: acf352da6dd166e8121504872e5b5668d84da2aa
4
+ data.tar.gz: fb1ccf2e940419c57c6e0d2754921f5f26d889f2
5
5
  SHA512:
6
- metadata.gz: 2822f13c9ddf2a0e8c8fad90034830f7dcbc503592158475590482c13bd8f090aa812fe1ebd4fb893e4a117ca4ddcc286cbacbdccd000d1df3a0121d9bb3f724
7
- data.tar.gz: 2ea412c6bf0de10161b50e722dc3ea404350c873ad9f9d0af453c998542d7881f0f063ebf1a5f501457b694bc431d8c2ec84699aa88c356f07df42d555dca2d7
6
+ metadata.gz: 2cf1a6bb5cfca29e8017bc473e717891cb7691cc0a7068adaf95f5a80564681ae8c2c1fd39ef6972a832f9e7b3e4535af86c2e70f1c79dcb31b450952b1eae0f
7
+ data.tar.gz: dc489931f5423ed158f6b88efe3a114141b7bfc788bade1354de8f6d163ea8016c2fc0a891271f75c31e29b08d3832c86a4f7dc171910697f9478db8c6b1670d
@@ -0,0 +1,55 @@
1
+ module Fastlane
2
+ module Actions
3
+ class XmlAddAction < Action
4
+ def self.run(params)
5
+ require "nokogiri"
6
+
7
+ path_to_file = File.expand_path(params[:path_to_xml_file])
8
+ xml_search_path = params[:xml_path]
9
+ new_attribute_value = params[:new_value]
10
+
11
+ @doc = Nokogiri::XML(File.open(path_to_file))
12
+ @doc.at_xpath(xml_search_path).add_child(new_attribute_value)
13
+ File.write(path_to_file, @doc.to_xml)
14
+ UI.success("XML element added successfully!")
15
+ end
16
+
17
+ def self.description
18
+ "Generic XML file add content using XPath"
19
+ end
20
+
21
+ def self.authors
22
+ ["Felipe Plets"]
23
+ end
24
+
25
+ def self.details
26
+ "This plugin allows you to remove any element of a standard XML document."
27
+ end
28
+
29
+ def self.available_options
30
+ [
31
+ FastlaneCore::ConfigItem.new(key: :path_to_xml_file,
32
+ env_name: "PATH_TO_XML_FILE",
33
+ description: "The path to the XML file in your project",
34
+ optional: false,
35
+ type: String),
36
+ FastlaneCore::ConfigItem.new(key: :xml_path,
37
+ env_name: "XML_PATH",
38
+ description: "The xmlpath to the XML element that will be modified",
39
+ optional: true,
40
+ type: String),
41
+ FastlaneCore::ConfigItem.new(key: :new_value,
42
+ env_name: "NEW_VALUE",
43
+ description: "The new XML attribute value which will be inserted into the XML file",
44
+ optional: false,
45
+ type: String)
46
+ ]
47
+ end
48
+
49
+ def self.is_supported?(platform)
50
+ [:ios, :mac, :android].include?(platform)
51
+ true
52
+ end
53
+ end
54
+ end
55
+ end
@@ -24,7 +24,7 @@ module Fastlane
24
24
  else
25
25
  xml_search_path = params[:xml_path]
26
26
  @doc = Nokogiri::XML(File.open(path_to_file))
27
- element_root = @doc.at_xpath(xml_search_path).content = new_attribute_value
27
+ @doc.at_xpath(xml_search_path).content = new_attribute_value
28
28
  File.write(path_to_file, @doc.to_xml)
29
29
  UI.success("XML element value successfully changed!")
30
30
  end
@@ -0,0 +1,49 @@
1
+ module Fastlane
2
+ module Actions
3
+ class XmlRemoveAction < Action
4
+ def self.run(params)
5
+ require "nokogiri"
6
+
7
+ path_to_file = File.expand_path(params[:path_to_xml_file])
8
+ xml_search_path = params[:xml_path]
9
+
10
+ @doc = Nokogiri::XML(File.open(path_to_file))
11
+ @doc.at_xpath(xml_search_path).remove
12
+ File.write(path_to_file, @doc.to_xml)
13
+ UI.success("XML element removed successfully!")
14
+ end
15
+
16
+ def self.description
17
+ "Generic XML file remover using XPath"
18
+ end
19
+
20
+ def self.authors
21
+ ["Felipe Plets"]
22
+ end
23
+
24
+ def self.details
25
+ "This plugin allows you to remove any element of a standard XML document."
26
+ end
27
+
28
+ def self.available_options
29
+ [
30
+ FastlaneCore::ConfigItem.new(key: :path_to_xml_file,
31
+ env_name: "PATH_TO_XML_FILE",
32
+ description: "The path to the XML file in your project",
33
+ optional: false,
34
+ type: String),
35
+ FastlaneCore::ConfigItem.new(key: :xml_path,
36
+ env_name: "XML_PATH",
37
+ description: "The xmlpath to the XML element that will be modified",
38
+ optional: true,
39
+ type: String)
40
+ ]
41
+ end
42
+
43
+ def self.is_supported?(platform)
44
+ [:ios, :mac, :android].include?(platform)
45
+ true
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,61 @@
1
+ module Fastlane
2
+ module Actions
3
+ class XmlSetAttributeAction < Action
4
+ def self.run(params)
5
+ require "nokogiri"
6
+
7
+ path_to_file = File.expand_path(params[:path_to_xml_file])
8
+ xml_search_path = params[:xml_path]
9
+ attribute_name = params[:attribute_name]
10
+ attribute_value = params[:attribute_value]
11
+
12
+ @doc = Nokogiri::XML(File.open(path_to_file))
13
+ @doc.at_xpath(xml_search_path).set_attribute(attribute_name, attribute_value)
14
+ File.write(path_to_file, @doc.to_xml)
15
+ UI.success("XML attribute added successfully!")
16
+ end
17
+
18
+ def self.description
19
+ "Add XML attribute using XPath"
20
+ end
21
+
22
+ def self.authors
23
+ ["Felipe Plets"]
24
+ end
25
+
26
+ def self.details
27
+ "This plugin allows you to remove any element of a standard XML document."
28
+ end
29
+
30
+ def self.available_options
31
+ [
32
+ FastlaneCore::ConfigItem.new(key: :path_to_xml_file,
33
+ env_name: "PATH_TO_XML_FILE",
34
+ description: "The path to the XML file in your project",
35
+ optional: false,
36
+ type: String),
37
+ FastlaneCore::ConfigItem.new(key: :xml_path,
38
+ env_name: "XML_PATH",
39
+ description: "The xmlpath to the XML element that will be modified",
40
+ optional: true,
41
+ type: String),
42
+ FastlaneCore::ConfigItem.new(key: :attribute_name,
43
+ env_name: "ATTRIBUTE_NAME",
44
+ description: "The new XML attribute name that will be inserted into the XML file",
45
+ optional: false,
46
+ type: String),
47
+ FastlaneCore::ConfigItem.new(key: :attribute_value,
48
+ env_name: "ATTRIBUTE_VALUE",
49
+ description: "The new XML attribute value that will be inserted into the XML file",
50
+ optional: false,
51
+ type: String)
52
+ ]
53
+ end
54
+
55
+ def self.is_supported?(platform)
56
+ [:ios, :mac, :android].include?(platform)
57
+ true
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module XmlEditor
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-xml_editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Ritchie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-22 00:00:00.000000000 Z
11
+ date: 2017-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plist
@@ -131,7 +131,10 @@ files:
131
131
  - LICENSE
132
132
  - README.md
133
133
  - lib/fastlane/plugin/xml_editor.rb
134
+ - lib/fastlane/plugin/xml_editor/actions/xml_add_action.rb
134
135
  - lib/fastlane/plugin/xml_editor/actions/xml_editor_action.rb
136
+ - lib/fastlane/plugin/xml_editor/actions/xml_remove_action.rb
137
+ - lib/fastlane/plugin/xml_editor/actions/xml_set_attribute_action.rb
135
138
  - lib/fastlane/plugin/xml_editor/helper/xml_editor_helper.rb
136
139
  - lib/fastlane/plugin/xml_editor/version.rb
137
140
  homepage: https://github.com/jonathanneilritchie/fastlane-plugin-xml_editor