ive 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -9
- data/bin/ive +7 -4
- data/lib/ive.rb +11 -0
- data/lib/ive/base.rb +9 -53
- data/lib/ive/bump.rb +4 -12
- data/lib/ive/configuration.rb +38 -0
- data/lib/ive/git.rb +4 -4
- data/lib/ive/version.rb +1 -1
- data/lib/ive/xcode.rb +21 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 015d8fb59ae4758db9508bae233722c8c5238c89
|
4
|
+
data.tar.gz: d6042d5742f343f72be768608e4dd911fff2a4d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6803bc25f0215b93856bf3720906498ef534a3ef24a84e8cb4aaa5e298bba90ae0a7c5f4b24822e44a978b17018206ed573b72ab3578952a23944245b958c28f
|
7
|
+
data.tar.gz: 333ed3d51bd9b654f2fede17eef82cce1c1cff54762b621fb5de7a40c63e4764f36b165f26f7a70b28b59accbd77c9d8cf76af9ee11e3d0a43adeee64aa1788d
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ The current bumps are supported by Ive:
|
|
6
6
|
- **Major** _Go from 1.0.0 to 2.0.0_
|
7
7
|
- **Minor** _Go from 1.0.0 to 1.1.0_
|
8
8
|
- **Patch** _Go from 1.0.0 to 1.0.1_
|
9
|
-
- **Build** _Go from 1.0.0-
|
9
|
+
- **Build** _Go from 1.0.0-0001 to 1.0.0-0002_
|
10
10
|
|
11
11
|
And you can even automatically tag the current commit with this lastest version bump.
|
12
12
|
|
@@ -28,17 +28,34 @@ Or install it yourself as:
|
|
28
28
|
|
29
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
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
ive major
|
32
|
+
ive minor
|
33
|
+
ive patch
|
34
|
+
ive build
|
35
35
|
|
36
36
|
To tag the commit add the _--git_ parameter.
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
ive major --git
|
39
|
+
ive minor --git
|
40
|
+
ive patch --git
|
41
|
+
ive build --git
|
42
|
+
|
43
|
+
You can also supply the path of the project root if needed. Just pass the _-p_ (or _--path_) parameter.
|
44
|
+
|
45
|
+
ive major -p ~/Project
|
46
|
+
ive major --path ~/Project
|
47
|
+
|
48
|
+
You can also specify the target/configuration you want to bump the version by adding an extra _.ive_ file in the project root. This file should contain a valid target and configuration in order to be used.
|
49
|
+
|
50
|
+
Here is an example of the configuration file.
|
51
|
+
|
52
|
+
target: "TheProject"
|
53
|
+
configuration: "Debug"
|
54
|
+
|
55
|
+
It's also possible to check out the current version.
|
56
|
+
|
57
|
+
ive version
|
58
|
+
ive version -p ~/Project
|
42
59
|
|
43
60
|
## Contributing
|
44
61
|
|
data/bin/ive
CHANGED
@@ -8,20 +8,23 @@ class IveRunner < Thor
|
|
8
8
|
|
9
9
|
desc "list", "Show all the possible version bumps."
|
10
10
|
def list
|
11
|
-
Ive::Base.list
|
11
|
+
Ive::Base.new.list
|
12
12
|
end
|
13
13
|
|
14
14
|
%i(major minor patch build).each do |type|
|
15
15
|
desc type, "Perform a #{type} version bump."
|
16
16
|
method_option :path, :aliases => "-p", :desc => "Supply the path where the project is located"
|
17
17
|
define_method type do
|
18
|
-
|
18
|
+
ENV["IVE_PATH"] = options[:path]
|
19
|
+
Ive::Base.new.bump type, git?
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
22
23
|
desc "version", "Show the current project version."
|
23
|
-
|
24
|
-
|
24
|
+
method_option :path, :aliases => "-p", :desc => "Supply the path where the project is located"
|
25
|
+
def version
|
26
|
+
ENV["IVE_PATH"] = options[:path]
|
27
|
+
Ive::Base.new.version
|
25
28
|
end
|
26
29
|
|
27
30
|
private
|
data/lib/ive.rb
CHANGED
@@ -2,6 +2,17 @@ require "ive/version"
|
|
2
2
|
require "ive/base"
|
3
3
|
require "ive/bump"
|
4
4
|
require "ive/git"
|
5
|
+
require "ive/configuration"
|
6
|
+
require "ive/xcode"
|
5
7
|
|
6
8
|
module Ive
|
9
|
+
class << self
|
10
|
+
def config
|
11
|
+
@config ||= Configuration.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def path
|
15
|
+
ENV["IVE_PATH"] || Dir.pwd
|
16
|
+
end
|
17
|
+
end
|
7
18
|
end
|
data/lib/ive/base.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
require "xcoder"
|
2
|
-
require "yaml"
|
3
2
|
|
4
3
|
module Ive
|
5
4
|
class Base
|
6
|
-
class << self
|
7
5
|
def list
|
8
6
|
puts "-- Ive supports the following version bumps:"
|
9
7
|
puts "- major"
|
@@ -12,72 +10,30 @@ module Ive
|
|
12
10
|
puts "- build"
|
13
11
|
end
|
14
12
|
|
15
|
-
def bump(type,
|
16
|
-
|
17
|
-
|
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)
|
13
|
+
def bump(type, git=false)
|
14
|
+
if config = Ive::Xcode.new.config
|
15
|
+
if git
|
16
|
+
if Git.changes?
|
26
17
|
puts "-- This repository has uncommited changes please commit these changes before performing a version bump."
|
27
|
-
return
|
28
18
|
else
|
29
|
-
|
19
|
+
version = Bump.public_send(type, config)
|
20
|
+
Git.commit version
|
30
21
|
end
|
31
22
|
else
|
32
|
-
|
23
|
+
Bump.public_send(type, config)
|
33
24
|
end
|
34
25
|
else
|
35
26
|
puts "-- No project file found"
|
36
27
|
end
|
37
28
|
end
|
38
29
|
|
39
|
-
def version
|
40
|
-
|
41
|
-
if project = xcode_project(path)
|
42
|
-
config = config project, path
|
30
|
+
def version
|
31
|
+
if config = Ive::Xcode.new.config
|
43
32
|
puts "-- Version #{config.info_plist.marketing_version}"
|
44
33
|
puts "-- Build version #{config.info_plist.version}"
|
45
34
|
else
|
46
35
|
puts "-- No project file found"
|
47
36
|
end
|
48
37
|
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
38
|
end
|
82
|
-
end
|
83
39
|
end
|
data/lib/ive/bump.rb
CHANGED
@@ -3,23 +3,19 @@ require "versionomy"
|
|
3
3
|
module Ive
|
4
4
|
class Bump
|
5
5
|
class << self
|
6
|
-
def major(config
|
7
|
-
puts "-- Bumping version"
|
6
|
+
def major(config)
|
8
7
|
bumped_version config, :major
|
9
8
|
end
|
10
9
|
|
11
|
-
def minor(config
|
12
|
-
puts "-- Bumping version"
|
10
|
+
def minor(config)
|
13
11
|
bumped_version config, :minor
|
14
12
|
end
|
15
13
|
|
16
|
-
def patch(config
|
17
|
-
puts "-- Bumping version"
|
14
|
+
def patch(config)
|
18
15
|
bumped_version config, :tiny
|
19
16
|
end
|
20
17
|
|
21
|
-
def build(config
|
22
|
-
puts "-- Bumping build version"
|
18
|
+
def build(config)
|
23
19
|
bumped_build_version config
|
24
20
|
end
|
25
21
|
|
@@ -34,8 +30,6 @@ module Ive
|
|
34
30
|
end
|
35
31
|
|
36
32
|
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
33
|
new_version
|
40
34
|
end
|
41
35
|
|
@@ -46,8 +40,6 @@ module Ive
|
|
46
40
|
info.version = build_version_from info.marketing_version, new_build_version + 1
|
47
41
|
info.save
|
48
42
|
end
|
49
|
-
|
50
|
-
puts "-- New build version: #{config.info_plist.version}"
|
51
43
|
end
|
52
44
|
|
53
45
|
def build_version_from version, count
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "ostruct"
|
2
|
+
require "yaml"
|
3
|
+
|
4
|
+
module Ive
|
5
|
+
class Configuration
|
6
|
+
attr :target
|
7
|
+
attr :configuration
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
if self.exists?
|
11
|
+
self.read_config
|
12
|
+
unless self.valid?
|
13
|
+
puts "-- Invalid .ive config file."
|
14
|
+
end
|
15
|
+
else
|
16
|
+
puts "-- No .ive config file found."
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def read_config
|
21
|
+
params = YAML::load File.open(self.config_path)
|
22
|
+
@target = params["target"]
|
23
|
+
@configuration = params["configuration"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def valid?
|
27
|
+
@target && @configuration
|
28
|
+
end
|
29
|
+
|
30
|
+
def exists?
|
31
|
+
File.exists?(self.config_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
def config_path
|
35
|
+
@config_path ||= File.join(Ive.path,'.ive')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/ive/git.rb
CHANGED
@@ -3,13 +3,13 @@ require "git"
|
|
3
3
|
module Ive
|
4
4
|
class Git
|
5
5
|
class << self
|
6
|
-
def changes?
|
7
|
-
git = ::Git.open path
|
6
|
+
def changes?
|
7
|
+
git = ::Git.open Ive.path
|
8
8
|
git.status.changed.count > 0
|
9
9
|
end
|
10
10
|
|
11
|
-
def commit
|
12
|
-
git = ::Git.open path
|
11
|
+
def commit version
|
12
|
+
git = ::Git.open Ive.path
|
13
13
|
git.add all: true
|
14
14
|
git.commit "Version bump"
|
15
15
|
git.add_tag version
|
data/lib/ive/version.rb
CHANGED
data/lib/ive/xcode.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "xcoder"
|
2
|
+
|
3
|
+
module Ive
|
4
|
+
class Xcode
|
5
|
+
def config
|
6
|
+
return nil unless Ive.config.valid?
|
7
|
+
|
8
|
+
project.target(Ive.config.target).config(Ive.config.configuration)
|
9
|
+
#rescue Exception => e
|
10
|
+
#nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def project
|
14
|
+
@project ||= ::Xcode.project self.project_path
|
15
|
+
end
|
16
|
+
|
17
|
+
def project_path
|
18
|
+
@project_path ||= Dir.glob("#{Ive.path}/*.xcodeproj").first
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jelle Vandebeeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,8 +113,10 @@ files:
|
|
113
113
|
- lib/ive.rb
|
114
114
|
- lib/ive/base.rb
|
115
115
|
- lib/ive/bump.rb
|
116
|
+
- lib/ive/configuration.rb
|
116
117
|
- lib/ive/git.rb
|
117
118
|
- lib/ive/version.rb
|
119
|
+
- lib/ive/xcode.rb
|
118
120
|
homepage: https://github.com/fousa/ive
|
119
121
|
licenses:
|
120
122
|
- MIT
|