ive 1.0.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 015d8fb59ae4758db9508bae233722c8c5238c89
4
- data.tar.gz: d6042d5742f343f72be768608e4dd911fff2a4d1
3
+ metadata.gz: 3ba6659ffeef58918b087ba34e4c51f7e9d7fb4b
4
+ data.tar.gz: 3393a6122c68145e7f472dd568077b454aefa660
5
5
  SHA512:
6
- metadata.gz: 6803bc25f0215b93856bf3720906498ef534a3ef24a84e8cb4aaa5e298bba90ae0a7c5f4b24822e44a978b17018206ed573b72ab3578952a23944245b958c28f
7
- data.tar.gz: 333ed3d51bd9b654f2fede17eef82cce1c1cff54762b621fb5de7a40c63e4764f36b165f26f7a70b28b59accbd77c9d8cf76af9ee11e3d0a43adeee64aa1788d
6
+ metadata.gz: 4aebcc64b4deb82ebc5683f70d3eb1a9c16c5401c8379f29971cea7bcc09370c2655091ce1190b7eab14f6047912fcc45e609f03e28a3e65048bb09f6d1b3e6d
7
+ data.tar.gz: 212171dcae1108f362d08e2c9e06e4abf74f7cc5199c3691d4a3d20a808d56755bf198ed1bdebd3beb15b1348ce0d77828dbfd1b64d33850daad653b89b2cb98
data/README.md CHANGED
@@ -52,11 +52,19 @@ Here is an example of the configuration file.
52
52
  target: "TheProject"
53
53
  configuration: "Debug"
54
54
 
55
+ If a .ive configuration file is missing you can easlily generate one with his command.
56
+
57
+ ive setup
58
+
55
59
  It's also possible to check out the current version.
56
60
 
57
61
  ive version
58
62
  ive version -p ~/Project
59
63
 
64
+ Set the initial version to 1.0.0 with a build number 0001.
65
+
66
+ ive init
67
+
60
68
  ## Contributing
61
69
 
