reposh 0.1.2 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +49 -33
- data/bin/reposh +3 -170
- data/lib/reposh.rb +226 -0
- data/sample.reposh.yaml +25 -0
- metadata +17 -33
- data/ChangeLog +0 -4
- data/Rakefile +0 -133
- data/bin/reposh.bat +0 -1
- data/test/reposh_test.rb +0 -8
- data/test/test_helper.rb +0 -3
data/README
CHANGED
@@ -1,33 +1,49 @@
|
|
1
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
1
|
+
== Reposh - what's this?
|
2
|
+
|
3
|
+
Without reposh, you type like this:
|
4
|
+
$ svk di
|
5
|
+
$ svk ci
|
6
|
+
$ svk st
|
7
|
+
$ ls
|
8
|
+
but this is not DRY :)
|
9
|
+
|
10
|
+
With reposh, you can omit typing all 'svk's:
|
11
|
+
$ reposh
|
12
|
+
Welcome to reposh x.y.z (mode: svk)
|
13
|
+
> di
|
14
|
+
> ci
|
15
|
+
> # just push [Enter] for 'svk status'
|
16
|
+
> :ls # start with ':' to run shell commands
|
17
|
+
|
18
|
+
== How to use
|
19
|
+
|
20
|
+
(1) write /home/(your name)/.reposh.yaml
|
21
|
+
(2) cd to your working directory
|
22
|
+
(3) reposh.rb [Enter]
|
23
|
+
|
24
|
+
== Options
|
25
|
+
|
26
|
+
see reposh.rb --help
|
27
|
+
|
28
|
+
== Commands
|
29
|
+
|
30
|
+
* exit, quit, ^D(^Z)
|
31
|
+
* Quit reposh
|
32
|
+
* :ls ~/
|
33
|
+
* Run "ls ~/" by shell
|
34
|
+
* [Enter]
|
35
|
+
* Equals to "status" (you can change this by .reposh.yaml)
|
36
|
+
* %reload
|
37
|
+
* Reload reposh.rb (for reposh developper)
|
38
|
+
* Some more commands starts with % are supported: see source
|
39
|
+
|
40
|
+
All other commands are passed to vcs system.
|
41
|
+
|
42
|
+
== Configuration
|
43
|
+
|
44
|
+
see sample.reposh.yaml
|
45
|
+
|
46
|
+
== Contact
|
47
|
+
|
48
|
+
http://mono.kmc.gr.jp/~yhara/w?Reposh
|
49
|
+
|
data/bin/reposh
CHANGED
@@ -1,173 +1,6 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
# reposh.rb - Reposh - Simple VCS Manager Shell
|
3
|
-
# usage:
|
4
|
-
# read bottom of this file
|
5
|
-
#
|
6
|
-
require 'readline'
|
7
|
-
require 'yaml'
|
8
|
-
require 'optparse'
|
9
|
-
|
10
|
-
class Reposh
|
11
|
-
VERSION = "0.1.2"
|
12
|
-
CONF_DEFAULT = { "system" => {
|
13
|
-
"default" => {
|
14
|
-
"binpath" => nil,
|
15
|
-
"prompt" => "> ",
|
16
|
-
"default_cmd" => "status",
|
17
|
-
},
|
18
|
-
"darcs" => {
|
19
|
-
"default_cmd" => "whatsnew --summary",
|
20
|
-
}
|
21
|
-
}}
|
22
|
-
|
23
|
-
def initialize
|
24
|
-
end
|
25
|
-
|
26
|
-
def run
|
27
|
-
parse_option(ARGV)
|
28
|
-
@conf_path ||= File.join(ENV["HOME"], ".reposh.yaml")
|
29
|
-
@system_name ||= guess_system
|
30
|
-
|
31
|
-
@conf = load_config(@conf_path)
|
32
|
-
@binpath = get_conf("binpath") || @system_name
|
33
|
-
@prompt = get_conf("prompt")
|
34
|
-
@default_cmd = get_conf("default_cmd")
|
35
|
-
run_loop
|
36
|
-
end
|
37
|
-
|
38
|
-
def parse_option(args)
|
39
|
-
o = OptionParser.new{|opt|
|
40
|
-
opt.on("-c confpath",
|
41
|
-
"path to .reposh.yaml"){|path|
|
42
|
-
@confpath = path
|
43
|
-
}
|
44
|
-
opt.on("-s system",
|
45
|
-
"vcs command name (eg. svn, svk, hg)"){|sys|
|
46
|
-
@system_name = sys
|
47
|
-
}
|
48
|
-
opt.on("-h", "--help",
|
49
|
-
"show this message"){
|
50
|
-
puts opt
|
51
|
-
exit
|
52
|
-
}
|
53
|
-
opt.on("-v", "--version",
|
54
|
-
"show version information"){
|
55
|
-
puts VERSION
|
56
|
-
exit
|
57
|
-
}
|
58
|
-
}
|
59
|
-
o.parse(args)
|
60
|
-
end
|
61
|
-
|
62
|
-
def load_config(path)
|
63
|
-
if File.exist?(path)
|
64
|
-
YAML.load(File.read(path))
|
65
|
-
else
|
66
|
-
CONF_DEFAULT
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def guess_system
|
71
|
-
case
|
72
|
-
when File.directory?(".hg")
|
73
|
-
"hg"
|
74
|
-
when File.directory?("_darcs")
|
75
|
-
"darcs"
|
76
|
-
when File.directory?(".svn")
|
77
|
-
"svn"
|
78
|
-
else
|
79
|
-
"svk"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def get_conf(prop)
|
84
|
-
value = (@conf["system"][@system_name] and @conf["system"][@system_name][prop])
|
85
|
-
value ||= (CONF_DEFAULT["system"][@system_name] && CONF_DEFAULT["system"][@system_name][prop])
|
86
|
-
value ||= CONF_DEFAULT["system"]["default"][prop]
|
87
|
-
end
|
88
|
-
|
89
|
-
def run_loop
|
90
|
-
puts "Welcome to reposh #{VERSION} (mode: #{@system_name})"
|
91
|
-
loop do
|
92
|
-
cmd = Readline.readline(@prompt, true)
|
93
|
-
cmd = @default_cmd if cmd == ""
|
94
|
-
|
95
|
-
case cmd
|
96
|
-
when "%reload"
|
97
|
-
load __FILE__
|
98
|
-
when "%env"
|
99
|
-
require 'pp'
|
100
|
-
pp ENV
|
101
|
-
when "%version"
|
102
|
-
puts VERSION
|
103
|
-
when nil, "exit", "quit"
|
104
|
-
puts ""
|
105
|
-
exit
|
106
|
-
when /^:(.*)/
|
107
|
-
puts $1
|
108
|
-
execute $1
|
109
|
-
else
|
110
|
-
execute "#{@binpath} #{cmd}"
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def execute(cmd)
|
116
|
-
result = system(cmd)
|
117
|
-
if (not result) and ($?.nil? or $?.exitstatus == 127)
|
118
|
-
puts "error: failed to exec '#{cmd}'"
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
3
|
|
4
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), '../lib')
|
5
|
+
require 'reposh'
|
123
6
|
Reposh.new.run
|
124
|
-
|
125
|
-
=begin
|
126
|
-
== Reposh - what's this?
|
127
|
-
Without reposh:
|
128
|
-
$ svk st
|
129
|
-
$ svk di
|
130
|
-
$ svk ci
|
131
|
-
$ ls
|
132
|
-
|
133
|
-
With reposh:
|
134
|
-
$ reposh
|
135
|
-
> st
|
136
|
-
> di
|
137
|
-
> ci
|
138
|
-
> :ls
|
139
|
-
|
140
|
-
== How to use
|
141
|
-
(1) write /home/(your name)/.reposh.yaml
|
142
|
-
(2) cd to your working directory
|
143
|
-
(3) reposh.rb [Enter]
|
144
|
-
|
145
|
-
== Options
|
146
|
-
see reposh.rb --help
|
147
|
-
|
148
|
-
== Commands
|
149
|
-
* exit, quit, ^D(^Z)
|
150
|
-
* Quit reposh
|
151
|
-
* :ls ~/
|
152
|
-
* Run "ls ~/" by shell
|
153
|
-
* [Enter]
|
154
|
-
* Equals to "status" (you can change this by .reposh.yaml)
|
155
|
-
* %reload
|
156
|
-
* Reload reposh.rb (for reposh developper)
|
157
|
-
* Some more commands starts with % are supported: see source
|
158
|
-
|
159
|
-
All other commands are passed to vcs system.
|
160
|
-
|
161
|
-
== Sample .reposh.yaml
|
162
|
-
system:
|
163
|
-
default:
|
164
|
-
prompt: "> "
|
165
|
-
svn:
|
166
|
-
binpath: svn
|
167
|
-
svk:
|
168
|
-
binpath: c:/prog/svk/bin/svk.bat
|
169
|
-
prompt: "svk > "
|
170
|
-
default_cmd: "status"
|
171
|
-
hg:
|
172
|
-
binpath: hg
|
173
|
-
=end
|
data/lib/reposh.rb
CHANGED
@@ -1,4 +1,230 @@
|
|
1
|
+
require 'readline'
|
2
|
+
require 'yaml'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
class Hash
|
6
|
+
def recursive_merge(other)
|
7
|
+
self.merge(other) do |key, my_val, other_val|
|
8
|
+
# for values of a same key
|
9
|
+
if my_val.is_a? Hash and other_val.is_a? Hash
|
10
|
+
my_val.recursive_merge(other_val) # XXX: hang-ups for cyclic hash?
|
11
|
+
else
|
12
|
+
other_val
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
1
17
|
|
2
18
|
class Reposh
|
19
|
+
VERSION = "0.1.6"
|
20
|
+
CONF_DEFAULT = {
|
21
|
+
"global" => {
|
22
|
+
"editing_mode" => nil,
|
23
|
+
"custom_commands" => [],
|
24
|
+
"pathext" => [],
|
25
|
+
},
|
26
|
+
"system" => {
|
27
|
+
"default" => {
|
28
|
+
"binpath" => nil,
|
29
|
+
"prompt" => "> ",
|
30
|
+
"default_cmd" => "status",
|
31
|
+
},
|
32
|
+
"darcs" => {
|
33
|
+
"default_cmd" => "whatsnew --summary",
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
def run
|
39
|
+
parse_option(ARGV)
|
40
|
+
@conf_path ||= File.join(ENV["HOME"], ".reposh.yaml")
|
41
|
+
@system_name ||= guess_system
|
42
|
+
|
43
|
+
@conf = load_config(@conf_path)
|
44
|
+
@editing_mode = @conf["global"]["editing_mode"]
|
45
|
+
pathext = @conf["global"]["pathext"]
|
46
|
+
@prompt = get_conf(@system_name, "prompt")
|
47
|
+
binpath = get_conf(@system_name, "binpath") || @system_name
|
48
|
+
default_cmd = get_conf(@system_name, "default_cmd")
|
49
|
+
|
50
|
+
@commands = Commands.new(binpath, default_cmd, pathext)
|
51
|
+
@commands.register_custom_commands(@conf["global"]["custom_commands"])
|
52
|
+
|
53
|
+
run_loop
|
54
|
+
end
|
55
|
+
|
56
|
+
def parse_option(args)
|
57
|
+
o = OptionParser.new{|opt|
|
58
|
+
opt.on("-c confpath",
|
59
|
+
"path to .reposh.yaml"){|path|
|
60
|
+
@confpath = path
|
61
|
+
}
|
62
|
+
opt.on("-s system",
|
63
|
+
"vcs command name (eg. svn, svk, hg)"){|sys|
|
64
|
+
@system_name = sys
|
65
|
+
}
|
66
|
+
opt.on("-h", "--help",
|
67
|
+
"show this message"){
|
68
|
+
puts opt
|
69
|
+
exit
|
70
|
+
}
|
71
|
+
opt.on("-v", "--version",
|
72
|
+
"show version information"){
|
73
|
+
puts VERSION
|
74
|
+
exit
|
75
|
+
}
|
76
|
+
}
|
77
|
+
o.parse(args)
|
78
|
+
end
|
79
|
+
|
80
|
+
def load_config(path)
|
81
|
+
if File.exist?(path)
|
82
|
+
config_hash = YAML.load(File.read(path))
|
83
|
+
CONF_DEFAULT.recursive_merge(config_hash)
|
84
|
+
else
|
85
|
+
CONF_DEFAULT
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def guess_system
|
90
|
+
case
|
91
|
+
when File.directory?(".hg")
|
92
|
+
"hg"
|
93
|
+
when File.directory?("_darcs")
|
94
|
+
"darcs"
|
95
|
+
when File.directory?(".svn")
|
96
|
+
"svn"
|
97
|
+
else
|
98
|
+
"svk"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def get_conf(system, prop)
|
103
|
+
(@conf["system"][system] and @conf["system"][system][prop]) or @conf["system"]["default"][prop]
|
104
|
+
end
|
105
|
+
|
106
|
+
def run_loop
|
107
|
+
if @editing_mode == "vi"
|
108
|
+
Readline.vi_editing_mode
|
109
|
+
end
|
110
|
+
|
111
|
+
puts "Welcome to reposh #{VERSION} (mode: #{@system_name})"
|
112
|
+
loop do
|
113
|
+
cmd = Readline.readline(@prompt, true)
|
114
|
+
@commands.dispatch(cmd, @system_name)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
class Commands
|
119
|
+
def initialize(binpath, default_cmd, pathext)
|
120
|
+
@binpath, @default_cmd, @pathext = binpath, default_cmd, pathext
|
121
|
+
@commands = []
|
122
|
+
register_builtin_commands
|
123
|
+
end
|
124
|
+
|
125
|
+
def register_builtin_commands
|
126
|
+
# default command
|
127
|
+
register(/.*/){|match|
|
128
|
+
cmd = (match[0] == "") ? @default_cmd : match[0]
|
129
|
+
execute "#{@binpath} #{cmd}"
|
130
|
+
}
|
131
|
+
|
132
|
+
# system commands
|
133
|
+
register("%reload"){
|
134
|
+
load __FILE__
|
135
|
+
}
|
136
|
+
register("%env"){
|
137
|
+
require 'pp'
|
138
|
+
pp ENV
|
139
|
+
}
|
140
|
+
register("%version"){
|
141
|
+
puts VERSION
|
142
|
+
}
|
143
|
+
register(/\A%ruby (.*)/){|match|
|
144
|
+
puts "reposh: result is " + eval(match[1]).inspect
|
145
|
+
}
|
146
|
+
@trace_mode = false
|
147
|
+
register("%trace"){
|
148
|
+
@trace_mode = (not @trace_mode)
|
149
|
+
puts "set trace_mode to #{@trace_mode}"
|
150
|
+
}
|
151
|
+
|
152
|
+
# exit commands
|
153
|
+
exit_task = lambda{
|
154
|
+
puts ""
|
155
|
+
exit
|
156
|
+
}
|
157
|
+
register(nil, &exit_task)
|
158
|
+
register("exit", &exit_task)
|
159
|
+
register("quit", &exit_task)
|
160
|
+
|
161
|
+
# shell execution command
|
162
|
+
register(/^:(.*)/){|match|
|
163
|
+
execute match[1]
|
164
|
+
}
|
165
|
+
end
|
166
|
+
|
167
|
+
def register_custom_commands(commands)
|
168
|
+
commands.each do |hash|
|
169
|
+
if hash["for"]
|
170
|
+
systems = hash["for"].split(/,/).map{|s| s.strip}
|
171
|
+
else
|
172
|
+
systems = nil
|
173
|
+
end
|
174
|
+
register(Regexp.new(hash["pattern"]), systems){|match|
|
175
|
+
cmd = hash["rule"].
|
176
|
+
gsub(/\{system\}/, @binpath).
|
177
|
+
gsub(/\{\$(\d+)\}/){ match[$1.to_i] }
|
178
|
+
puts cmd
|
179
|
+
execute cmd
|
180
|
+
}
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def register(pattern, systems = nil, &task)
|
185
|
+
@commands.unshift [pattern, systems, task]
|
186
|
+
end
|
187
|
+
|
188
|
+
def dispatch(cmd, sys)
|
189
|
+
@commands.each do |pattern, systems, task|
|
190
|
+
next if systems && !systems.include?(sys)
|
191
|
+
|
192
|
+
if (match = match?(pattern, cmd))
|
193
|
+
return task.call(match)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
raise "must not happen"
|
197
|
+
end
|
198
|
+
|
199
|
+
def match?(pat, value)
|
200
|
+
case pat
|
201
|
+
when Regexp
|
202
|
+
pat.match(value)
|
203
|
+
when nil
|
204
|
+
value == nil
|
205
|
+
else
|
206
|
+
pat.strip == value
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def execute(cmd)
|
211
|
+
stat = false
|
212
|
+
([""] + @pathext).each do |ext|
|
213
|
+
command = add_ext(cmd, ext)
|
214
|
+
puts command if @trace_mode
|
215
|
+
result = system(command)
|
216
|
+
return if result
|
217
|
+
stat = $?
|
218
|
+
end
|
219
|
+
puts "reposh: failed to exec '#{cmd}': status #{stat.exitstatus}"
|
220
|
+
end
|
221
|
+
|
222
|
+
def add_ext(cmd, ext)
|
223
|
+
exe, *args = cmd.split(' ')
|
224
|
+
"#{exe}#{ext} #{args.join ' '}"
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
3
228
|
|
4
229
|
end
|
230
|
+
|
data/sample.reposh.yaml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
global:
|
2
|
+
editing_mode: vi # default is: emacs
|
3
|
+
# pathext: [".bat", ".cmd"] # for windows users
|
4
|
+
custom_commands:
|
5
|
+
# > ignore_of lib => svn propedit svn:ignore lib
|
6
|
+
- pattern: \Aignore_of (.*)
|
7
|
+
rule: "{system} propedit svn:ignore {$1}"
|
8
|
+
for: svn, svk
|
9
|
+
# > ignore lib/*.o => svn propset svn:ignore *.o lib
|
10
|
+
- pattern: \Aignore (.*)[\\/]([^\\/]+)
|
11
|
+
rule: "{system} propset svn:ignore {$2} {$1}"
|
12
|
+
for: svn, svk
|
13
|
+
|
14
|
+
# settings for each vcs
|
15
|
+
system:
|
16
|
+
default: # for all vcs
|
17
|
+
prompt: "> "
|
18
|
+
svn:
|
19
|
+
binpath: svn
|
20
|
+
svk:
|
21
|
+
binpath: c:/prog/svk/bin/svk.bat # path to svk
|
22
|
+
prompt: "svk > " # prompt
|
23
|
+
default_cmd: "status" # used when you just type [Enter]
|
24
|
+
hg:
|
25
|
+
binpath: hg
|
metadata
CHANGED
@@ -1,52 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reposh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- yhara (Yutaka HARA)
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-06-23 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
17
|
-
email:
|
16
|
+
description:
|
17
|
+
email: yhara,at,kmc,gr,jp
|
18
18
|
executables:
|
19
19
|
- reposh
|
20
20
|
extensions: []
|
21
21
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
24
|
-
- ChangeLog
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
25
24
|
files:
|
26
25
|
- README
|
27
|
-
-
|
28
|
-
- Rakefile
|
26
|
+
- sample.reposh.yaml
|
29
27
|
- bin/reposh
|
30
|
-
- bin/reposh.bat
|
31
|
-
- test/reposh_test.rb
|
32
|
-
- test/test_helper.rb
|
33
28
|
- lib/reposh.rb
|
34
|
-
has_rdoc:
|
35
|
-
homepage: http://
|
29
|
+
has_rdoc: false
|
30
|
+
homepage: http://mono.kmc.gr.jp/~yhara/
|
36
31
|
post_install_message:
|
37
|
-
rdoc_options:
|
38
|
-
|
39
|
-
- reposh documentation
|
40
|
-
- --charset
|
41
|
-
- utf-8
|
42
|
-
- --opname
|
43
|
-
- index.html
|
44
|
-
- --line-numbers
|
45
|
-
- --main
|
46
|
-
- README
|
47
|
-
- --inline-source
|
48
|
-
- --exclude
|
49
|
-
- ^(examples|extras)/
|
32
|
+
rdoc_options: []
|
33
|
+
|
50
34
|
require_paths:
|
51
35
|
- lib
|
52
36
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -64,9 +48,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
48
|
requirements: []
|
65
49
|
|
66
50
|
rubyforge_project: reposh
|
67
|
-
rubygems_version: 1.
|
51
|
+
rubygems_version: 1.1.1
|
68
52
|
signing_key:
|
69
53
|
specification_version: 2
|
70
|
-
summary:
|
71
|
-
test_files:
|
72
|
-
|
54
|
+
summary: Simple VCS Shell
|
55
|
+
test_files: []
|
56
|
+
|
data/ChangeLog
DELETED
data/Rakefile
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'rake/clean'
|
4
|
-
require 'rake/testtask'
|
5
|
-
require 'rake/packagetask'
|
6
|
-
require 'rake/gempackagetask'
|
7
|
-
require 'rake/rdoctask'
|
8
|
-
require 'rake/contrib/rubyforgepublisher'
|
9
|
-
require 'rake/contrib/sshpublisher'
|
10
|
-
require 'fileutils'
|
11
|
-
|
12
|
-
require 'rubyforge'
|
13
|
-
include FileUtils
|
14
|
-
|
15
|
-
NAME = "reposh"
|
16
|
-
AUTHOR = "ujihisa"
|
17
|
-
EMAIL = "ujihisa@gmail.com"
|
18
|
-
DESCRIPTION = "Reposh - Simple VCS Manager Shell"
|
19
|
-
RUBYFORGE_PROJECT = "reposh"
|
20
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
21
|
-
BIN_FILES = %w(reposh)
|
22
|
-
VERS = "0.1.2"
|
23
|
-
|
24
|
-
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
25
|
-
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
26
|
-
RDOC_OPTS = [
|
27
|
-
'--title', "#{NAME} documentation",
|
28
|
-
"--charset", "utf-8",
|
29
|
-
"--opname", "index.html",
|
30
|
-
"--line-numbers",
|
31
|
-
"--main", "README",
|
32
|
-
"--inline-source",
|
33
|
-
]
|
34
|
-
|
35
|
-
task :default => [:test]
|
36
|
-
task :package => [:clean]
|
37
|
-
|
38
|
-
Rake::TestTask.new("test") do |t|
|
39
|
-
t.libs << "test"
|
40
|
-
t.pattern = "test/**/*_test.rb"
|
41
|
-
t.verbose = true
|
42
|
-
end
|
43
|
-
|
44
|
-
spec = Gem::Specification.new do |s|
|
45
|
-
s.name = NAME
|
46
|
-
s.version = VERS
|
47
|
-
s.platform = Gem::Platform::RUBY
|
48
|
-
s.has_rdoc = true
|
49
|
-
s.extra_rdoc_files = ["README", "ChangeLog"]
|
50
|
-
s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
|
51
|
-
s.summary = DESCRIPTION
|
52
|
-
s.description = DESCRIPTION
|
53
|
-
s.author = AUTHOR
|
54
|
-
s.email = EMAIL
|
55
|
-
s.homepage = HOMEPATH
|
56
|
-
s.executables = BIN_FILES
|
57
|
-
s.rubyforge_project = RUBYFORGE_PROJECT
|
58
|
-
s.bindir = "bin"
|
59
|
-
s.require_path = "lib"
|
60
|
-
s.autorequire = ""
|
61
|
-
s.test_files = Dir["test/test_*.rb"]
|
62
|
-
|
63
|
-
#s.add_dependency('activesupport', '>=1.3.1')
|
64
|
-
#s.required_ruby_version = '>= 1.8.2'
|
65
|
-
|
66
|
-
s.files = %w(README ChangeLog Rakefile) +
|
67
|
-
Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
|
68
|
-
Dir.glob("ext/**/*.{h,c,rb}") +
|
69
|
-
Dir.glob("examples/**/*.rb") +
|
70
|
-
Dir.glob("tools/*.rb")
|
71
|
-
|
72
|
-
s.extensions = FileList["ext/**/extconf.rb"].to_a
|
73
|
-
end
|
74
|
-
|
75
|
-
Rake::GemPackageTask.new(spec) do |p|
|
76
|
-
p.need_tar = true
|
77
|
-
p.gem_spec = spec
|
78
|
-
end
|
79
|
-
|
80
|
-
task :install do
|
81
|
-
name = "#{NAME}-#{VERS}.gem"
|
82
|
-
sh %{rake package}
|
83
|
-
sh %{sudo gem install pkg/#{name}}
|
84
|
-
end
|
85
|
-
|
86
|
-
task :uninstall => [:clean] do
|
87
|
-
sh %{sudo gem uninstall #{NAME}}
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
Rake::RDocTask.new do |rdoc|
|
92
|
-
rdoc.rdoc_dir = 'html'
|
93
|
-
rdoc.options += RDOC_OPTS
|
94
|
-
rdoc.template = "resh"
|
95
|
-
#rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
96
|
-
if ENV['DOC_FILES']
|
97
|
-
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
|
98
|
-
else
|
99
|
-
rdoc.rdoc_files.include('README', 'ChangeLog')
|
100
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
101
|
-
rdoc.rdoc_files.include('ext/**/*.c')
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
desc "Publish to RubyForge"
|
106
|
-
task :rubyforge => [:rdoc, :package] do
|
107
|
-
require 'rubyforge'
|
108
|
-
Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'ujihisa').upload
|
109
|
-
end
|
110
|
-
|
111
|
-
desc 'Package and upload the release to rubyforge.'
|
112
|
-
task :release => [:clean, :package] do |t|
|
113
|
-
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
|
114
|
-
abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
|
115
|
-
pkg = "pkg/#{NAME}-#{VERS}"
|
116
|
-
|
117
|
-
rf = RubyForge.new
|
118
|
-
puts "Logging in"
|
119
|
-
rf.login
|
120
|
-
|
121
|
-
c = rf.userconfig
|
122
|
-
# c["release_notes"] = description if description
|
123
|
-
# c["release_changes"] = changes if changes
|
124
|
-
c["preformatted"] = true
|
125
|
-
|
126
|
-
files = [
|
127
|
-
"#{pkg}.tgz",
|
128
|
-
"#{pkg}.gem"
|
129
|
-
].compact
|
130
|
-
|
131
|
-
puts "Releasing #{NAME} v. #{VERS}"
|
132
|
-
rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
|
133
|
-
end
|
data/bin/reposh.bat
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
@ruby d:/proj/reposh/reposh %*
|
data/test/reposh_test.rb
DELETED
data/test/test_helper.rb
DELETED