version_info 1.7.0 → 1.7.1

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.
data/Gemfile.lock CHANGED
@@ -22,6 +22,7 @@ GEM
22
22
 
23
23
  PLATFORMS
24
24
  ruby
25
+ x86-mingw32
25
26
 
26
27
  DEPENDENCIES
27
28
  bundler
data/README.md CHANGED
@@ -17,6 +17,7 @@ And is very user friendly thanks to rake / thor tasks:
17
17
 
18
18
  First, include VersionInfo in your main project module (or class):
19
19
 
20
+ ```ruby
20
21
  require 'version_info'
21
22
 
22
23
  module MyProject
@@ -25,6 +26,7 @@ First, include VersionInfo in your main project module (or class):
25
26
  include VersionInfo
26
27
  VERSION.file_name = __FILE__
27
28
  end
29
+ ```
28
30
 
29
31
  Then use rake/thor tasks:
30
32
 
@@ -34,91 +36,114 @@ Then use rake/thor tasks:
34
36
 
35
37
  Please, note here VersionInfo is included *after* the constant VERSION, if you don't like this also works
36
38
 
39
+ ```ruby
37
40
  module MyProject
38
41
  include VersionInfo
39
42
  self.VERSION = "1.5.0"
40
43
  VERSION.file_name = __FILE__
41
44
  end
45
+ ```
42
46
 
43
47
  Please note here you are invoking a singleton method and not using a constant. When included VersionInfo
44
48
  does a bit of magic and then you can use *both* the method and the constant:
45
49
 
50
+ ```ruby
46
51
  MyProject.VERSION # it works
47
52
  MyProject::VERSION # also works
53
+ ```
48
54
 
49
55
  One more sample:
50
56
 
57
+ ```ruby
51
58
  Gem::Specification.new do |s|
52
- s.name = "version_info"
53
- s.version = VersionInfo::VERSION
59
+ s.name = "my_gem"
60
+ s.version = MyGem::VERSION
54
61
  s.platform = Gem::Platform::RUBY
62
+ ```
55
63
 
56
64
  After VersionInfo is included, the singleton method and the constant returns a object of class VersionInfo::Data.