62
70
  1. Fork it ( https://github.com/[my-github-username]/ive/fork )
data/bin/ive CHANGED
@@ -27,6 +27,20 @@ class IveRunner < Thor
27
27
  Ive::Base.new.version
28
28
  end
29
29
 
30
+ desc "init", "Initialize the version to 1.0.0 for the current project."
31
+ method_option :path, :aliases => "-p", :desc => "Supply the path where the project is located"
32
+ def init
33
+ ENV["IVE_PATH"] = options[:path]
34
+ Ive::Base.new.initialize_version git?
35
+ end
36
+
37
+ desc "setup", "Create the .ive configuration file for the current project."
38
+ method_option :path, :aliases => "-p", :desc => "Supply the path where the project is located"
39
+ def setup
40
+ ENV["IVE_PATH"] = options[:path]
41
+ Ive::Base.new.setup
42
+ end
43
+
30
44
  private
31
45
 
32
46
  def git?
data/lib/ive/base.rb CHANGED
@@ -3,7 +3,7 @@ require "xcoder"
3
3
  module Ive
4
4
  class Base
5
5
  def list
6
- puts "-- Ive supports the following version bumps:"
6
+ puts "Ive supports the following version bumps:"
7
7
  puts "- major"
8
8
  puts "- minor"
9
9
  puts "- patch"
@@ -11,28 +11,78 @@ module Ive
11
11
  end
12
12
 
13
13
  def bump(type, git=false)
14
- if config = Ive::Xcode.new.config
15
- if git
16
- if Git.changes?
17
- puts "-- This repository has uncommited changes please commit these changes before performing a version bump."
18
- else
14
+ fetch_config do |config|
15
+ use_git git do
16
+ if git
19
17
  version = Bump.public_send(type, config)
20
18
  Git.commit version
19
+ else
20
+ Bump.public_send(type, config)
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ def initialize_version git=false
27
+ fetch_config do |config|
28
+ use_git git do
29
+ if git
30
+ version = Bump.initialize_version config
31
+ Git.commit version
32
+ else
33
+ Bump.initialize_version config
21
34
  end
35
+ end
36
+ end
37
+ end
38
+
39
+ def setup
40
+ xcode = Ive::Xcode.new
41
+ if xcode
42
+ configuration = Configuration.new
43
+ if configuration.valid?
44
+ puts "-- An .ive configuration file is already set."
22
45
  else
23
- Bump.public_send(type, config)
46
+ config_params = xcode.initial_config
47
+ if config_params
48
+ Configuration.new.create_file(config_params)
49
+ puts "-- .ive configuration file generated"
50
+ end
24
51
  end
25
52
  else
26
- puts "-- No project file found"
53
+ puts "-- No project file found."
27
54
  end
28
55
  end
29
56
 
30
57
  def version
31
- if config = Ive::Xcode.new.config
32
- puts "-- Version #{config.info_plist.marketing_version}"
33
- puts "-- Build version #{config.info_plist.version}"
58
+ fetch_config do |config|
59
+ puts "-- Current version #{config.info_plist.marketing_version}"
60
+ puts "-- Current build version #{config.info_plist.version}"
61
+ end
62
+ end
63
+
64
+ private
65
+
66
+ def fetch_config &block
67
+ xcode = Ive::Xcode.new
68
+ if config = xcode.config
69
+ yield config if block_given?
70
+ elsif xcode
71
+ puts "-- .ive configuration file missing or invalid."
72
+ else
73
+ puts "-- No project file found."
74
+ end
75
+ end
76
+
77
+ def use_git enabled, &block
78
+ if enabled
79
+ if Git.changes?
80
+ puts "-- This repository has uncommited changes please commit these changes before performing a version bump."
81
+ else
82
+ yield if block_given?
83
+ end
34
84
  else
35
- puts "-- No project file found"
85
+ yield if block_given?
36
86
  end
37
87
  end
38
88
  end
data/lib/ive/bump.rb CHANGED
@@ -19,6 +19,20 @@ module Ive
19
19
  bumped_build_version config
20
20
  end
21
21
 
22
+ def initialize_version config
23
+ version = Versionomy.parse "1.0.0"
24
+ config.info_plist do |info|
25
+ info.marketing_version = version.to_s
26
+ info.version = build_version_from info.marketing_version, 1
27
+ info.save
28
+ end
29
+ puts "-- Current version #{config.info_plist.marketing_version}"
30
+ puts "-- Current build version #{config.info_plist.version}"
31
+
32
+ new_version = "v#{config.info_plist.marketing_version}"
33
+ new_version
34
+ end
35
+
22
36
  private
23
37
 
24
38
  def bumped_version config, type
@@ -28,6 +42,8 @@ module Ive
28
42
  info.version = build_version_from info.marketing_version, 1
29
43
  info.save
30
44
  end
45
+ puts "-- Current version #{config.info_plist.marketing_version}"
46
+ puts "-- Current build version #{config.info_plist.version}"
31
47
 
32
48
  new_version = "v#{config.info_plist.marketing_version}"
33
49
  new_version
@@ -40,6 +56,8 @@ module Ive
40
56
  info.version = build_version_from info.marketing_version, new_build_version + 1
41
57
  info.save
42
58
  end
59
+ puts "-- Current version #{config.info_plist.marketing_version}"
60
+ puts "-- Current build version #{config.info_plist.version}"
43
61
  end
44
62
 
45
63
  def build_version_from version, count
@@ -7,20 +7,19 @@ module Ive
7
7
  attr :configuration
8
8
 
9
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
10
+ self.read_config if self.exists?
11
+ end
12
+
13
+ def create_file xcode_params
14
+ File.open(config_path, "w") { |f| f.write(initial_content(xcode_params)) } unless exists?
18
15
  end
19
16
 
20
17
  def read_config
21
18
  params = YAML::load File.open(self.config_path)
22
- @target = params["target"]
23
- @configuration = params["configuration"]
19
+ if params
20
+ @target = params["target"]
21
+ @configuration = params["configuration"]
22
+ end
24
23
  end
25
24
 
26
25
  def valid?
@@ -34,5 +33,12 @@ module Ive
34
33
  def config_path
35
34
  @config_path ||= File.join(Ive.path,'.ive')
36
35
  end
36
+
37
+ def initial_content xcode_params
38
+ <<TEXT
39
+ target: "#{xcode_params[:target]}"
40
+ configuration: "#{xcode_params[:configuration]}"
41
+ TEXT
42
+ end
37
43
  end
38
44
  end
data/lib/ive/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ive
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/ive/xcode.rb CHANGED
@@ -6,8 +6,21 @@ module Ive
6
6
  return nil unless Ive.config.valid?
7
7
 
8
8
  project.target(Ive.config.target).config(Ive.config.configuration)
9
- #rescue Exception => e
10
- #nil
9
+ rescue Exception => e
10
+ puts "-- #{e.message}"
11
+ nil
12
+ end
13
+
14
+ def initial_config
15
+ if project.targets.count > 0 && (target = project.targets.first)
16
+ if target.configs.count > 0 && (config = target.configs.first)
17
+ { target: target.name, configuration: config.name }
18
+ else
19
+ puts "-- No configurations found for target '#{target.name}' in the current project"
20
+ end
21
+ else
22
+ puts "-- No targets found in the current project"
23
+ end
11
24
  end
12
25
 
13
26
  def project
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: 1.0.0
4
+ version: 1.1.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-29 00:00:00.000000000 Z
11
+ date: 2014-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler