pvn 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/bin/change.rb +50 -0
  2. data/bin/pvn +8 -4
  3. data/bin/quote.rb +18 -6
  4. data/bin/quotes.orig.txt +145 -0
  5. data/bin/quotes.txt +64 -0
  6. data/lib/pvn/app/runner.rb +103 -0
  7. data/lib/pvn/app.rb +1 -142
  8. data/lib/pvn/{subcommands/base → command}/color_option.rb +1 -1
  9. data/lib/pvn/{subcommands/base → command}/command.rb +10 -6
  10. data/lib/pvn/{subcommands/base → command}/doc.rb +2 -2
  11. data/lib/pvn/{subcommands/base → command}/options.rb +2 -2
  12. data/lib/pvn/config.rb +14 -1
  13. data/lib/pvn/{subcommands/diff → diff}/command.rb +6 -6
  14. data/lib/pvn/diff/differ.rb +60 -44
  15. data/lib/pvn/diff/local_differ.rb +99 -0
  16. data/lib/pvn/diff/log_paths.rb +46 -0
  17. data/lib/pvn/{subcommands/diff → diff}/options.rb +8 -6
  18. data/lib/pvn/diff/path.rb +52 -0
  19. data/lib/pvn/diff/path_revision.rb +31 -0
  20. data/lib/pvn/diff/paths.rb +42 -0
  21. data/lib/pvn/diff/repository_differ.rb +154 -0
  22. data/lib/pvn/diff/revision.rb +36 -0
  23. data/lib/pvn/diff/status_paths.rb +87 -0
  24. data/lib/pvn/io/element.rb +29 -8
  25. data/lib/pvn/{subcommands/log → log}/command.rb +4 -4
  26. data/lib/pvn/log/formatter/log_formatter.rb +1 -1
  27. data/lib/pvn/{subcommands/log → log}/options.rb +7 -7
  28. data/lib/pvn/{subcommands/pct → pct}/command.rb +6 -6
  29. data/lib/pvn/{subcommands/pct → pct}/diffcount.rb +1 -1
  30. data/lib/pvn/{subcommands/pct → pct}/differ.rb +2 -2
  31. data/lib/pvn/{subcommands/pct → pct}/local_differ.rb +3 -3
  32. data/lib/pvn/pct/options.rb +12 -0
  33. data/lib/pvn/{subcommands/pct → pct}/repository_differ.rb +5 -13
  34. data/lib/pvn/revision/{entry.rb → argument.rb} +45 -30
  35. data/lib/pvn/{subcommands/revision → revision}/base_option.rb +2 -2
  36. data/lib/pvn/revision/error.rb +11 -0
  37. data/lib/pvn/{subcommands/revision → revision}/multiple_revisions_option.rb +1 -1
  38. data/lib/pvn/revision/range.rb +49 -0
  39. data/lib/pvn/{subcommands/revision → revision}/revision_option.rb +1 -8
  40. data/lib/pvn/{subcommands/revision → revision}/revision_regexp_option.rb +2 -2
  41. data/lib/pvn/{subcommands/status → status}/command.rb +6 -6
  42. data/lib/pvn/status/formatter/status_formatter.rb +1 -1
  43. data/lib/pvn/status/options.rb +12 -0
  44. data/lib/pvn/{base/util.rb → util/array.rb} +2 -1
  45. data/lib/pvn.rb +1 -6
  46. data/lib/svnx/action.rb +52 -0
  47. data/lib/svnx/entries.rb +9 -1
  48. data/lib/svnx/log/command.rb +4 -3
  49. data/lib/svnx/status/entry.rb +30 -13
  50. data/lib/synoption/base_option.rb +10 -27
  51. data/lib/synoption/matchers.rb +22 -0
  52. data/lib/system/command/cachefile.rb +28 -14
  53. data/lib/system/command.rb +1 -1
  54. data/test/integration/pvn/diff/command_test.rb +20 -0
  55. data/test/integration/pvn/diff/local_differ_test.rb +72 -0
  56. data/test/integration/pvn/diff/log_paths_test.rb +28 -0
  57. data/test/integration/pvn/diff/repository_differ_test.rb +127 -0
  58. data/test/integration/pvn/diff/status_paths_test.rb +31 -0
  59. data/test/integration/pvn/log/command_test.rb +29 -0
  60. data/test/integration/pvn/pct/command_test.rb +30 -0
  61. data/test/integration/pvn/status/command_test.rb +26 -0
  62. data/test/unit/pvn/app_test.rb +7 -5
  63. data/test/unit/pvn/diff/path_revision_test.rb +45 -0
  64. data/test/unit/pvn/diff/path_test.rb +38 -0
  65. data/test/unit/pvn/diff/revision_test.rb +35 -0
  66. data/test/unit/pvn/io/element/log/log_test.rb +2 -2
  67. data/test/unit/pvn/log/formatter/entry_formatter_test.rb +40 -29
  68. data/test/unit/pvn/{subcommands/log → log}/options_test.rb +4 -4
  69. data/test/unit/pvn/revision/argument_test.rb +157 -0
  70. data/test/unit/pvn/{subcommands/revision → revision}/multiple_revisions_option_test.rb +10 -11
  71. data/test/unit/pvn/revision/range_test.rb +26 -0
  72. data/test/unit/pvn/{subcommands/revision → revision}/revision_option_test.rb +13 -18
  73. data/test/unit/pvn/{subcommands/revision → revision}/revision_regexp_option_test.rb +8 -10
  74. data/test/unit/svnx/action_test.rb +67 -0
  75. data/test/unit/svnx/info/entries_test.rb +10 -10
  76. data/test/unit/svnx/info/entry_test.rb +7 -10
  77. data/test/unit/svnx/log/entries_test.rb +31 -29
  78. data/test/unit/svnx/log/entry_test.rb +3 -7
  79. data/test/unit/svnx/status/entries_test.rb +7 -6
  80. data/test/unit/svnx/status/entry_test.rb +2 -23
  81. data/test/unit/system/command/cachefile_test.rb +53 -0
  82. data/test/unit/system/command/caching_test.rb +14 -23
  83. metadata +83 -64
  84. data/lib/pvn/describe.rb +0 -40
  85. data/lib/pvn/diff/diffcmd.rb +0 -49
  86. data/lib/pvn/diff/diffopts.rb +0 -58
  87. data/lib/pvn/log/logcmd.rb +0 -135
  88. data/lib/pvn/log/logentry.rb +0 -116
  89. data/lib/pvn/log/logfactory.rb +0 -101
  90. data/lib/pvn/log/logoptions.rb +0 -43
  91. data/lib/pvn/revision.rb +0 -119
  92. data/lib/pvn/subcommands/diff/differ.rb +0 -65
  93. data/lib/pvn/subcommands/diff/local_differ.rb +0 -103
  94. data/lib/pvn/subcommands/diff/repository_differ.rb +0 -145
  95. data/lib/pvn/subcommands/pct/clargs.rb +0 -33
  96. data/lib/pvn/subcommands/pct/options.rb +0 -12
  97. data/lib/pvn/subcommands/status/options.rb +0 -12
  98. data/lib/pvn/svn/command/svncmd.rb +0 -39
  99. data/lib/pvn/svn/environment.rb +0 -23
  100. data/lib/pvn/svn/svnelement.rb +0 -89
  101. data/lib/pvn/svn/svninfo.rb +0 -42
  102. data/lib/pvn/svn/svnroot.rb +0 -29
  103. data/lib/pvn/upp/uppcmd.rb +0 -112
  104. data/lib/pvn/wherecmd.rb +0 -55
  105. data/test/integration/pvn/subcommands/diff/command_test.rb +0 -153
  106. data/test/integration/pvn/subcommands/log/command_test.rb +0 -22
  107. data/test/integration/svnx/log/test.rb +0 -43
  108. data/test/unit/pvn/revision/entry_test.rb +0 -110
  109. /data/lib/pvn/{subcommands/base → command}/clargs.rb +0 -0
  110. /data/lib/pvn/{base → util}/color_formatter.rb +0 -0
  111. /data/lib/pvn/{base → util}/textlines.rb +0 -0
data/bin/change.rb ADDED
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'riel'
6
+
7
+ class LocalChange
8
+ TODIR = '/Projects/pvn/pvntestbed.pending'
9
+ RESDIR = 'test/resources'
10
+ end
11
+
12
+ class LocalChangeZero < LocalChange
13
+ attr_reader :fromdir
14
+
15
+ def initialize
16
+ @fromdir = 'change0'
17
+
18
+ copyfiles = Array.new
19
+ copyfiles << 'FirstFile.txt'
20
+ copyfiles << 'src/ruby/dog.rb'
21
+ copyfiles << 'src/java/Charlie.java'
22
+ copyfiles << 'SeventhFile.txt'
23
+
24
+ deletefiles = Array.new
25
+ deletefiles << 'dirzero/SixthFile.txt'
26
+
27
+ origdir = Dir.pwd
28
+ Dir.chdir 'test/resources/' + fromdir
29
+
30
+ copyfiles.each do |cpfile|
31
+ copy_file cpfile
32
+ end
33
+
34
+ deletefiles.each do |delfile|
35
+ delete_file delfile
36
+ end
37
+
38
+ Dir.chdir origdir
39
+ end
40
+
41
+ def copy_file fname
42
+ puts "fname: #{fname}"
43
+ end
44
+
45
+ def delete_file fname
46
+ puts "fname: #{fname}"
47
+ end
48
+ end
49
+
50
+ LocalChangeZero.new
data/bin/pvn CHANGED
@@ -1,12 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # Created on 2011-11-9.
4
- # Copyright (c) 2011. All rights reserved.
4
+ # Copyright (c) 2012. All rights reserved.
5
5
 
6
6
  require 'rubygems'
7
- require File.expand_path(File.dirname(__FILE__) + "/../lib/pvn")
7
+
8
+ fdirname = File.expand_path(File.dirname(__FILE__) + '/../lib')
9
+ unless $:.include?(fdirname) || $:.include?(File.expand_path(fdirname))
10
+ $:.unshift(fdirname)
11
+ end
12
+
13
+ require 'pvn'
8
14
  require "pvn/app"
9
15
 
10
16
  PVN::App::Runner.new STDOUT, ARGV
11
-
12
- # PVN::App.execute(STDOUT, ARGV)
data/bin/quote.rb CHANGED
@@ -8,7 +8,8 @@ class Quotes < Hash
8
8
  def initialize
9
9
  super { |h, k| h[k] = Array.new }
10
10
 
11
- DATA.each do |line|
11
+ file = Pathname.new(__FILE__).parent + "quotes.txt"
12
+ file.each_line do |line|
12
13
  line.chomp!
13
14
  next if line.empty?
14
15
  who, quote = line.split(':', 2)
@@ -26,8 +27,21 @@ class Quotes < Hash
26
27
 
27
28
  def get_random
28
29
  who = keys.rand
29
- puts who
30
- [ who, self[who].rand.dup ]
30
+ quote = self[who].rand
31
+ self[who].delete quote
32
+ write
33
+ [ who, quote ]
34
+ end
35
+
36
+ def write
37
+ file = Pathname.new(__FILE__).parent + "quotes.txt"
38
+ File.open(file, "w") do |io|
39
+ self.sort.each do |who, quotes|
40
+ quotes.sort.each do |quote|
41
+ io.puts "#{who}: #{quote}"
42
+ end
43
+ end
44
+ end
31
45
  end
32
46
  end
33
47
 
@@ -37,13 +51,11 @@ if false
37
51
  quotes.print_random
38
52
  end
39
53
 
40
- if false
54
+ if true
41
55
  quotes.sort.each do |who, qtes|
42
56
  printf "%4d %s\n", qtes.length, who
43
57
  end
44
- end
45
58
 
46
- if false
47
59
  printf "%4d %s\n", quotes.values.inject(0) { |s, n| s + n.length }, "total"
48
60
  end
49
61
 
@@ -0,0 +1,145 @@
1
+ Lyle:Come on, boys! The way you're lollygaggin' around here with them picks and them shovels, you'd think it was a hundert an' twenty degrees!... Can't be more than a hundert an' fourteen!
2
+ Hedley Lamarr: There might be a legal precedent. Land snatching ... L-l-land. See snatch."
3
+ Hedley Lamarr: If I could find a sheriff who so offends the people of Rock Ridge that his very appearance would drive them out of town! Wherever will I find such a man? ... Why am I asking you?
4
+ Jim: No. Don't do that, don't do that. If you shoot him you'll just make him mad.
5
+ Jim: What did you expect? "Welcome, sonny"? "Make yourself at home"? "Marry my daughter"? You've got to remember that these are just simple farmers. These are people of the land. The common clay of the new West. You know ... morons.
6
+ Lili von Shtupp: Willkommen, Bienvenue, Welcome, C'mon in.
7
+ Taggart: Ah'm werkin' fer Mel Brooks!
8
+ Taggart: Le Petomane Thruway. Now what'll that asshole think of next? Does anybody got a dime? Somebody has to go back and get a shitload of dimes.
9
+ Mongo: Mongo only pawn in the game of life.
10
+ Mongo: Mongo like candy!
11
+
12
+ Bart: Are we awake?
13
+ Jim: We're not sure. Are we...black?
14
+ Bart: Yes we are.
15
+ Jim: Then we're awake. But we're very puzzled.
16
+
17
+ Bart: What's your name?
18
+ Jim: My name's Jim, but most people call me ... Jim.
19
+
20
+ Bart: Well Jim, since you are my guest and I am your host, what are your pleasures. What do you like to do?
21
+ Jim: Oh, I don't know. Play chess ...
22
+ Bart: Well, let's play chess.
23
+
24
+ Bart: By the power invested in me by the honorable William J. Le Petomane, I hereby assume the duties of sheriff in and for the township of Rock Ridge.
25
+
26
+ Dr. Johnson: Hold it men! He's not bluffing!
27
+ Dr. Samuel Johnson: Listen to him, men; he's just crazy enough to do it!
28
+ Harriet Johnson: Isn't anyone going to help that poor man?
29
+ Dr. Samuel Johnson: Hush, Harriet! That's a sure way to get him killed!
30
+ Bart: Oh, baby, you are so talented, and they so dumb!
31
+
32
+ Hedley Lamarr: My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention.
33
+ Taggart: Ditto!
34
+ Hedley Lamarr: Ditto?! Ditto, you provincial putz?!
35
+
36
+ Hedley Lamarr: My mind is a raging torrent, flooded with rivulets of thought, cascading into a waterfall of creative alternatives...
37
+
38
+ Hedley Lamarr: I want rustlers, cut throats, murderers, bounty hunters, desperados, mugs, pugs, thugs, nitwits, halfwits, dimwits, vipers, snipers, con men, Indian agents, Mexican bandits, muggers, buggerers, bushwhackers, hornswogglers, horse thieves, bull dykes, train robbers, bank robbers, ass-kickers, shit-kickers, and Methodists!
39
+
40
+ Taggart: What in the Wide World of Sports is a-goin' on here? I hired you people to get some track laid ...
41
+
42
+ Buddy Bizarre: CUT! What in the hell do you think you're doing here? This is a closed set.
43
+ Buddy Bizarre: Not in the face.
44
+
45
+ Hedley Lamarr: "Head them off at the pass?" I hate that cliche!
46
+
47
+ Lyle: Don't pay no attention to that alky. He can't hold a gun, much less shoot it.
48
+
49
+ Bart: Well, don't just stand there looking stupid, grasping your hands in pain. How about a round of applause for The Waco Kid?
50
+
51
+ Hedley Lamarr: Charming. Sign right here.
52
+
53
+ Harriet Johnson: ... wish to express our extreme displeasure with your choice of sheriff. Please remove him immediately! The fact that you have sent him here just goes to prove that you are the leading asshole in the state!
54
+
55
+ Lili von Shtupp: A wed wose. How womantic.
56
+
57
+ Bart: A man drink like that and he don't eat, he is going to DIE.
58
+
59
+ Mongo: Huh-huh, naw, Mongo straight.
60
+
61
+ Hedley Lamarr: Meeting adjourned. Oh, I am sorry, sir, I didn't mean to overstep my bounds. You say that.
62
+ Governor William J. Le Petomane: It is?
63
+ Hedley Lamarr: Here, sir, play with this.
64
+
65
+ Gabby Johnson: I wash born here, an I wash raished here, and dad gum it, I am gonna die here, an no sidewindin' bushwackin', hornswagglin' cracker croaker is gonna rouin me bishen cutter.
66
+
67
+ Taggart: Dang, that was lucky. Doggone near lost a four hundred dollar handcar.
68
+
69
+ Lyle: Send wire, main office, tell them I said "ow". Gotcha!
70
+
71
+ Bart: And they was right.
72
+
73
+ Dr. Samuel Johnson: He said the sheriff's near.
74
+
75
+ Howard Johnson: As honorary chairman of the welcoming committee, it's my privilege to present a laurel and hearty handshake to our new ...
76
+
77
+ Bart: No, thank you. Fifteen is my limit on schnitzengruben.
78
+
79
+ Bart: And now, for my next impression ... Jesse Owens.
80
+
81
+
82
+ Hedley Lamarr: Men, you are about to embark on a great crusade to stamp out runaway decency in the west. Now you men will only be risking your lives, whilst I will be risking an almost certain Academy Award nomination for Best Supporting Actor.
83
+
84
+ Jim: See? In another twenty-five years, you'll be able to shake their hands in broad daylight.
85
+
86
+ Howard Johnson: Y'know, Nietzsche says: "Out of chaos comes order."
87
+
88
+ Bart: Well, raise my rent. You are The Kid.
89
+
90
+ Bart: ... to tell the family secret, my grandmother was Dutch.
91
+
92
+ Bart: All right, you caught me. To speak the plain truth, it's getting pretty damn dull around here.
93
+
94
+ Lili von Shtupp: Vhy don't you admit it? He's too much of man for you. I know. You're going to need an army to beat him! You're finished. Fertig! Verfallen! Verlumpt! Verblunget! Verkackt!
95
+
96
+ Hedley Lamarr: Elementary, cactus head.
97
+
98
+ Governor William J. Le Petomane: Ha ha... wrong person. Forgive me. No offense intended.
99
+
100
+ Buddy Bizarre: Watch me! It's so simple! Give me the playback!
101
+
102
+ Buddy Bizarre: Sounds like steam escaping.
103
+
104
+ Bart: Hey, Charlie? Let me ask you something: what is it that's not exactly water and it ain't exactly earth?
105
+
106
+ Bart: Well, can't you see that's the last act of a desperate man?
107
+
108
+ Howard Johnson: We don't care if it's the first act of "Henry V," we're leaving!
109
+
110
+ Hedley Lamarr: Alright, I'm through being Mr. Goodbar, the time has come to act and act quickly.
111
+
112
+ Governor William J. Le Petomane: We've gotta protect our phoney baloney jobs, gentlemen!
113
+
114
+ Reverend Johnson: Gentlemen, gentlemen, allow not hatred to rule the day.
115
+
116
+ Olson Johnson: Now who can argue with that? I think we're all indebted to Gabby Johnson for clearly stating what needed to be said. I'm particulary glad that these lovely children were here today to hear that speech. Not only was it authentic frontier gibberish, it expressed a courage little seen in this day and age.
117
+
118
+ Olson Johnson: What are we made of? Our fathers came across the prairies, fought Indians, fought drought, fought locusts, fought Dix... remember when Richard Dix came in here and tried to take over this town? Well, we didn't give up then, and by gum, we're not going to give up now!
119
+
120
+ Governor William J. Le Petomane: I didn't get a "harrumph" out of that guy!
121
+ Hedley Lamarr: Give the Governor harrumph!
122
+
123
+ Governor William J. Le Petomane: You watch your ass.
124
+
125
+ Reverend Johnson: O Lord, do we have the strength to carry off this mighty task in one night?
126
+
127
+ Hedley Lamarr: Ah, Haley vs. United States. Haley: 7, United States: nothing. You see, it can be done!
128
+
129
+ Hedley Lamarr: Chewing gum on line, eh? I hope you brought enough for everybody.
130
+
131
+ Jim: Boy, is he strict!
132
+
133
+ Hedley Lamarr: This is the bill that will convert the state hospital for the insane into the William J. Le Petomane memorial gambling casino for the insane.
134
+
135
+ Governor William J. Le Petomane: Gentlemen, this bill will be a giant step forward in the treatment of the insane gambler.
136
+
137
+
138
+ Hedley Lamarr: Now go do... that voodoo... that YOU do... SO WELL...!
139
+
140
+ Van Johnson: Sheriff! Mongo's back! He's breaking up the whole town! You've got to help us, please!
141
+ Bart: Did you hear that? Now it's "please". This morning, I couldn't get the time of day. Who is this Mongo, anyway?
142
+ Jim: Well, Mongo ain't exactly a "who". He's more of a "what".
143
+ Van Johnson: What he said.
144
+ Van Johnson: Oh, thank you, Sheriff! Oh, thank you very much! Thank you!
145
+ Van Johnson: The fool's going to... I mean, the sheriff's going to do it!
data/bin/quotes.txt ADDED
@@ -0,0 +1,64 @@
1
+ Bart: ... to tell the family secret, my grandmother was Dutch.
2
+ Bart: A man drink like that and he don't eat, he is going to DIE.
3
+ Bart: All right, you caught me. To speak the plain truth, it's getting pretty damn dull around here.
4
+ Bart: And now, for my next impression ... Jesse Owens.
5
+ Bart: And they was right.
6
+ Bart: Are we awake?
7
+ Bart: By the power invested in me by the honorable William J. Le Petomane, I hereby assume the duties of sheriff in and for the township of Rock Ridge.
8
+ Bart: Did you hear that? Now it's "please". This morning, I couldn't get the time of day. Who is this Mongo, anyway?
9
+ Bart: Hey, Charlie? Let me ask you something: what is it that's not exactly water and it ain't exactly earth?
10
+ Bart: No, thank you. Fifteen is my limit on schnitzengruben.
11
+ Bart: Oh, baby, you are so talented, and they so dumb!
12
+ Bart: Well Jim, since you are my guest and I am your host, what are your pleasures. What do you like to do?
13
+ Bart: Well, can't you see that's the last act of a desperate man?
14
+ Bart: Well, don't just stand there looking stupid, grasping your hands in pain. How about a round of applause for The Waco Kid?
15
+ Bart: Well, let's play chess.
16
+ Bart: Well, raise my rent. You are The Kid.
17
+ Bart: What's your name?
18
+ Bart: Yes we are.
19
+ Buddy Bizarre: Not in the face.
20
+ Buddy Bizarre: Sounds like steam escaping.
21
+ Dr. Samuel Johnson: He said the sheriff's near.
22
+ Dr. Samuel Johnson: Hush, Harriet! That's a sure way to get him killed!
23
+ Dr. Samuel Johnson: Listen to him, men; he's just crazy enough to do it!
24
+ Governor William J. Le Petomane: Gentlemen, this bill will be a giant step forward in the treatment of the insane gambler.
25
+ Governor William J. Le Petomane: Ha ha... wrong person. Forgive me. No offense intended.
26
+ Governor William J. Le Petomane: I didn't get a "harrumph" out of that guy!
27
+ Governor William J. Le Petomane: You watch your ass.
28
+ Hedley Lamarr: "Head them off at the pass?" I hate that cliche!
29
+ Hedley Lamarr: Ah, Haley vs. United States. Haley: 7, United States: nothing. You see, it can be done!
30
+ Hedley Lamarr: Alright, I'm through being Mr. Goodbar, the time has come to act and act quickly.
31
+ Hedley Lamarr: Charming. Sign right here.
32
+ Hedley Lamarr: Ditto?! Ditto, you provincial putz?!
33
+ Hedley Lamarr: Elementary, cactus head.
34
+ Hedley Lamarr: Give the Governor harrumph!
35
+ Hedley Lamarr: I want rustlers, cut throats, murderers, bounty hunters, desperados, mugs, pugs, thugs, nitwits, halfwits, dimwits, vipers, snipers, con men, Indian agents, Mexican bandits, muggers, buggerers, bushwhackers, hornswogglers, horse thieves, bull dykes, train robbers, bank robbers, ass-kickers, shit-kickers, and Methodists!
36
+ Hedley Lamarr: If I could find a sheriff who so offends the people of Rock Ridge that his very appearance would drive them out of town! Wherever will I find such a man? ... Why am I asking you?
37
+ Hedley Lamarr: Meeting adjourned. Oh, I am sorry, sir, I didn't mean to overstep my bounds. You say that.
38
+ Hedley Lamarr: Men, you are about to embark on a great crusade to stamp out runaway decency in the west. Now you men will only be risking your lives, whilst I will be risking an almost certain Academy Award nomination for Best Supporting Actor.
39
+ Hedley Lamarr: My mind is a raging torrent, flooded with rivulets of thought, cascading into a waterfall of creative alternatives...
40
+ Hedley Lamarr: My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention.
41
+ Hedley Lamarr: Now go do... that voodoo... that YOU do... SO WELL...!
42
+ Hedley Lamarr: There might be a legal precedent. Land snatching ... L-l-land. See snatch."
43
+ Hedley Lamarr: This is the bill that will convert the state hospital for the insane into the William J. Le Petomane memorial gambling casino for the insane.
44
+ Howard Johnson: As honorary chairman of the welcoming committee, it's my privilege to present a laurel and hearty handshake to our new ...
45
+ Howard Johnson: We don't care if it's the first act of "Henry V," we're leaving!
46
+ Jim: My name's Jim, but most people call me ... Jim.
47
+ Jim: No. Don't do that, don't do that. If you shoot him you'll just make him mad.
48
+ Jim: Oh, I don't know. Play chess ...
49
+ Jim: See? In another twenty-five years, you'll be able to shake their hands in broad daylight.
50
+ Jim: Then we're awake. But we're very puzzled.
51
+ Jim: Well, Mongo ain't exactly a "who". He's more of a "what".
52
+ Jim: What did you expect? "Welcome, sonny"? "Make yourself at home"? "Marry my daughter"? You've got to remember that these are just simple farmers. These are people of the land. The common clay of the new West. You know ... morons.
53
+ Lyle: Come on, boys! The way you're lollygaggin' around here with them picks and them shovels, you'd think it was a hundert an' twenty degrees!... Can't be more than a hundert an' fourteen!
54
+ Mongo: Mongo like candy!
55
+ Reverend Johnson: Gentlemen, gentlemen, allow not hatred to rule the day.
56
+ Reverend Johnson: O Lord, do we have the strength to carry off this mighty task in one night?
57
+ Taggart: Ah'm werkin' fer Mel Brooks!
58
+ Taggart: Dang, that was lucky. Doggone near lost a four hundred dollar handcar.
59
+ Taggart: Le Petomane Thruway. Now what'll that asshole think of next? Does anybody got a dime? Somebody has to go back and get a shitload of dimes.
60
+ Taggart: What in the Wide World of Sports is a-goin' on here? I hired you people to get some track laid ...
61
+ Van Johnson: Oh, thank you, Sheriff! Oh, thank you very much! Thank you!
62
+ Van Johnson: Sheriff! Mongo's back! He's breaking up the whole town! You've got to help us, please!
63
+ Van Johnson: The fool's going to... I mean, the sheriff's going to do it!
64
+ Van Johnson: What he said.
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'riel'
6
+
7
+ require 'pvn'
8
+ require 'pvn/io/element'
9
+
10
+ require 'pvn/log/command'
11
+ require 'pvn/pct/command'
12
+ require 'pvn/status/command'
13
+ require 'pvn/diff/command'
14
+
15
+ # the old ones:
16
+ # require 'pvn/diff/diffcmd'
17
+ # require 'pvn/pct/pctcmd'
18
+
19
+ # the new ones:
20
+ # require 'pvn/describe'
21
+ # require 'pvn/upp/uppcmd'
22
+ # require 'pvn/wherecmd'
23
+
24
+ module PVN; module App; end; end
25
+
26
+ module PVN::App
27
+ class Runner
28
+ include Loggable
29
+
30
+ SUBCOMMANDS = [ PVN::Log::Command,
31
+ PVN::Pct::Command,
32
+ PVN::Status::Command,
33
+ PVN::Diff::Command,
34
+ # DescribeCommand,
35
+ # WhereCommand,
36
+ # UndeleteCommand,
37
+ ]
38
+
39
+ def initialize io, args
40
+ RIEL::Log.level = RIEL::Log::WARN
41
+ RIEL::Log.set_widths(-25, 5, -35)
42
+
43
+ if args.empty?
44
+ run_help args
45
+ end
46
+
47
+ while args.size > 0
48
+ arg = args.shift
49
+ info "arg: #{arg}"
50
+
51
+ case arg
52
+ when "--verbose"
53
+ RIEL::Log.level = RIEL::Log::DEBUG
54
+ when "help", "--help", "-h"
55
+ run_help args
56
+ else
57
+ SUBCOMMANDS.each do |sc|
58
+ if sc.matches_subcommand? arg
59
+ # run command actually exits, but this makes it clearer
60
+ return run_command sc, args
61
+ end
62
+ end
63
+ $stderr.puts "ERROR: subcommand not valid: #{arg}"
64
+ exit(-1)
65
+ end
66
+ end
67
+
68
+ run_help args
69
+ end
70
+
71
+ def run_command cmdcls, args
72
+ begin
73
+ cmdcls.new args
74
+ exit(0)
75
+ rescue => e
76
+ puts e.backtrace
77
+ $stderr.puts e
78
+ exit(-1)
79
+ end
80
+ end
81
+
82
+ def run_help args
83
+ forwhat = args[0]
84
+
85
+ cls = SUBCOMMANDS.find do |cls|
86
+ cls.getdoc.subcommands.include? forwhat
87
+ end
88
+
89
+ if cls
90
+ cls.to_doc
91
+ else
92
+ puts "usage: pvn [--verbose] <command> [<options>] [<args>]"
93
+ puts "PVN, version #{PVN::VERSION}"
94
+ puts
95
+ puts "PVN has the subcommands:"
96
+ SUBCOMMANDS.each do |sc|
97
+ printf " %-10s %s\n", sc.getdoc.subcommands[0], sc.getdoc.description
98
+ end
99
+ end
100
+ exit(0)
101
+ end
102
+ end
103
+ end
data/lib/pvn/app.rb CHANGED
@@ -4,145 +4,4 @@
4
4
  require 'rubygems'
5
5
  require 'riel'
6
6
 
7
- require 'pvn/io/element'
8
-
9
- require 'svnx/log/entries'
10
-
11
- require 'pvn/subcommands/log/command'
12
- require 'pvn/subcommands/pct/command'
13
- require 'pvn/subcommands/status/command'
14
- require 'pvn/subcommands/diff/command'
15
-
16
- # the old ones:
17
- # require 'pvn/diff/diffcmd'
18
- # require 'pvn/pct/pctcmd'
19
- require 'pvn/describe'
20
- require 'pvn/upp/uppcmd'
21
- require 'pvn/wherecmd'
22
-
23
- module PVN; module App; end; end
24
-
25
- module PVN::App
26
- class Runner
27
- include Loggable
28
-
29
- def initialize io, args
30
- RIEL::Log.level = RIEL::Log::WARN
31
- RIEL::Log.set_widths(-25, 5, -35)
32
-
33
- if args.empty?
34
- run_help args
35
- end
36
-
37
- while args.size > 0
38
- arg = args.shift
39
- info "arg: #{arg}"
40
-
41
- case arg
42
- when "--verbose"
43
- RIEL::Log.level = RIEL::Log::DEBUG
44
- when "help", "--help", "-h"
45
- run_help args
46
- when "log"
47
- run_command PVN::Subcommands::Log::Command, args
48
- when "pct"
49
- run_command PVN::Subcommands::Pct::Command, args
50
- when "status"
51
- run_command PVN::Subcommands::Status::Command, args
52
- when "diff"
53
- run_command PVN::Subcommands::Diff::Command, args
54
- else
55
- $stderr.puts "ERROR: subcommand not valid: #{arg}"
56
- exit(-1)
57
- end
58
- end
59
-
60
- run_help args
61
- end
62
-
63
- def run_command cmdcls, args
64
- begin
65
- cmdcls.new args
66
- exit(0)
67
- rescue => e
68
- puts e.backtrace
69
- $stderr.puts e
70
- exit(-1)
71
- end
72
- end
73
-
74
- # below is the old implementation. yes, I should have branched this.
75
- # =======================================================
76
-
77
- def self.run_command_with_output cmd
78
- RIEL::Log.info "cmd: #{cmd}".on_black
79
- puts cmd.output
80
- true
81
- end
82
-
83
- def self.run_command_as_entries cmd
84
- RIEL::Log.info "cmd: #{cmd}".on_black
85
- cmd.write_entries
86
- true
87
- end
88
-
89
- SUBCOMMANDS = [ PVN::Subcommands::Log::Command,
90
- PVN::Subcommands::Pct::Command,
91
- # DiffCommand,
92
- # DescribeCommand,
93
- # PctCommand,
94
- # WhereCommand,
95
- # UndeleteCommand,
96
- ]
97
-
98
- def run_help args
99
- forwhat = args[0]
100
-
101
- cls = SUBCOMMANDS.find do |cls|
102
- cls.getdoc.subcommands.include? forwhat
103
- end
104
-
105
- if cls
106
- cls.to_doc
107
- else
108
- puts "usage: pvn [--verbose] <command> [<options>] [<args>]"
109
- puts "PVN, version #{PVN::VERSION}"
110
- puts
111
- puts "PVN has the subcommands:"
112
- SUBCOMMANDS.each do |sc|
113
- printf " %-10s %s\n", sc.getdoc.subcommands[0], sc.getdoc.description
114
- end
115
- end
116
- exit(0)
117
- end
118
-
119
- def self.execute stdout, args = Array.new
120
- while args.size > 0
121
- arg = args.shift
122
- RIEL::Log.debug "arg: #{arg}"
123
-
124
- if arg == "--verbose"
125
- RIEL::Log.level = RIEL::Log::DEBUG
126
- next
127
- end
128
-
129
- if arg == "help"
130
- return run_help args
131
- end
132
-
133
- SUBCOMMANDS.each do |sc|
134
- if sc.doc.subcommands.include?(arg)
135
- cmd = sc.new :execute => true, :command_args => args
136
- if cmd.has_entries?
137
- return run_command_as_entries cmd
138
- else
139
- return run_command_with_output cmd
140
- end
141
- end
142
- end
143
-
144
- $stderr.puts "ERROR: subcommand not valid: #{arg}"
145
- end
146
- end
147
- end
148
- end
7
+ require 'pvn/app/runner'
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'synoption/boolean_option'
5
5
 
