quandl_utility 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -0,0 +1,46 @@
1
+ # Quandl::Utility
2
+
3
+ ## Purpose
4
+
5
+ The purpose of this gem is to:
6
+
7
+ - maintain semantic versioning
8
+ - maintain a changelog that lists commits for each version, matching a set of patterns
9
+
10
+
11
+ ## Installation
12
+
13
+ ```ruby
14
+ gem 'quandl_utility'
15
+ ```
16
+
17
+
18
+ ## Configuration
19
+
20
+ Add this to your Rakefile:
21
+
22
+ ```ruby
23
+ require 'quandl/utility/rake_tasks'
24
+
25
+ Quandl::Utility::Tasks.configure do |c|
26
+ c.name = 'gem_name'
27
+ c.version_path = 'VERSION'
28
+ c.changelog_path = 'CHANGELOG.md'
29
+ c.changelog_matching = ['^JIRA','^GITHUB']
30
+ end
31
+ ```
32
+
33
+
34
+ ## Usage
35
+
36
+
37
+ ```bash
38
+ $ rake -T
39
+
40
+ rake gem_name:bump:major # Perform major bump to gem_name
41
+ rake gem_name:bump:minor # Perform minor bump to gem_name
42
+ rake gem_name:bump:patch # Perform patch bump to gem_name
43
+
44
+ $ rake gem_name:bump:minor && rake release
45
+ ```
46
+
data/Rakefile CHANGED
@@ -15,7 +15,8 @@ end
15
15
 
16
16
  Quandl::Utility::Tasks.configure do |c|
17
17
  c.name = 'quandl_utility'
18
+ c.tag_prefix = 'v'
18
19
  c.version_path = File.join( Quandl::Utility.root_path, 'VERSION' )
19
20
  c.changelog_path = File.join( Quandl::Utility.root_path, 'UPGRADE.md' )
20
- c.changelog_matching = ['^QUGC','^WIKI']
21
+ c.changelog_matching = ['^QUGC','^WIKI', '^FIX']
21
22
  end
data/UPGRADE.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.1.0
2
+
3
+ * FIX Add configurable tag_prefix. Files will be created if missing
4
+
5
+
6
+
1
7
  ## 0.0.5
2
8
 
3
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.1.0
@@ -17,10 +17,18 @@ class Tasks
17
17
  end
18
18
 
19
19
  class TaskConfig < Quandl::Utility::Configuration
20
- define_attributes :name, :changelog_path, :changelog_matching, :version_path
20
+ define_attributes :name, :changelog_path, :changelog_matching, :version_path, :tag_prefix
21
+
22
+ def version_with_prefix
23
+ "#{tag_prefix}#{version}"
24
+ end
25
+
26
+ def tag_prefix
27
+ read_attribute(:tag_prefix)
28
+ end
21
29
 
22
30
  def version
23
- @version ||= File.read(version_path)
31
+ @version ||= File.exists?(version_path) ? File.read(version_path) : '0.0.0'
24
32
  end
25
33
 
26
34
  end
@@ -1,7 +1,20 @@
1
1
  gemc = Quandl::Utility::Tasks.configuration
2
2
 
3
+ task :console do |t, args|
4
+ require 'pry'
5
+ binding.pry
6
+ end
7
+
3
8
  namespace gemc.name do
4
9
 
10
+ desc "Tag #{gemc.name} with #{gemc.version_with_prefix}"
11
+ task :tag do
12
+ raise "Must be a git repo." if %x{git status 2>&1} =~ /Not a git repository/
13
+ version = "#{gemc.tag_prefix}#{File.read('VERSION')}"
14
+ system("git tag -a #{version} -m 'Release #{version}'")
15
+ system("git push --tags")
16
+ end
17
+
5
18
  namespace :bump do
6
19
 
7
20
  desc "Perform major bump to #{gemc.name}"
@@ -27,6 +40,7 @@ namespace :quandl do
27
40
 
28
41
  task :perform, :severity do |t, args|
29
42
  # update changelog
43
+ raise "Must be a git repo." if %x{git status 2>&1} =~ /Not a git repository/
30
44
  raise "You have unstaged commits." if %x{git status} =~ /Changes not staged for commit/
31
45
  Rake::Task['quandl:bump:version'].execute( severity: args[:severity] )
32
46
  Rake::Task['quandl:changelog:update'].execute
@@ -62,7 +76,7 @@ namespace :quandl do
62
76
  namespace :changelog do
63
77
  task :update do |t, args|
64
78
  # collect commits that match JIRA syntax
65
- since = "v#{gemc.version}"
79
+ since = gemc.version_with_prefix
66
80
  commits = gemc.changelog_matching.collect do |matching|
67
81
  %x{ git --no-pager log #{since}..HEAD --pretty=oneline --grep='#{matching}'}
68
82
  end.join
@@ -74,7 +88,9 @@ namespace :quandl do
74
88
  # prepend to UPGRADE.md
75
89
  changelog = gemc.changelog_path
76
90
  puts "Appending commits matching #{gemc.changelog_matching.join(" ")} to #{changelog}\n#{commits}"
77
- File.write( changelog, commits + File.read( changelog ) )
91
+ # check for existing changes
92
+ existing_changes = File.exists?(changelog) ? File.read( changelog ) : ''
93
+ File.write( changelog, commits + existing_changes )
78
94
  system("git add #{changelog}; git commit -m 'Updated changelog with commits from #{new_version}'")
79
95
  end
80
96
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_utility
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-05 00:00:00.000000000 Z
12
+ date: 2014-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport