pr-changelog 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/chlog +35 -0
  3. data/lib/pr_changelog_utils.rb +56 -0
  4. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9d7a20963e4ef82670da1760b1eea28d4b22e92f
4
+ data.tar.gz: ee77e16744a5bf8d596151d21f6531f0ae7a4d60
5
+ SHA512:
6
+ metadata.gz: 3dcb3e170a002ee42f9f3cd8326284c8cfe2caed0e7a7cd0fd98666e70692de70e62e4009f8016a2606a7c1a555075b067ab0c2b4b98041e30e14606fda47d4c
7
+ data.tar.gz: 8628852012581467824308520e5f5554d8420a2c3db13771e59f1ca295be0242bf76155a3a9a02c463b26bdc4dd827fee11563ccb31bfe7c8a1298cb07e9e68c
data/bin/chlog ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'changelog_utils'
5
+ require 'commander/import'
6
+
7
+ program :version, '0.0.1'
8
+ program :description, 'changelog will make a change log for an iOS project for current version'
9
+
10
+ command :show do |c|
11
+ c.syntax = 'changelog show [options]'
12
+ c.summary = ''
13
+ c.description = ''
14
+ c.example 'description', 'command example'
15
+ c.option '--some-switch', 'Some switch that does something'
16
+ c.action do |args, options|
17
+ if !ChangelogUtils.isXcodeDirectory
18
+ puts "changelog should be used in a xcode directory"
19
+ else
20
+ currentVersion = ChangelogUtils.showVersion
21
+ puts currentVersion
22
+ puts "=============="
23
+
24
+ while (ChangelogUtils.showVersion == currentVersion)
25
+ ChangelogUtils.goBack
26
+ if (ChangelogUtils.isPullRequestMerge)
27
+ puts ChangelogUtils.printCurrentChange
28
+ end
29
+ end
30
+ end
31
+
32
+ ChangelogUtils.goForward
33
+ end
34
+ end
35
+
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ class ChangelogUtils
4
+
5
+ def self.getProjectName
6
+ projectFiles = Dir["*.xcodeproj"]
7
+ if (projectFiles.size()>0)
8
+ return projectFiles[0].scan(/[^.]*/)[0]
9
+ else
10
+ return nil
11
+ end
12
+ end
13
+
14
+ def self.isXcodeDirectory
15
+ projectName = ChangelogUtils.getProjectName
16
+ return projectName != nil
17
+ end
18
+
19
+ def self.plistFile
20
+ projectName = ChangelogUtils.getProjectName
21
+ plistFile = Dir["#{Dir.pwd}/*/#{projectName}-Info.plist"]
22
+ if (plistFile.size() > 0)
23
+ return plistFile[0]
24
+ else
25
+ return nil
26
+ end
27
+ end
28
+
29
+ def self.showVersion
30
+ `/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" #{ChangelogUtils.plistFile}`.strip
31
+ end
32
+
33
+ def self.printCurrentChange
34
+ " * #{ChangelogUtils.getLastMessageFromGit.strip} (#{ChangelogUtils.getPullRequestHash.strip})"
35
+ end
36
+
37
+ def self.goBack
38
+ `git checkout HEAD^ >/dev/null 2>/dev/null`
39
+ end
40
+
41
+ def self.goForward
42
+ `git checkout develop >/dev/null 2>/dev/null`
43
+ end
44
+
45
+ def self.getLastMessageFromGit
46
+ `git log -1 --format="%b"`
47
+ end
48
+
49
+ def self.isPullRequestMerge
50
+ `git log -1 --format="%s" | cut -c -18`.strip == "Merge pull request"
51
+ end
52
+
53
+ def self.getPullRequestHash
54
+ `git log -1 --format="%s" | cut -f 4 -d ' '`
55
+ end
56
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pr-changelog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - David Cortés
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Use this command to generate a changelog file for the current version
14
+ email: david@lafosca.cat
15
+ executables:
16
+ - chlog
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/pr_changelog_utils.rb
21
+ - bin/chlog
22
+ homepage: http://rubygems.org/gems/changelog
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.0.3
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Create a changelog for an iOS app using git history of Pull Requests already
46
+ merged and xcode version
47
+ test_files: []