6
- module PVN::Subcommands::Base
6
+ module PVN::Command
7
7
  class ColorOption < PVN::BooleanOption
8
8
  def initialize optargs = Hash.new
9
9
  super :color, '-f', "show colorized output", true, :negate => [ '-C', %r{^--no-?color} ], :as_cmdline_option => nil
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/ruby -w
2
2
  # -*- ruby -*-
3
3
 
4
- require 'pvn/subcommands/base/doc'
4
+ require 'pvn/command/doc'
5
5
 
6
- module PVN; module Subcommands; module Base; end; end; end
6
+ module PVN; module Command; end; end
7
7
 
8
- module PVN::Subcommands::Base
8
+ module PVN::Command
9
9
  class Command
10
10
  include Loggable
11
11
 
12
- @@doc_for_class = Hash.new { |h, k| h[k] = PVN::Subcommands::Documentation.new }
12
+ @@doc_for_class = Hash.new { |h, k| h[k] = PVN::Command::Documentation.new }
13
13
 
14
14
  class << self
15
15
  def getdoc
@@ -50,8 +50,12 @@ module PVN::Subcommands::Base
50
50
  def example *ex
51
51
  getdoc.examples << ex
52
52
  end
53
- end
54
53
 
54
+ def matches_subcommand? sc
55
+ getdoc.subcommands.include? sc
56
+ end
57
+ end
58
+
55
59
  def to_doc io
