ive 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ba6659ffeef58918b087ba34e4c51f7e9d7fb4b
4
- data.tar.gz: 3393a6122c68145e7f472dd568077b454aefa660
3
+ metadata.gz: d75dcf1acb7cf52a6bdafabce418f15704aa3e7d
4
+ data.tar.gz: 47d1686cb5f8983869816d2d4365f1237e792187
5
5
  SHA512:
6
- metadata.gz: 4aebcc64b4deb82ebc5683f70d3eb1a9c16c5401c8379f29971cea7bcc09370c2655091ce1190b7eab14f6047912fcc45e609f03e28a3e65048bb09f6d1b3e6d
7
- data.tar.gz: 212171dcae1108f362d08e2c9e06e4abf74f7cc5199c3691d4a3d20a808d56755bf198ed1bdebd3beb15b1348ce0d77828dbfd1b64d33850daad653b89b2cb98
6
+ metadata.gz: 33049d8b95e2bd35202800d808a61b6862b44fd6594bc30847b0c884b3991c639f314296c1697baa8b9e9be788e9493cb650ffd2b3d89294ef7a468062da4591
7
+ data.tar.gz: e6146beb98cd7a80bc0191faf8886a4b6f829b3fe19f22f8beb439e87f09c64f09a981c48f46f892c0518333690b82ee8a494534bc58d6cee7e9bf10f82707e1
data/README.md CHANGED
@@ -47,15 +47,20 @@ You can also supply the path of the project root if needed. Just pass the _-p_ (
47
47
 
48
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
49
 
50
- Here is an example of the configuration file.
51
-
52
- target: "TheProject"
53
- configuration: "Debug"
54
-
55
50
  If a .ive configuration file is missing you can easlily generate one with his command.
56
51
 
57
52
  ive setup
58
53
 
54
+ Choosing the target/configuration to version bump can also be set. There is a _--configuration_ (or _-c_ in short) and a _--target_ (or _-t_) parameter that can be set the same way you set the path.
55
+
56
+ ive major -c Release
57
+ ive major --configuration Release
58
+
59
+ The code above will make sure the _Release_ configuration is used by **Ive**. The same can be done for the target as shown below.
60
+
61
+ ive major -t AppTargetName
62
+ ive major --target AppTargetName
63
+
59
64
  It's also possible to check out the current version.
60
65
 
61
66
  ive version
data/bin/ive CHANGED
@@ -14,23 +14,35 @@ class IveRunner < Thor
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
+ method_option :target, :aliases => "-t", :desc => "Supply the target to set the #{type} version"
18
+ method_option :configuration, :aliases => "-c", :desc => "Supply the configuration to set the #{type} version"
17
19
  define_method type do
18
20
  ENV["IVE_PATH"] = options[:path]
21
+ ENV["IVE_TARGET"] = options[:target]
22
+ ENV["IVE_CONFIGURATION"] = options[:configuration]
19
23
  Ive::Base.new.bump type, git?
20
24
  end
21
25
  end
22
26
 
23
27
  desc "version", "Show the current project version."
24
28
  method_option :path, :aliases => "-p", :desc => "Supply the path where the project is located"
29
+ method_option :target, :aliases => "-t", :desc => "Supply the target to read the version"
30
+ method_option :configuration, :aliases => "-c", :desc => "Supply the configuration to read the version"
25
31
  def version
26
32
  ENV["IVE_PATH"] = options[:path]
33
+ ENV["IVE_TARGET"] = options[:target]
34
+ ENV["IVE_CONFIGURATION"] = options[:configuration]
27
35
  Ive::Base.new.version
28
36
  end
29
37
 
30
38
  desc "init", "Initialize the version to 1.0.0 for the current project."
31
39
  method_option :path, :aliases => "-p", :desc => "Supply the path where the project is located"
40
+ method_option :target, :aliases => "-p", :desc => "Supply the target to initialize the version"
41
+ method_option :configuration, :aliases => "-c", :desc => "Supply the configuration to initialize the version"
32
42
  def init
33
43
  ENV["IVE_PATH"] = options[:path]
44
+ ENV["IVE_TARGET"] = options[:target]
45
+ ENV["IVE_CONFIGURATION"] = options[:configuration]
34
46
  Ive::Base.new.initialize_version git?
35
47
  end
36
48
 
@@ -3,8 +3,8 @@ require "yaml"
3
3
 
4
4
  module Ive
5
5
  class Configuration
6
- attr :target
7
- attr :configuration
6
+ attr :targets
7
+ attr :configurations
8
8
 
9
9
  def initialize
10
10
  self.read_config if self.exists?
@@ -17,13 +17,18 @@ module Ive
17
17
  def read_config
18
18
  params = YAML::load File.open(self.config_path)
19
19
  if params
20
- @target = params["target"]
21
- @configuration = params["configuration"]
20
+ @targets = params.keys
21
+ @configurations = params
22
22
  end
23
23
  end
24
24
 
25
25
  def valid?
26
- @target && @configuration
26
+ return false unless @targets
27
+ return false unless @targets.count > 0
28
+ return false unless @configurations
29
+ values = @configurations.values.select { |v| v.count > 0 }
30
+ return false if values.empty?
31
+ true
27
32
  end
28
33
 
29
34
  def exists?
@@ -35,10 +40,7 @@ module Ive
35
40
  end
36
41
 
37
42
  def initial_content xcode_params
38
- <<TEXT
39
- target: "#{xcode_params[:target]}"
40
- configuration: "#{xcode_params[:configuration]}"
41
- TEXT
43
+ xcode_params.to_yaml
42
44
  end
43
45
  end
44
46
  end
@@ -1,3 +1,3 @@
1
1
  module Ive
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -5,21 +5,38 @@ module Ive
5
5
  def config
6
6
  return nil unless Ive.config.valid?
7
7
 
8
- project.target(Ive.config.target).config(Ive.config.configuration)
8
+ target = ENV["IVE_TARGET"] || Ive.config.targets.first
9
+ contains_target = !project.targets.detect { |t| t.name == target }.nil?
10
+ puts "-- Target '#{target}' not found in the project." unless contains_target
11
+
12
+ configuration = ENV["IVE_CONFIGURATION"] || Ive.config.configurations[target].first
13
+ project_target = project.target(target)
14
+ contains_configuration = !project_target.configs.detect { |c| c.name == configuration }.nil?
15
+ puts "-- Configuration '#{configuration}' not found for Target '#{target}' in the project." unless contains_configuration
16
+
17
+ project_configuration = project_target.config(configuration)
18
+ puts "-- Used the '#{target}' Target with the '#{configuration}' configuration."
19
+ project_configuration
9
20
  rescue Exception => e
10
- puts "-- #{e.message}"
21
+ puts "-- #{e.message}" unless e.class == NoMethodError
11
22
  nil
12
23
  end
13
24
 
14
25
  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 }
26
+ config_hash = {}
27
+ project.targets.each do |target|
28
+ if target.configs.count > 0
29
+ config_hash[target.name] = target.configs.map(&:name)
18
30
  else
19
31
  puts "-- No configurations found for target '#{target.name}' in the current project"
20
32
  end
33
+ end
34
+
35
+ if config_hash.empty?
36
+ puts "-- No targets found in the current project"
37
+ nil
21
38
  else
22
- puts "-- No targets found in the current project"
39
+ config_hash
23
40
  end
24
41
  end
25
42
 
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.1.0
4
+ version: 1.2.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-30 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler