fastlane-plugin-changelog 0.5.0 → 0.5.1

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: 8942aab0857114d3400eaa42bebba390d2a231c0
4
- data.tar.gz: 4d46daef140989c1159640ec6a6a25eb1b7b6b85
3
+ metadata.gz: e066c1d6080f5b420db6486b92b99b139fd7e558
4
+ data.tar.gz: 61d471439bd314f56e3a70653841c6b6cf8852d8
5
5
  SHA512:
6
- metadata.gz: bfa381bc7b38b0b71e8179be0ae1a4123e7b9f552cb752b3b207e176d5a367cc622166bcf7c480b2bac5ef26a1d8999335341164849b31240b62fd74014da364
7
- data.tar.gz: aa4431cabe2585de78c49a5164529780791cd25377e726b0003b386e07b890b8379d9178aa4a6eb7f0890b08eada155aa1dfe00931dc03993ba57c28dba49921
6
+ metadata.gz: 0746da8916f3ed5d274701c8cfeb873ba0a34a63809d45b43bdeca5fc83b2bfa11e3dbfbf6d4d45ac8a759b3f2dce25d5d238fecf12ed7a075078d5e364ed354
7
+ data.tar.gz: 995ac63588bb1a574a773c85cea2b2055ef2bcea504af6ed5e3ae1c44ebb178723902481c1bbffcdf55c4ef3d9c1be37769219daf62271b356b0203c9d2dcf7c
@@ -15,6 +15,7 @@ module Fastlane
15
15
  # Read & update file content
16
16
  file_content = ""
17
17
  File.open(changelog_path, "r") do |file|
18
+ line_separator = Helper::ChangelogHelper.get_line_separator(changelog_path)
18
19
  file.each_line do |line|
19
20
  # Find line matching section identifier
20
21
  if line =~ /\#{2}\s?\[#{escaped_section_identifier}\]/
@@ -31,8 +32,8 @@ module Fastlane
31
32
  if params[:append_date]
32
33
  now = Time.now.strftime("%Y-%m-%d")
33
34
  line.concat(" - " + now)
34
- line.delete!("\n") # remove line break, because concatenation adds line break between section identifer & date
35
- line.concat("\n") # add line break to the end of the string, in order to start next line on the next line
35
+ line.delete!(line_separator) # remove line break, because concatenation adds line break between section identifer & date
36
+ line.concat(line_separator) # add line break to the end of the string, in order to start next line on the next line
36
37
  end
37
38
 
38
39
  UI.message "Old section identifier: #{line_old.delete!("\n")}"
@@ -7,6 +7,22 @@ module Fastlane
7
7
  def self.show_message
8
8
  UI.message("Hello from the changelog plugin helper!")
9
9
  end
10
+
11
+ def self.get_line_separator(file_path)
12
+ f = File.open(file_path)
13
+ enum = f.each_char
14
+ c = enum.next
15
+ loop do
16
+ case c[/\r|\n/]
17
+ when "\n" then break
18
+ when "\r"
19
+ c << "\n" if enum.peek == "\n"
20
+ break
21
+ end
22
+ c = enum.next
23
+ end
24
+ c[0][/\r|\n/] ? c : "\n"
25
+ end
10
26
  end
11
27
  end
12
28
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Changelog
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Prochazka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-12 00:00:00.000000000 Z
11
+ date: 2016-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry