ive 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5ee418327677d638308f90ce37eceb61c6483a42
4
+ data.tar.gz: 1f3afa891ff04bef5421439dc7c5d19d2894f75b
5
+ SHA512:
6
+ metadata.gz: 74b6314623b578fc7f3282946b78fc1ab7aa530078eecee2f1ac1850ff95b2a3df4bd3b1c757512f89db759ec23610f007aed769991e8fb4b04204095906f0ae
7
+ data.tar.gz: 91b40eccac67a67da55cd986f12ff4f4fa33b45b3c7b2de76e3608ddf805fbc88f451cf58947eae41759ebf2ecfb368e09ff14e871cf8497e9b9304d300bd364
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jelle Vandebeeck
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # IVE
2
+
3
+ A gem that allows you to bump the version of your Xcode project.
4
+
5
+ The current bumps are supported by Ive:
6
+ - **Major** _Go from 1.0.0 to 2.0.0_
7
+ - **Minor** _Go from 1.0.0 to 1.1.0_
8
+ - **Patch** _Go from 1.0.0 to 1.0.1_
9
+ - **Build** _Go from 1.0.0-100000 to 1.0.0-100001_
10
+
11
+ And you can even automatically tag the current commit with this lastest version bump.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'ive'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install ive
26
+
27
+ ## Usage
28
+
29
+ It's really simple to use. Just run anh of the following commands in the Terminal from the project root in order to bump.
30
+
31
+ ivo bump:major
32
+ ivo bump:minor
33
+ ivo bump:patch
34
+ ivo bump:build
35
+
36
+ To tag the commit add the _--git_ parameter.
37
+
38
+ ivo bump:major --git
39
+ ivo bump:minor --git
40
+ ivo bump:patch --git
41
+ ivo bump:build --git
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it ( https://github.com/[my-github-username]/ive/fork )
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/ive ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "thor"
4
+ require "ive"
5
+
6
+ class IveRunner < Thor
7
+ class_options :git => false
8
+
9
+ desc "list", "Show all the possible version bumps."
10
+ def list
11
+ Ive::Base.list
12
+ end
13
+
14
+ %i(major minor patch build).each do |type|
15
+ desc type, "Perform a #{type} version bump."
16
+ method_option :path, :aliases => "-p", :desc => "Supply the path where the project is located"
17
+ define_method type do
18
+ Ive::Base.bump type, options[:path], git?
19
+ end
20
+ end
21
+
22
+ desc "version", "Show the current project version."
23
+ def version(path)
24
+ Ive::Base.version path
25
+ end
26
+
27
+ private
28
+
29
+ def git?
30
+ options[:git] == true
31
+ end
32
+ end
33
+
34
+ IveRunner.start
data/ive.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ive/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ive"
8
+ spec.version = Ive::VERSION
9
+ spec.authors = ["Jelle Vandebeeck"]
10
+ spec.email = ["jelle@fousa.be"]
11
+ spec.summary = %q{A gem that allows you to bump the version of your Xcode project.}
12
+ spec.description = %q{A gem that allows you to bump the version of your Xcode project. You can do a major, minor, patch or build bump. }
13
+ spec.homepage = "https://github.com/fousa/ive"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "thor", "~> 0.19.1"
24
+ spec.add_dependency "xcoder", "~> 0.1.18"
25
+ spec.add_dependency "versionomy", "~> 0.4.4"
26
+ spec.add_dependency "git", "~> 1.2.6"
27
+ end
data/lib/ive.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "ive/version"
2
+ require "ive/base"
3
+ require "ive/bump"
4
+ require "ive/git"
5
+
6
+ module Ive
7
+ end
data/lib/ive/base.rb ADDED
@@ -0,0 +1,83 @@
1
+ require "xcoder"
2
+ require "yaml"
3
+
4
+ module Ive
5
+ class Base
6
+ class << self
7
+ def list
8
+ puts "-- Ive supports the following version bumps:"
9
+ puts "- major"
10
+ puts "- minor"
11
+ puts "- patch"
12
+ puts "- build"
13
+ end
14
+
15
+ def bump(type, path, with_git=false)
16
+ path = Dir.pwd unless path
17
+ puts "-- Using the current project: #{path}"
18
+
19
+ if project = xcode_project(path)
20
+ config = config project, path
21
+ return if config.nil?
22
+
23
+ puts "-- Tagging and commiting enabled: #{with_git ? "yes" : "no"}"
24
+ if with_git
25
+ if Git.changes?(path)
26
+ puts "-- This repository has uncommited changes please commit these changes before performing a version bump."
27
+ return
28
+ else
29
+ Git.commit path, Ive::Bump.public_send(type, config, with_git)
30
+ end
31
+ else
32
+ Ive::Bump.public_send type, config, with_git
33
+ end
34
+ else
35
+ puts "-- No project file found"
36
+ end
37
+ end
38
+
39
+ def version path
40
+ puts "-- Using the current project: #{path}"
41
+ if project = xcode_project(path)
42
+ config = config project, path
43
+ puts "-- Version #{config.info_plist.marketing_version}"
44
+ puts "-- Build version #{config.info_plist.version}"
45
+ else
46
+ puts "-- No project file found"
47
+ end
48
+ end
49
+
50
+ private
51
+
52
+ def xcode_project path
53
+ project_path = Dir.glob("#{path}/*.xcodeproj").first
54
+ Xcode.project project_path
55
+ end
56
+
57
+ def config project, path
58
+ if config_file?(path) && valid_config?(path)
59
+ config = config_file path
60
+ project.target(config["target"]).config(config["configuration"])
61
+ else
62
+ project.targets.first.config(:Debug)
63
+ end
64
+ rescue Exception => e
65
+ puts "-- #{e}"
66
+ nil
67
+ end
68
+
69
+ def config_file? path
70
+ File.exists?(File.join(path,'.ive'))
71
+ end
72
+
73
+ def config_file path
74
+ YAML::load(File.open(File.join(path,'.ive')))
75
+ end
76
+
77
+ def valid_config? path
78
+ config = config_file path
79
+ config["target"] && config["configuration"]
80
+ end
81
+ end
82
+ end
83
+ end
data/lib/ive/bump.rb ADDED
@@ -0,0 +1,62 @@
1
+ require "versionomy"
2
+
3
+ module Ive
4
+ class Bump
5
+ class << self
6
+ def major(config, with_git=false)
7
+ puts "-- Bumping version"
8
+ bumped_version config, :major
9
+ end
10
+
11
+ def minor(config, with_git=false)
12
+ puts "-- Bumping version"
13
+ bumped_version config, :minor
14
+ end
15
+
16
+ def patch(config, with_git=false)
17
+ puts "-- Bumping version"
18
+ bumped_version config, :tiny
19
+ end
20
+
21
+ def build(config, with_git=false)
22
+ puts "-- Bumping build version"
23
+ bumped_build_version config
24
+ end
25
+
26
+ private
27
+
28
+ def bumped_version config, type
29
+ version = Versionomy.parse config.info_plist.marketing_version
30
+ config.info_plist do |info|
31
+ info.marketing_version = version.bump(type).to_s
32
+ info.version = build_version_from info.marketing_version, 1
33
+ info.save
34
+ end
35
+
36
+ new_version = "v#{config.info_plist.marketing_version}"
37
+ puts "-- New version: #{config.info_plist.marketing_version}"
38
+ puts "-- New build version: #{config.info_plist.version}"
39
+ new_version
40
+ end
41
+
42
+ def bumped_build_version config
43
+ version = Versionomy.parse config.info_plist.marketing_version
44
+ config.info_plist do |info|
45
+ new_build_version = extract_build_version info.version
46
+ info.version = build_version_from info.marketing_version, new_build_version + 1
47
+ info.save
48
+ end
49
+
50
+ puts "-- New build version: #{config.info_plist.version}"
51
+ end
52
+
53
+ def build_version_from version, count
54
+ version.gsub(".", "") + ".#{"%04.f" % count}"
55
+ end
56
+
57
+ def extract_build_version version
58
+ version.split(".").last.to_i
59
+ end
60
+ end
61
+ end
62
+ end
data/lib/ive/git.rb ADDED
@@ -0,0 +1,19 @@
1
+ require "git"
2
+
3
+ module Ive
4
+ class Git
5
+ class << self
6
+ def changes? path
7
+ git = ::Git.open path
8
+ git.status.changed.count > 0
9
+ end
10
+
11
+ def commit path, version
12
+ git = ::Git.open path
13
+ git.add all: true
14
+ git.commit "Version bump"
15
+ git.add_tag version
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module Ive
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ive
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jelle Vandebeeck
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.19.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.19.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: xcoder
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.1.18
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.1.18
69
+ - !ruby/object:Gem::Dependency
70
+ name: versionomy
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 0.4.4
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 0.4.4
83
+ - !ruby/object:Gem::Dependency
84
+ name: git
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.2.6
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.2.6
97
+ description: 'A gem that allows you to bump the version of your Xcode project. You
98
+ can do a major, minor, patch or build bump. '
99
+ email:
100
+ - jelle@fousa.be
101
+ executables:
102
+ - ive
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - .gitignore
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/ive
112
+ - ive.gemspec
113
+ - lib/ive.rb
114
+ - lib/ive/base.rb
115
+ - lib/ive/bump.rb
116
+ - lib/ive/git.rb
117
+ - lib/ive/version.rb
118
+ homepage: https://github.com/fousa/ive
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.0.3
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: A gem that allows you to bump the version of your Xcode project.
142
+ test_files: []