reposh 0.1.2

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.
@@ -0,0 +1,4 @@
1
+ == 0.1.2 / 2008-01-31
2
+
3
+ * initial release
4
+
data/README ADDED
@@ -0,0 +1,33 @@
1
+
2
+ = reposh
3
+
4
+ Simple VCS Manager Shell
5
+
6
+ == Description
7
+
8
+ http://mono.kmc.gr.jp/~yhara/w/?Reposh
9
+ http://rubyforge.org/projects/reposh/
10
+
11
+ == Installation
12
+
13
+ === Archive Installation
14
+
15
+ rake install
16
+
17
+ === Gem Installation
18
+
19
+ gem install reposh
20
+
21
+
22
+ == Features/Problems
23
+
24
+ * vim-like keybind
25
+
26
+ == Synopsis
27
+
28
+
29
+ == Copyright
30
+
31
+ Author:: yhara <yhara at kmc.gr.jp>
32
+ Copyright:: Copyright (c) 2008 yhara
33
+ License:: Ruby's Licence
@@ -0,0 +1,133 @@
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
@@ -0,0 +1,173 @@
1
+ #!/usr/bin/env ruby#
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
+
123
+ 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
@@ -0,0 +1 @@
1
+ @ruby d:/proj/reposh/reposh %*
@@ -0,0 +1,4 @@
1
+
2
+ class Reposh
3
+
4
+ end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ require "test/unit"
4
+ class ReposhTest < Test::Unit::TestCase
5
+ def test_todo
6
+ assert false, 'please write test'
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/reposh'
3
+
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reposh
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - ujihisa
8
+ autorequire: ""
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-02-04 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Reposh - Simple VCS Manager Shell
17
+ email: ujihisa@gmail.com
18
+ executables:
19
+ - reposh
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - ChangeLog
25
+ files:
26
+ - README
27
+ - ChangeLog
28
+ - Rakefile
29
+ - bin/reposh
30
+ - bin/reposh.bat
31
+ - test/reposh_test.rb
32
+ - test/test_helper.rb
33
+ - lib/reposh.rb
34
+ has_rdoc: true
35
+ homepage: http://reposh.rubyforge.org
36
+ post_install_message:
37
+ rdoc_options:
38
+ - --title
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)/
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ requirements: []
65
+
66
+ rubyforge_project: reposh
67
+ rubygems_version: 1.0.1
68
+ signing_key:
69
+ specification_version: 2
70
+ summary: Reposh - Simple VCS Manager Shell
71
+ test_files:
72
+ - test/test_helper.rb