timewizard 0.2.4.pre.alpha.pre.41 → 0.3.0.pre.alpha.pre.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.document +3 -0
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -8
- data/.yardopts +1 -0
- data/LICENSE.txt +0 -2
- data/README.md +6 -8
- data/README.rdoc +29 -0
- data/Rakefile +72 -7
- data/gemspec.yml +20 -0
- data/lib/timewizard/utils/wizardry.rb +23 -4
- data/lib/timewizard/version.rb +21 -1
- data/lib/timewizard/versioner/android.rb +101 -91
- data/lib/timewizard/versioner/apple.rb +102 -84
- data/lib/timewizard/versioner.rb +52 -0
- data/lib/timewizard.rb +21 -5
- data/spec/spec_helper.rb +33 -0
- data/spec/timewizard_spec.rb +5 -0
- data/spec/utils/wizardry_spec.rb +27 -0
- data/spec/versioner_spec.rb +107 -0
- data/timewizard.gemspec +60 -28
- metadata +74 -24
- data/bin/console +0 -14
- data/bin/setup +0 -7
@@ -1,115 +1,133 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2015 Richard Harrah <topplethenunnery@gmail.com>
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in
|
6
|
+
# the Software without restriction, including without limitation the rights to
|
7
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
#
|
1
21
|
require 'xcodeproj'
|
2
|
-
require 'find'
|
3
22
|
require 'versionomy'
|
23
|
+
require 'timewizard/versioner'
|
4
24
|
require 'timewizard/utils/wizardry'
|
5
25
|
|
6
26
|
module Timewizard
|
7
27
|
module Versioner
|
8
|
-
class Apple
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
28
|
+
class Apple < Timewizard::Versioner::Base
|
29
|
+
|
30
|
+
#
|
31
|
+
# Public functions (inherited from parent)
|
32
|
+
#
|
33
|
+
public
|
34
|
+
|
35
|
+
def read_build_numbers
|
36
|
+
read_file
|
37
|
+
find_build_numbers
|
38
|
+
end
|
39
|
+
|
40
|
+
def read_version_numbers
|
41
|
+
read_file
|
42
|
+
find_version_numbers
|
43
|
+
end
|
44
|
+
|
45
|
+
def write_build_numbers
|
46
|
+
change_build_numbers
|
47
|
+
write_file
|
21
48
|
end
|
22
49
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
50
|
+
def write_version_numbers
|
51
|
+
change_version_numbers
|
52
|
+
write_file
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Private functions (implementation specific)
|
57
|
+
#
|
58
|
+
private
|
59
|
+
|
60
|
+
def read_file
|
61
|
+
if @file.nil?
|
62
|
+
raise 'file is nil and cannot be read'
|
26
63
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
next
|
33
|
-
end
|
34
|
-
@proj = path
|
35
|
-
end
|
64
|
+
|
65
|
+
@file_contents = {}
|
66
|
+
|
67
|
+
if File.exist?(@file)
|
68
|
+
@file_contents = Xcodeproj::PlistHelper.read @file
|
36
69
|
end
|
37
|
-
|
70
|
+
|
71
|
+
@file_contents
|
38
72
|
end
|
39
73
|
|
40
|
-
def
|
41
|
-
if @
|
42
|
-
raise
|
43
|
-
end
|
44
|
-
directory = File.dirname(@proj.to_s)
|
45
|
-
unless Dir.exist?(directory)
|
46
|
-
raise "proj is not in a directory"
|
74
|
+
def write_file
|
75
|
+
if @file.nil?
|
76
|
+
raise 'file is nil and cannot be written'
|
47
77
|
end
|
48
|
-
@
|
49
|
-
|
50
|
-
if /^.*Info\.plist$/ =~ p
|
51
|
-
@plists << p
|
52
|
-
end
|
78
|
+
if @file_contents.nil?
|
79
|
+
raise 'file_contents is nil and cannot be written'
|
53
80
|
end
|
54
|
-
@
|
81
|
+
Xcodeproj::PlistHelper.write(@file_contents, @file)
|
55
82
|
end
|
56
83
|
|
57
|
-
def
|
58
|
-
|
84
|
+
def find_build_numbers
|
85
|
+
find_build_and_version_numbers
|
86
|
+
[@old_build_number, @new_build_number]
|
59
87
|
end
|
60
88
|
|
61
|
-
def
|
62
|
-
|
89
|
+
def find_version_numbers
|
90
|
+
find_build_and_version_numbers
|
91
|
+
[@old_version_number, @new_version_number]
|
63
92
|
end
|
64
93
|
|
65
|
-
def
|
66
|
-
|
67
|
-
|
68
|
-
versions
|
94
|
+
def find_build_and_version_numbers
|
95
|
+
if @file_contents.nil?
|
96
|
+
read_file
|
69
97
|
end
|
70
|
-
ver = Timewizard::Utils::Wizardry.only_version change_to
|
71
|
-
parsed = Versionomy.parse(ver, Versionomy::Format.get('rubygems'))
|
72
|
-
versions[0] = parsed.unparse
|
73
|
-
@new_bundle_version = versions[0]
|
74
|
-
versions
|
75
|
-
end
|
76
98
|
|
77
|
-
|
78
|
-
|
79
|
-
ver = Timewizard::Utils::Wizardry.only_version @old_build_number.to_s
|
80
|
-
parsed = Versionomy.parse(ver, Versionomy::Format.get('rubygems'))
|
81
|
-
parsed = parsed.bump(parsed.parts.length - 1)
|
82
|
-
versions[1] = parsed.unparse
|
83
|
-
@new_build_number = versions[1]
|
84
|
-
else
|
85
|
-
ver = Timewizard::Utils::Wizardry.only_version change_to
|
86
|
-
parsed = Versionomy.parse ver
|
87
|
-
versions[1] = parsed.unparse
|
88
|
-
@new_build_number = versions[1]
|
89
|
-
end
|
90
|
-
versions
|
91
|
-
end
|
99
|
+
build_num = Timewizard::Utils::Wizardry.only_version(@file_contents["CFBundleVersion"]) || '0'
|
100
|
+
version_num = Timewizard::Utils::Wizardry.only_version(@file_contents["CFBundleShortVersionString"]) || '0'
|
92
101
|
|
93
|
-
|
94
|
-
|
95
|
-
for list in lists do
|
96
|
-
list_hash = Xcodeproj::PlistHelper.read list
|
97
|
-
versions[0] ||= list_hash["CFBundleShortVersionString"]
|
98
|
-
versions[1] ||= list_hash["CFBundleVersion"]
|
102
|
+
parsed_build_num = Versionomy.parse(build_num, Versionomy::Format.get('rubygems'))
|
103
|
+
parsed_version_num = Versionomy.parse(version_num, Versionomy::Format.get('rubygems'))
|
99
104
|
|
100
|
-
|
101
|
-
|
105
|
+
@old_build_number = parsed_build_num.unparse
|
106
|
+
@old_version_number = parsed_version_num.unparse
|
107
|
+
|
108
|
+
@new_build_number = parsed_build_num.bump(parsed_build_num.parts.length - 1).unparse
|
109
|
+
@new_version_number = @old_version_number
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
def change_build_numbers
|
114
|
+
if @file_contents.nil?
|
115
|
+
read_file
|
102
116
|
end
|
103
|
-
|
117
|
+
if @new_build_number.nil?
|
118
|
+
read_build_numbers
|
119
|
+
end
|
120
|
+
@file_contents["CFBundleVersion"] = @new_build_number.to_s || @file_contents["CFBundleVersion"]
|
104
121
|
end
|
105
122
|
|
106
|
-
def
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
123
|
+
def change_version_numbers
|
124
|
+
if @file_contents.nil?
|
125
|
+
read_file
|
126
|
+
end
|
127
|
+
if @new_build_number.nil?
|
128
|
+
read_build_numbers
|
112
129
|
end
|
130
|
+
@file_contents["CFBundleShortVersionString"] = @new_build_number.to_s || @file_contents["CFBundleShortVersionString"]
|
113
131
|
end
|
114
132
|
|
115
133
|
end
|
data/lib/timewizard/versioner.rb
CHANGED
@@ -1,5 +1,57 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2015 Richard Harrah <topplethenunnery@gmail.com>
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in
|
6
|
+
# the Software without restriction, including without limitation the rights to
|
7
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
#
|
1
21
|
module Timewizard
|
2
22
|
module Versioner
|
23
|
+
class Base
|
24
|
+
attr_reader :file
|
25
|
+
attr_reader :old_build_number
|
26
|
+
attr_reader :old_version_number
|
27
|
+
attr_accessor :new_build_number
|
28
|
+
attr_accessor :new_version_number
|
29
|
+
|
30
|
+
def initialize(path_to_file)
|
31
|
+
if path_to_file.nil?
|
32
|
+
raise "passed in file cannot be nil"
|
33
|
+
end
|
34
|
+
@file = path_to_file
|
35
|
+
end
|
36
|
+
|
37
|
+
def read_build_numbers()
|
38
|
+
# do nothing
|
39
|
+
end
|
40
|
+
|
41
|
+
def read_version_numbers()
|
42
|
+
# do nothing
|
43
|
+
end
|
44
|
+
|
45
|
+
def write_build_numbers()
|
46
|
+
# do nothing
|
47
|
+
end
|
48
|
+
|
49
|
+
def write_version_numbers()
|
50
|
+
# do nothing
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
3
55
|
autoload :Android, 'timewizard/versioner/android'
|
4
56
|
autoload :Apple, 'timewizard/versioner/apple'
|
5
57
|
end
|
data/lib/timewizard.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
#
|
2
|
+
# Copyright (C) 2015 Richard Harrah <topplethenunnery@gmail.com>
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in
|
6
|
+
# the Software without restriction, including without limitation the rights to
|
7
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
#
|
21
|
+
require 'timewizard/version'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'timewizard'
|
2
|
+
require 'codeclimate-test-reporter'
|
3
|
+
CodeClimate::TestReporter.start
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
|
7
|
+
config.expect_with :rspec do |expectations|
|
8
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
9
|
+
end
|
10
|
+
|
11
|
+
config.mock_with :rspec do |mocks|
|
12
|
+
mocks.verify_partial_doubles = true
|
13
|
+
end
|
14
|
+
|
15
|
+
config.filter_run :focus
|
16
|
+
config.run_all_when_everything_filtered = true
|
17
|
+
|
18
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
19
|
+
|
20
|
+
config.disable_monkey_patching!
|
21
|
+
|
22
|
+
config.warnings = true
|
23
|
+
|
24
|
+
if config.files_to_run.one?
|
25
|
+
config.default_formatter = 'doc'
|
26
|
+
end
|
27
|
+
|
28
|
+
config.profile_examples = 10
|
29
|
+
|
30
|
+
config.order = :random
|
31
|
+
|
32
|
+
Kernel.srand config.seed
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'timewizard/utils/wizardry'
|
2
|
+
|
3
|
+
RSpec.describe 'Timewizard::Utils::Wizardry' do
|
4
|
+
context '.only_version' do
|
5
|
+
it 'should raise an error when arg is nil' do
|
6
|
+
expect { Timewizard::Utils::Wizardry.only_version nil }.to raise_error('stringy cannot be null')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should return the same value when given a proper version number' do
|
10
|
+
base = '0.0.1'
|
11
|
+
|
12
|
+
expected = '0.0.1'
|
13
|
+
actual = Timewizard::Utils::Wizardry.only_version base
|
14
|
+
|
15
|
+
expect(actual).to eq(expected)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should return a version number when given a text string containing a version number' do
|
19
|
+
base = 'this is version 0.0.1'
|
20
|
+
|
21
|
+
expected = '0.0.1'
|
22
|
+
actual = Timewizard::Utils::Wizardry.only_version base
|
23
|
+
|
24
|
+
expect(actual).to eq(expected)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'timewizard/versioner'
|
2
|
+
|
3
|
+
RSpec.describe 'Timewizard::Versioner::Base' do
|
4
|
+
|
5
|
+
context '.new' do
|
6
|
+
it 'should raise error if arg is nil' do
|
7
|
+
expect { Timewizard::Versioner::Base.new nil }.to raise_error("passed in file cannot be nil")
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should not raise error if arg is not nil' do
|
11
|
+
expect { Timewizard::Versioner::Base.new '' }.not_to raise_error
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
before(:context) do
|
16
|
+
@versioner = Timewizard::Versioner::Base.new ''
|
17
|
+
end
|
18
|
+
|
19
|
+
context '#file' do
|
20
|
+
it 'should be empty string' do
|
21
|
+
expect(@versioner.file).to eq('')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context '#old_build_number' do
|
26
|
+
it 'should be nil' do
|
27
|
+
expect(@versioner.old_build_number).to be_nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context '#old_version_number' do
|
32
|
+
it 'should be nil' do
|
33
|
+
expect(@versioner.old_version_number).to be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context '#new_build_number' do
|
38
|
+
it 'should be nil' do
|
39
|
+
expect(@versioner.new_build_number).to be_nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context '#new_build_number=' do
|
44
|
+
it 'should change instance variable' do
|
45
|
+
@versioner.new_build_number = '1'
|
46
|
+
expect(@versioner.new_build_number).not_to be_nil
|
47
|
+
@versioner.new_build_number = nil
|
48
|
+
expect(@versioner.new_build_number).to be_nil
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context '#new_version_number' do
|
53
|
+
it 'should be nil' do
|
54
|
+
expect(@versioner.new_version_number).to be_nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context '#new_version_number=' do
|
59
|
+
it 'should change instance variable' do
|
60
|
+
@versioner.new_version_number = '1'
|
61
|
+
expect(@versioner.new_version_number).not_to be_nil
|
62
|
+
@versioner.new_version_number = nil
|
63
|
+
expect(@versioner.new_version_number).to be_nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context '#read_build_numbers' do
|
68
|
+
it 'should not change instance variables' do
|
69
|
+
expect(@versioner.old_build_number).to be_nil
|
70
|
+
expect(@versioner.new_build_number).to be_nil
|
71
|
+
@versioner.read_build_numbers
|
72
|
+
expect(@versioner.old_build_number).to be_nil
|
73
|
+
expect(@versioner.new_build_number).to be_nil
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context '#read_version_numbers' do
|
78
|
+
it 'should not change instance variables' do
|
79
|
+
expect(@versioner.old_version_number).to be_nil
|
80
|
+
expect(@versioner.new_version_number).to be_nil
|
81
|
+
@versioner.read_version_numbers
|
82
|
+
expect(@versioner.old_version_number).to be_nil
|
83
|
+
expect(@versioner.new_version_number).to be_nil
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context '#write_build_numbers' do
|
88
|
+
it 'should not change instance variables' do
|
89
|
+
expect(@versioner.old_build_number).to be_nil
|
90
|
+
expect(@versioner.new_build_number).to be_nil
|
91
|
+
@versioner.write_build_numbers
|
92
|
+
expect(@versioner.old_build_number).to be_nil
|
93
|
+
expect(@versioner.new_build_number).to be_nil
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context '#write_version_numbers' do
|
98
|
+
it 'should not change instance variables' do
|
99
|
+
expect(@versioner.old_version_number).to be_nil
|
100
|
+
expect(@versioner.new_version_number).to be_nil
|
101
|
+
@versioner.write_version_numbers
|
102
|
+
expect(@versioner.old_version_number).to be_nil
|
103
|
+
expect(@versioner.new_version_number).to be_nil
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
data/timewizard.gemspec
CHANGED
@@ -1,29 +1,61 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gemspec = YAML.load_file('gemspec.yml')
|
7
|
+
|
8
|
+
gem.name = gemspec.fetch('name')
|
9
|
+
gem.version = gemspec.fetch('version') do
|
10
|
+
lib_dir = File.join(File.dirname(__FILE__), 'lib')
|
11
|
+
$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
|
12
|
+
|
13
|
+
require 'timewizard/version'
|
14
|
+
Timewizard::VERSION
|
15
|
+
end
|
16
|
+
gem.version = "#{gem.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS_BRANCH'] == 'development'
|
17
|
+
|
18
|
+
gem.summary = gemspec['summary']
|
19
|
+
gem.description = gemspec['description']
|
20
|
+
gem.licenses = Array(gemspec['license'])
|
21
|
+
gem.authors = Array(gemspec['authors'])
|
22
|
+
gem.email = gemspec['email']
|
23
|
+
gem.homepage = gemspec['homepage']
|
24
|
+
|
25
|
+
glob = lambda { |patterns| gem.files & Dir[*patterns] }
|
26
|
+
|
27
|
+
gem.files = `git ls-files`.split($/)
|
28
|
+
gem.files = glob[gemspec['files']] if gemspec['files']
|
29
|
+
|
30
|
+
gem.executables = gemspec.fetch('executables') do
|
31
|
+
glob['bin/*'].map { |path| File.basename(path) }
|
32
|
+
end
|
33
|
+
gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
|
34
|
+
|
35
|
+
gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
|
36
|
+
gem.test_files = glob[gemspec['test_files'] || '{test/{**/}*_test.rb']
|
37
|
+
gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,rdoc}']
|
38
|
+
|
39
|
+
gem.require_paths = Array(gemspec.fetch('require_paths') {
|
40
|
+
%w[ext lib].select { |dir| File.directory?(dir) }
|
41
|
+
})
|
42
|
+
|
43
|
+
gem.requirements = gemspec['requirements']
|
44
|
+
gem.required_ruby_version = gemspec['required_ruby_version']
|
45
|
+
gem.required_rubygems_version = gemspec['required_rubygems_version']
|
46
|
+
gem.post_install_message = gemspec['post_install_message']
|
47
|
+
|
48
|
+
split = lambda { |string| string.split(/,\s*/) }
|
49
|
+
|
50
|
+
if gemspec['dependencies']
|
51
|
+
gemspec['dependencies'].each do |name, versions|
|
52
|
+
gem.add_dependency(name, split[versions])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
if gemspec['development_dependencies']
|
57
|
+
gemspec['development_dependencies'].each do |name, versions|
|
58
|
+
gem.add_development_dependency(name, split[versions])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|