56
60
  doc = self.class.getdoc
57
61
  doc.write io
@@ -66,7 +70,7 @@ module PVN::Subcommands::Base
66
70
  options.process args
67
71
 
68
72
  if options.help
69
- cmd.show_help
73
+ show_help
70
74
  else
71
75
  init options
72
76
  end
@@ -4,11 +4,11 @@
4
4
  require 'rubygems'
5
5
  require 'riel'
6
6
 
7
- module PVN; module Subcommands; module Base; end; end; end
7
+ module PVN; module Command; end; end
8
8
 
9
9
  # this is the same as in pvn/cmddoc.rb
10
10
 
11
- module PVN::Subcommands
11
+ module PVN::Command
12
12
  class Documentation
13
13
  attr_accessor :description
14
14
  attr_accessor :usage
@@ -6,9 +6,9 @@ require 'synoption/option'
6
6
  require 'synoption/boolean_option'
7
7
  require 'synoption/fixnum_option'
8
8
 
9
- module PVN; module Subcommands; end; end
9
+ module PVN; module Command; end; end
10
10
 
11
- module PVN::Subcommands::Base
11
+ module PVN::Command
12
12
  class HelpOption < PVN::BooleanOption
13
13
  def initialize args = Hash.new
14
14
  super :help, '-h', "display help", nil
data/lib/pvn/config.rb CHANGED
@@ -59,7 +59,20 @@ module PVN
59
59
  end
60
60
  end
61
61
 
62
-
63
62
  if __FILE__ == $0
64
63
  cfg = PVN::Configuration.read
65
64
  end
65
+
66
+ __END__
67
+ # this is an example:
68
+ PVN::Configuration.config do |config|
69
+ config.diff do |diff|
70
+ diff.java = '/home/jpace/Programs/diffj-1.2.1/bin/diffj --context -L "{0}" -L "{1}" "{2}" "{3}"'
71
+ diff.xmlorig = "xmldiff --someopt=true --from-file '{0}' --to-file '{1}'"
72
+ end
73
+
74
+ config.log do |log|
75
+ log.limit = 25
76
+ log.format = '#{revision.red}\t#{user.bold}\t#{time} #{date}\n#{list(comment, :green)}#{cr(files)}#{list(files, :bold, :cyan)}\n'
77
+ end
78
+ end