57
65
  You can use some methods from it, (#bump, #to_s, #tag, etc.). Also you get another singleton method to easy assignment:
58
66
 
67
+ ```ruby
59
68
  MyProject.VERSION= "2.0.2" # also works
69
+ ```
60
70
 
61
71
  #### Features
62
72
 
63
- * rake & thor tasks avaiables to yaml file creation, bump segments and show info
73
+ * rake & thor tasks avaiables to yaml file creation, bump segments and show info
64
74
 
65
- * can define custom segments to build your version tag with the tipical structure X.X.X.X.
75
+ * can define custom segments to build your version tag with the tipical structure X.X.X.X.
66
76
 
67
- * can use a custom tag format: do you want a tag like "1-3-1pre"?. No problem!.
77
+ * can use a custom tag format: do you want a tag like "1-3-1pre"?. No problem!.
68
78
 
69
- * can include any custom info in your version data.
79
+ * can include any custom info in your version data.
70
80
 
71
- * good rspec tests
81
+ * good rspec tests
72
82
 
73
- * Flexible formats for stored your version data:
74
-
75
- * In a ruby source (default)
76
-
77
- module MyProject
78
- include VersionInfo
79
- self.VERSION = "1.5.0"
80
- VERSION.file_name = __FILE__ # required for this format
81
- end
83
+ * Flexible formats for stored your version data:
82
84
 
83
- * In a text file
84
-
85
- Version.file_format= :text
86
- module MyProject
87
- include VersionInfo
88
- VERSION.file_name = /some_path/your_version_file #convenient but optional for this format
89
- end
90
-
91
- The file is named by default VERSION and looks like
92
-
93
- 2.2.3
94
- author: jcangas
95
- email: jorge.cangas@gmail.com
96
-
85
+ 1. Using a text file. Content of your version.rb file:
86
+
87
+ ```ruby
88
+ VersionInfo.file_format= :text
89
+ module MyProject
90
+ include VersionInfo
91
+ VERSION.file_name = /some_path/your_version_file #convenient but optional for this format
92
+ end
93
+ ```
94
+
95
+ The file is created "on demand". For example, you can invoke the task vinfo:show
96
+ The version data file is named by default VERSION and looks like.
97
+
98
+ ```
99
+ 2.2.3
100
+ author: jcangas
101
+ email: jorge.cangas@gmail.com
102
+ ```
97
103
 
98
- * In a yaml file, as a hash
99
-
100
- Version.file_format= :yaml
101
- module MyProject
102
- include VersionInfo
103
- VERSION.file_name = /some_path/your_file.yaml #convenient but optional for this format
104
- end
105
-
106
- The file is named by default version_info.yml and looks like
107
-
108
- ---
109
- major: 1
110
- minor: 1
111
- patch: 4
112
- author: jcangas
104
+ 2. Using a yaml file, as a hash. Content of your version.rb file:
105
+
106
+ ```ruby
107
+ VersionInfo.file_format= :yaml
108
+ module MyProject
109
+ include VersionInfo
110
+ VERSION.file_name = /some_path/your_file.yaml #convenient but optional for this format
111
+ end
112
+ ```
113
+
114
+ The file is created "on demand". For example, you can invoke the task vinfo:show
115
+ The version data file is named by default VERSION and looks like.
116
+
117
+ ```yaml
118
+ ---
119
+ major: 1
120
+ minor: 1
121
+ patch: 4
122
+ author: jcangas
123
+ ```
124
+
125
+ 3. Using a ruby source (default). Content of your version.rb file:
126
+
127
+ ```ruby
128
+ module MyProject
129
+ include VersionInfo
130
+ self.VERSION = "1.5.0"
131
+ VERSION.file_name = __FILE__ # required for this format
132
+ end
133
+ ```
134
+
135
+ You write this file. and no version data file is needed: VERSION const is already here (you see it, isn't?)
113
136
 
114
137
 
115
138
  Pleae, feel free to contact me about bugs/features
116
139
 
117
140
  ### Rake / Thor tasks
118
141
 
119
- Put in your rake file:
142
+ Put in your rake or thor file:
120
143
 
121
- VersionInfo::RakeTasks.install(:class => MyProject) # pass here the thing where you included VersionInfo
144
+ ```ruby
145
+ VersionInfo::install_tasks(:target => MyProject) # pass here the thing where you included VersionInfo
146
+ ```
122
147
 
123
148
  And you get a few tasks with a namespace vinfo:
124
149
 
@@ -130,10 +155,7 @@ And you get a few tasks with a namespace vinfo:
130
155
  rake vinfo:minor # Bumps version segment MINOR
131
156
  rake vinfo:patch # Bumps version segment PATCH
132
157
  rake vinfo:show # Show current version tag and create version_info.yml if missing
133
-
134
- If you prefer Thor:
135
-
136
- VersionInfo::ThorTasks.install(:class => MyProject) # pass here the thing where you included VersionInfo
158
+
137
159
 
138
160
  thor list
139
161
  =>
@@ -145,45 +167,56 @@ If you prefer Thor:
145
167
  thor vinfo:inspect # Show complete version info
146
168
  thor vinfo:show # Show version tag and create version_info.yml...
147
169
 
170
+ Note all tasks works with any version format file!!. So is very easy to migrate for one to the other.
171
+
148
172
  ### Bonus: Custom segments and tag format.
149
173
 
150
174
  You can override the default segments
151
175
 
152
- VersionInfo.segments = [:a, :b, :c]
153
- module MyProject
154
- include VersionInfo
155
- end
176
+ ```ruby
177
+ VersionInfo.segments = [:a, :b, :c]
178
+ module MyProject
179
+ include VersionInfo
180
+ end
181
+ ```
156
182
 
157
183
  Note this must be done **before** include VersionInfo.
158
184
 
159
185
  Also, tag format can be redefined. VersionInfo uses simple
160
186
  sprintf in order to build the tag string. Here is the code:
161
187
 
188
+ ```ruby
162
189
  def tag
163
190
  tag_format % to_hash
164
191
  end
192
+ ```
165
193
 
166
194
  By default, tag_format, returns a simple sprintf format string,
167
195
  using the segment names, expecting their values are numbers:
168
196
 
169
- def tag_format
170
- @tag_format ||= VersionInfo.segments.map { |k| "%<#{k}>d"}.join('.')
171
- end
197
+ ```ruby
198
+ def tag_format
199
+ @tag_format ||= VersionInfo.segments.map { |k| "%<#{k}>d"}.join('.')
200
+ end
201
+ ```
172
202
 
173
203
  So tag_format return some like "%\<major\>d.%\<minor\>d%\<patch\>d".
174
204
 
175
205
  If your VersionInfo yaml file is like:
176
206
 
207
+ ```yaml
177
208
  ---
178
209
  major: 2
179
210
  minor: 1
180
211
  patch: 53
181
212
  buildflag: pre
213
+ ```
182
214
 
183
- You can change the tag format
215
+ You can change the tag format in this way
184
216
 
217
+ ```ruby
185
218
  MyProject::VERSION.buildflag = 'pre'
186
219
  MyProject::VERSION.tag_format = MyProject::VERSION.tag_format + "--%<buildflag>s"
187
220
  puts MyProject::VERSION.tag # => '2.1.53--pre'
188
-
221
+ ```
189
222
 
data/lib/version_info.rb CHANGED
@@ -17,10 +17,10 @@ module VersionInfo
17
17
  end
18
18
 
19
19
  def self.install_tasks(options)
20
- if defined?(:Rake)
20
+ if defined?(Rake)
21
21
  require 'version_info/rake_tasks'
22
22
  RakeTasks.install(options)
23
- elsif defined?(:Thor)
23
+ elsif defined?(Thor)
24
24
  require 'version_info/thor_tasks'
25
25
  ThorTasks.install(options)
26
26
  end
@@ -1,7 +1,7 @@
1
-
2
- module VersionInfo
3
- VERSION = "1.7.0"
4
- versionable(self)
5
- VERSION.file_name = __FILE__
6
- end
7
-
1
+
2
+ module VersionInfo
3
+ VERSION = "1.7.1"
4
+ versionable(self)
5
+ VERSION.file_name = __FILE__
6
+ end
7
+
metadata CHANGED
@@ -1,71 +1,68 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: version_info
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.7.1
4
5
  prerelease:
5
- version: 1.7.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Jorge L. Cangas
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-09-19 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: bundler
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &13584876 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
24
22
  type: :development
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: rake
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *13584876
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &13584516 !ruby/object:Gem::Requirement
30
28
  none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
35
33
  type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
34
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *13584516
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &13584144 !ruby/object:Gem::Requirement
41
39
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
46
44
  type: :development
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: test_notifier
50
45
  prerelease: false
51
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *13584144
47
+ - !ruby/object:Gem::Dependency
48
+ name: test_notifier
49
+ requirement: &13583784 !ruby/object:Gem::Requirement
52
50
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
57
55
  type: :development
58
- version_requirements: *id004
59
- description: Easy way to get version label, bump the segments (major, minor, patch), and you can include custom version data
60
- email:
56
+ prerelease: false
57
+ version_requirements: *13583784
58
+ description: Easy way to get version label, bump the segments (major, minor, patch),
59
+ and you can include custom version data
60
+ email:
61
61
  - jorge.cangas@gmail.com
62
62
  executables: []
63
-
64
63
  extensions: []
65
-
66
64
  extra_rdoc_files: []
67
-
68
- files:
65
+ files:
69
66
  - .gitignore
70
67
  - .travis.yml
71
68
  - Gemfile
@@ -91,30 +88,26 @@ files:
91
88
  - version_info.gemspec
92
89
  homepage: http://github.com/jcangas/version_info
93
90
  licenses: []
94
-
95
91
  post_install_message:
96
92
  rdoc_options: []
97
-
98
- require_paths:
93
+ require_paths:
99
94
  - lib
100
- required_ruby_version: !ruby/object:Gem::Requirement
95
+ required_ruby_version: !ruby/object:Gem::Requirement
101
96
  none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- version: "0"
106
- required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
102
  none: false
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: "0"
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
112
107
  requirements: []
113
-
114
108
  rubyforge_project: version_info
115
- rubygems_version: 1.8.10
109
+ rubygems_version: 1.8.16
116
110
  signing_key:
117
111
  specification_version: 3
118
112
  summary: A Ruby gem to manage your project version data. Rake tasks included!
119
113
  test_files: []
120
-