ore-tasks 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +13 -0
- data/Rakefile +1 -1
- data/gemspec.yml +3 -3
- data/lib/ore/scm/tasks.rb +2 -0
- data/lib/ore/scm/tasks/git.rb +55 -0
- data/lib/ore/scm/tasks/tasks.rb +10 -0
- data/lib/ore/tasks.rb +29 -22
- data/spec/spec_helper.rb +2 -2
- metadata +9 -3
data/ChangeLog.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
### 0.4.2 / 2011-02-15
|
2
|
+
|
3
|
+
* Moved SCM specific logic into {Ore::SCM::Tasks}.
|
4
|
+
* Only `git push` if the Git repository has remote sources.
|
5
|
+
* Added the `status` task which checks for uncommitted changes,
|
6
|
+
and lists modified files.
|
7
|
+
* Have the `build` task depend on the `status` task, to prevent gems
|
8
|
+
from being built, installed or pushed which contain uncomitted changes.
|
9
|
+
|
10
|
+
### 0.4.1 / 2011-02-12
|
11
|
+
|
12
|
+
* Emergency release due to typo.
|
13
|
+
|
1
14
|
### 0.4.0 / 2011-02-12
|
2
15
|
|
3
16
|
* Added {Ore::Tasks#gem}.
|
data/Rakefile
CHANGED
data/gemspec.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
name: ore-tasks
|
2
|
-
version: 0.4.
|
2
|
+
version: 0.4.2
|
3
3
|
summary: Rake tasks for managing and releasing RubyGems using Ore.
|
4
4
|
description:
|
5
5
|
Simple Rake tasks for managing and releasing a RubyGem project generated
|
@@ -10,8 +10,8 @@ homepage: http://github.com/ruby-ore/ore-tasks
|
|
10
10
|
has_yard: true
|
11
11
|
|
12
12
|
dependencies:
|
13
|
-
ore-core: ~> 0.1.3
|
13
|
+
ore-core: ~> 0.1, >= 0.1.3
|
14
14
|
|
15
15
|
development_dependencies:
|
16
|
-
rspec: ~> 2.4
|
16
|
+
rspec: ~> 2.4
|
17
17
|
yard: ~> 0.6.0
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Ore
|
2
|
+
module SCM
|
3
|
+
module Tasks
|
4
|
+
module Git
|
5
|
+
#
|
6
|
+
# Registers the `sync` and `tag` release tasks when extended.
|
7
|
+
#
|
8
|
+
def self.extended(tasks)
|
9
|
+
tasks.release_tasks.unshift('sync')
|
10
|
+
tasks.release_tasks.push('tag')
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# Defines the [Git](http://www.git-scm.com) specific tasks.
|
15
|
+
#
|
16
|
+
def define_scm_tasks
|
17
|
+
@remote = `git remote`.empty?
|
18
|
+
|
19
|
+
task :sync do
|
20
|
+
run 'git', 'push' if @remote
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Tags a release and pushes the tag'
|
24
|
+
task :tag do
|
25
|
+
run 'git', 'tag', "v#{@project.version}"
|
26
|
+
run 'git', 'push', '--tags' if @remote
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Lists the modified files within the project.
|
32
|
+
#
|
33
|
+
# @return [Hash{String => String}]
|
34
|
+
# The paths and statuses of the modified files.
|
35
|
+
#
|
36
|
+
# @since 0.4.2
|
37
|
+
#
|
38
|
+
def dirty_files
|
39
|
+
files = {}
|
40
|
+
|
41
|
+
`git status --porcelain`.each_line do |line|
|
42
|
+
status, name = line.chomp.split
|
43
|
+
|
44
|
+
# ignore untracked files
|
45
|
+
unless status == '??'
|
46
|
+
files[name] = status
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
return files
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/ore/tasks.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ore/scm/tasks'
|
1
2
|
require 'ore/project'
|
2
3
|
|
3
4
|
require 'rake/tasklib'
|
@@ -29,8 +30,20 @@ module Ore
|
|
29
30
|
# Defines the core Ore tasks.
|
30
31
|
#
|
31
32
|
def define_core_tasks
|
33
|
+
task :status do
|
34
|
+
changes = dirty_files
|
35
|
+
|
36
|
+
unless changes.empty?
|
37
|
+
puts "The following files were modified:"
|
38
|
+
changes.each { |path,status| puts "#{status}\t#{path}" }
|
39
|
+
puts
|
40
|
+
|
41
|
+
abort "The project has uncommitted changes!"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
32
45
|
desc "Only builds a Gem"
|
33
|
-
task :build do
|
46
|
+
task :build => :status do
|
34
47
|
@project.build!
|
35
48
|
end
|
36
49
|
|
@@ -99,24 +112,6 @@ module Ore
|
|
99
112
|
end
|
100
113
|
end
|
101
114
|
|
102
|
-
#
|
103
|
-
# Defines the Ore tasks specific to [git](http://www.git-scm.com).
|
104
|
-
#
|
105
|
-
def define_git_tasks
|
106
|
-
task :sync do
|
107
|
-
run 'git', 'push'
|
108
|
-
end
|
109
|
-
|
110
|
-
desc 'Tags a release and pushes the tag'
|
111
|
-
task :tag do
|
112
|
-
run 'git', 'tag', "v#{@project.version}"
|
113
|
-
run 'git', 'push', '--tags'
|
114
|
-
end
|
115
|
-
|
116
|
-
@release_tasks.unshift('sync')
|
117
|
-
@release_tasks.push('tag')
|
118
|
-
end
|
119
|
-
|
120
115
|
#
|
121
116
|
# Defines the RubyGems specific tasks.
|
122
117
|
#
|
@@ -149,9 +144,9 @@ module Ore
|
|
149
144
|
def define
|
150
145
|
define_core_tasks
|
151
146
|
|
152
|
-
|
153
|
-
|
154
|
-
|
147
|
+
if (scm_tasks = SCM::Tasks::SUPPORTED[@project.scm])
|
148
|
+
extend scm_tasks
|
149
|
+
define_scm_tasks
|
155
150
|
end
|
156
151
|
|
157
152
|
unless @project.bundler?
|
@@ -198,5 +193,17 @@ module Ore
|
|
198
193
|
run(RUBY,'-S','gem',*arguments)
|
199
194
|
end
|
200
195
|
|
196
|
+
#
|
197
|
+
# Lists the modified files within the project.
|
198
|
+
#
|
199
|
+
# @return [Hash{String => String}]
|
200
|
+
# The paths and statuses of the modified files.
|
201
|
+
#
|
202
|
+
# @since 0.4.2
|
203
|
+
#
|
204
|
+
def dirty_files
|
205
|
+
{}
|
206
|
+
end
|
207
|
+
|
201
208
|
end
|
202
209
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ore-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Postmodern
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-02-
|
13
|
+
date: 2011-02-15 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -20,6 +20,9 @@ dependencies:
|
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
22
|
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0.1"
|
25
|
+
- - ">="
|
23
26
|
- !ruby/object:Gem::Version
|
24
27
|
version: 0.1.3
|
25
28
|
type: :runtime
|
@@ -32,7 +35,7 @@ dependencies:
|
|
32
35
|
requirements:
|
33
36
|
- - ~>
|
34
37
|
- !ruby/object:Gem::Version
|
35
|
-
version: 2.4
|
38
|
+
version: "2.4"
|
36
39
|
type: :development
|
37
40
|
version_requirements: *id002
|
38
41
|
- !ruby/object:Gem::Dependency
|
@@ -66,6 +69,9 @@ files:
|
|
66
69
|
- README.md
|
67
70
|
- Rakefile
|
68
71
|
- gemspec.yml
|
72
|
+
- lib/ore/scm/tasks.rb
|
73
|
+
- lib/ore/scm/tasks/git.rb
|
74
|
+
- lib/ore/scm/tasks/tasks.rb
|
69
75
|
- lib/ore/tasks.rb
|
70
76
|
- ore-tasks.gemspec
|
71
77
|
- spec/spec_helper.rb
|