pvn 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/README.markdown +38 -0
  2. data/bin/pvn +12 -0
  3. data/bin/pvndiff +10 -0
  4. data/lib/pvn/app.rb +144 -0
  5. data/lib/pvn/base/textlines.rb +35 -0
  6. data/lib/pvn/base/util.rb +14 -0
  7. data/lib/pvn/cmddoc.rb +77 -0
  8. data/lib/pvn/config.rb +65 -0
  9. data/lib/pvn/describe.rb +40 -0
  10. data/lib/pvn/diff/diffcmd.rb +49 -0
  11. data/lib/pvn/diff/differ.rb +67 -0
  12. data/lib/pvn/diff/diffopts.rb +58 -0
  13. data/lib/pvn/doc.rb +34 -0
  14. data/lib/pvn/io/element.rb +113 -0
  15. data/lib/pvn/io/fselement.rb +22 -0
  16. data/lib/pvn/log/formatter/color_formatter.rb +29 -0
  17. data/lib/pvn/log/formatter/entries_formatter.rb +33 -0
  18. data/lib/pvn/log/formatter/entry_formatter.rb +57 -0
  19. data/lib/pvn/log/formatter/log_formatter.rb +59 -0
  20. data/lib/pvn/log/formatter/message_formatter.rb +19 -0
  21. data/lib/pvn/log/formatter/path_formatter.rb +41 -0
  22. data/lib/pvn/log/formatter/summary_formatter.rb +49 -0
  23. data/lib/pvn/log/logcmd.rb +136 -0
  24. data/lib/pvn/log/logentry.rb +116 -0
  25. data/lib/pvn/log/logfactory.rb +101 -0
  26. data/lib/pvn/log/logoptions.rb +43 -0
  27. data/lib/pvn/pct/linecount.rb +33 -0
  28. data/lib/pvn/pct/pctcmd.rb +204 -0
  29. data/lib/pvn/pct/statcmd.rb +13 -0
  30. data/lib/pvn/revision/entry.rb +94 -0
  31. data/lib/pvn/revision.rb +119 -0
  32. data/lib/pvn/subcommands/base/clargs.rb +53 -0
  33. data/lib/pvn/subcommands/base/command.rb +60 -0
  34. data/lib/pvn/subcommands/base/doc.rb +94 -0
  35. data/lib/pvn/subcommands/base/options.rb +22 -0
  36. data/lib/pvn/subcommands/log/command.rb +70 -0
  37. data/lib/pvn/subcommands/log/options.rb +43 -0
  38. data/lib/pvn/subcommands/pct/clargs.rb +33 -0
  39. data/lib/pvn/subcommands/pct/command.rb +57 -0
  40. data/lib/pvn/subcommands/revision/multiple_revisions_option.rb +43 -0
  41. data/lib/pvn/subcommands/revision/revision_option.rb +74 -0
  42. data/lib/pvn/subcommands/revision/revision_regexp_option.rb +39 -0
  43. data/lib/pvn/svn/command/svncmd.rb +39 -0
  44. data/lib/pvn/svn/environment.rb +23 -0
  45. data/lib/pvn/svn/svnelement.rb +89 -0
  46. data/lib/pvn/svn/svninfo.rb +42 -0
  47. data/lib/pvn/svn/svnroot.rb +29 -0
  48. data/lib/pvn/upp/uppcmd.rb +112 -0
  49. data/lib/pvn/wherecmd.rb +55 -0
  50. data/lib/pvn.rb +8 -0
  51. data/lib/svnx/command.rb +60 -0
  52. data/lib/svnx/entry.rb +34 -0
  53. data/lib/svnx/info/command.rb +21 -0
  54. data/lib/svnx/info/entries.rb +27 -0
  55. data/lib/svnx/info/entry.rb +34 -0
  56. data/lib/svnx/log/command.rb +93 -0
  57. data/lib/svnx/log/entries.rb +57 -0
  58. data/lib/svnx/log/entry.rb +54 -0
  59. data/lib/svnx/status/command.rb +21 -0
  60. data/lib/svnx/status/entries.rb +22 -0
  61. data/lib/svnx/status/entry.rb +33 -0
  62. data/lib/synoption/base_option.rb +149 -0
  63. data/lib/synoption/boolean_option.rb +21 -0
  64. data/lib/synoption/doc.rb +81 -0
  65. data/lib/synoption/fixnum_option.rb +13 -0
  66. data/lib/synoption/match.rb +47 -0
  67. data/lib/synoption/option.rb +10 -0
  68. data/lib/synoption/optionable.rb +66 -0
  69. data/lib/synoption/set.rb +114 -0
  70. data/lib/system/cachecmd.rb +65 -0
  71. data/lib/system/cmdexec.rb +13 -0
  72. data/lib/system/cmdline.rb +70 -0
  73. data/lib/system/command/arg.rb +12 -0
  74. data/lib/system/command/cachefile.rb +39 -0
  75. data/lib/system/command/caching.rb +36 -0
  76. data/lib/system/command/line.rb +47 -0
  77. data/lib/system/command.rb +72 -0
  78. data/test/integration/svnx/log/test.rb +43 -0
  79. data/test/unit/pvn/app_test.rb +22 -0
  80. data/test/unit/pvn/io/element/log/log_test.rb +35 -0
  81. data/test/unit/pvn/log/formatter/entry_formatter_test.rb +90 -0
  82. data/test/unit/pvn/revision/entry_test.rb +123 -0
  83. data/test/unit/pvn/subcommands/log/command_test.rb +22 -0
  84. data/test/unit/pvn/subcommands/log/options_test.rb +85 -0
  85. data/test/unit/pvn/subcommands/revision/multiple_revisions_option_test.rb +67 -0
  86. data/test/unit/pvn/subcommands/revision/revision_option_test.rb +57 -0
  87. data/test/unit/pvn/subcommands/revision/revision_regexp_option_test.rb +69 -0
  88. data/test/unit/svnx/info/entry_test.rb +52 -0
  89. data/test/unit/svnx/log/cmargs_test.rb +22 -0
  90. data/test/unit/svnx/log/entries_test.rb +73 -0
  91. data/test/unit/svnx/log/entry_test.rb +21 -0
  92. data/test/unit/svnx/status/entry_test.rb +39 -0
  93. data/test/unit/synoption/base_option_test.rb +182 -0
  94. data/test/unit/synoption/match_test.rb +61 -0
  95. data/test/unit/synoption/option_test.rb +15 -0
  96. data/test/unit/synoption/set_test.rb +37 -0
  97. data/test/unit/system/command/caching_test.rb +97 -0
  98. data/test/unit/system/command/line_test.rb +33 -0
  99. metadata +199 -0
@@ -0,0 +1,97 @@
1
+ require 'tc'
2
+ require 'system/command/caching'
3
+
4
+ module System
5
+ class CachingCommandLineTestCase < PVN::TestCase
6
+ include Loggable
7
+
8
+ CACHE_DIR = Pathname.new '/tmp/pvn/testing'
9
+
10
+ def setup
11
+ super
12
+ CACHE_DIR.rmtree if CACHE_DIR.exist?
13
+ end
14
+
15
+ def teardown
16
+ CACHE_DIR.rmtree if CACHE_DIR.exist?
17
+ super
18
+ end
19
+
20
+ def create_ls_tmp
21
+ CachingCommandLine.new [ "ls", "/tmp" ]
22
+ end
23
+
24
+ def test_ctor_no_args
25
+ cl = CachingCommandLine.new [ "ls" ]
26
+ assert_equal "ls", cl.to_command
27
+ end
28
+
29
+ def test_ctor_with_args
30
+ cl = CachingCommandLine.new [ "ls", "/tmp" ]
31
+ assert_equal "ls /tmp", cl.to_command
32
+ end
33
+
34
+ def test_lshift
35
+ cl = CachingCommandLine.new [ "ls" ]
36
+ cl << "/tmp"
37
+ assert_equal "ls /tmp", cl.to_command
38
+ end
39
+
40
+ def test_cache_dir_defaults_to_executable
41
+ cl = create_ls_tmp
42
+ assert_equal '/tmp' + (Pathname.new($0).expand_path).to_s, cl.cache_dir
43
+ end
44
+
45
+ def test_cache_file_defaults_to_executable
46
+ cl = create_ls_tmp
47
+ assert_equal '/tmp' + (Pathname.new($0).expand_path).to_s + '/ls-\/tmp', cl.cache_file.to_s
48
+ end
49
+
50
+ def test_cache_dir_set_cachefile
51
+ cl = create_ls_tmp
52
+ def cl.cache_dir; CACHE_DIR.to_s; end
53
+ assert_not_nil cl.cache_dir
54
+ assert !CACHE_DIR.exist?
55
+
56
+ cachefile = cl.cache_file
57
+ assert_equal CACHE_DIR.to_s + '/ls-\/tmp', cachefile.to_s
58
+ end
59
+
60
+ def test_cache_dir_created_on_execute
61
+ cl = create_ls_tmp
62
+ def cl.cache_dir; CACHE_DIR.to_s; end
63
+
64
+ cachefile = cl.cache_file
65
+
66
+ cl.execute
67
+ assert CACHE_DIR.exist?
68
+ cachelines = IO.readlines cachefile.to_s
69
+
70
+ syslines = nil
71
+ IO.popen("ls /tmp") do |io|
72
+ syslines = io.readlines
73
+ end
74
+
75
+ assert_equal syslines, cachelines
76
+ end
77
+
78
+ def test_cache_file_matches_results
79
+ dir = "/usr/local/bin"
80
+ cl = CachingCommandLine.new [ "ls", dir ]
81
+ def cl.cache_dir; CACHE_DIR.to_s; end
82
+
83
+ cachefile = cl.cache_file
84
+
85
+ cl.execute
86
+ assert CACHE_DIR.exist?
87
+ cachelines = IO.readlines cachefile.to_s
88
+
89
+ syslines = nil
90
+ IO.popen("ls #{dir}") do |io|
91
+ syslines = io.readlines
92
+ end
93
+
94
+ assert_equal syslines, cachelines
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,33 @@
1
+ require 'tc'
2
+ require 'system/command/line'
3
+
4
+ module System
5
+ class CommandLineTestCase < PVN::TestCase
6
+ include Loggable
7
+
8
+ def test_ctor
9
+ cl = System::CommandLine.new [ "ls" ]
10
+ assert_equal "ls", cl.to_command
11
+ end
12
+
13
+ def test_lshift
14
+ cl = System::CommandLine.new [ "ls" ]
15
+ cl << "/tmp"
16
+ assert_equal "ls /tmp", cl.to_command
17
+ end
18
+
19
+ def test_execute
20
+ cl = System::CommandLine.new [ "ls" ]
21
+ cl << "/tmp"
22
+ assert_equal "ls /tmp", cl.to_command
23
+ output = cl.execute
24
+
25
+ syslines = nil
26
+ IO.popen("ls /tmp") do |io|
27
+ syslines = io.readlines
28
+ end
29
+
30
+ assert_equal syslines, output
31
+ end
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,199 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pvn
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Jeff Pace
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-08-31 00:00:00 -04:00
19
+ default_executable: pvn
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: riel
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 31
30
+ segments:
31
+ - 1
32
+ - 1
33
+ - 6
34
+ version: 1.1.6
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description:
38
+ email: jeugenepace@gmail.com
39
+ executables:
40
+ - pvn
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - README.markdown
45
+ files:
46
+ - bin/pvndiff
47
+ - bin/pvn
48
+ - lib/synoption/boolean_option.rb
49
+ - lib/synoption/option.rb
50
+ - lib/synoption/fixnum_option.rb
51
+ - lib/synoption/match.rb
52
+ - lib/synoption/base_option.rb
53
+ - lib/synoption/set.rb
54
+ - lib/synoption/doc.rb
55
+ - lib/synoption/optionable.rb
56
+ - lib/system/command/arg.rb
57
+ - lib/system/command/cachefile.rb
58
+ - lib/system/command/line.rb
59
+ - lib/system/command/caching.rb
60
+ - lib/system/cmdline.rb
61
+ - lib/system/command.rb
62
+ - lib/system/cachecmd.rb
63
+ - lib/system/cmdexec.rb
64
+ - lib/svnx/status/command.rb
65
+ - lib/svnx/status/entries.rb
66
+ - lib/svnx/status/entry.rb
67
+ - lib/svnx/command.rb
68
+ - lib/svnx/info/command.rb
69
+ - lib/svnx/info/entries.rb
70
+ - lib/svnx/info/entry.rb
71
+ - lib/svnx/entry.rb
72
+ - lib/svnx/log/command.rb
73
+ - lib/svnx/log/entries.rb
74
+ - lib/svnx/log/entry.rb
75
+ - lib/pvn/subcommands/base/options.rb
76
+ - lib/pvn/subcommands/base/clargs.rb
77
+ - lib/pvn/subcommands/base/command.rb
78
+ - lib/pvn/subcommands/base/doc.rb
79
+ - lib/pvn/subcommands/pct/clargs.rb
80
+ - lib/pvn/subcommands/pct/command.rb
81
+ - lib/pvn/subcommands/log/options.rb
82
+ - lib/pvn/subcommands/log/command.rb
83
+ - lib/pvn/subcommands/revision/revision_regexp_option.rb
84
+ - lib/pvn/subcommands/revision/multiple_revisions_option.rb
85
+ - lib/pvn/subcommands/revision/revision_option.rb
86
+ - lib/pvn/describe.rb
87
+ - lib/pvn/config.rb
88
+ - lib/pvn/cmddoc.rb
89
+ - lib/pvn/revision.rb
90
+ - lib/pvn/base/textlines.rb
91
+ - lib/pvn/base/util.rb
92
+ - lib/pvn/diff/diffcmd.rb
93
+ - lib/pvn/diff/diffopts.rb
94
+ - lib/pvn/diff/differ.rb
95
+ - lib/pvn/io/element.rb
96
+ - lib/pvn/io/fselement.rb
97
+ - lib/pvn/wherecmd.rb
98
+ - lib/pvn/app.rb
99
+ - lib/pvn/pct/statcmd.rb
100
+ - lib/pvn/pct/linecount.rb
101
+ - lib/pvn/pct/pctcmd.rb
102
+ - lib/pvn/doc.rb
103
+ - lib/pvn/log/logentry.rb
104
+ - lib/pvn/log/logcmd.rb
105
+ - lib/pvn/log/logfactory.rb
106
+ - lib/pvn/log/logoptions.rb
107
+ - lib/pvn/log/formatter/entry_formatter.rb
108
+ - lib/pvn/log/formatter/summary_formatter.rb
109
+ - lib/pvn/log/formatter/color_formatter.rb
110
+ - lib/pvn/log/formatter/entries_formatter.rb
111
+ - lib/pvn/log/formatter/message_formatter.rb
112
+ - lib/pvn/log/formatter/log_formatter.rb
113
+ - lib/pvn/log/formatter/path_formatter.rb
114
+ - lib/pvn/svn/svninfo.rb
115
+ - lib/pvn/svn/command/svncmd.rb
116
+ - lib/pvn/svn/svnroot.rb
117
+ - lib/pvn/svn/svnelement.rb
118
+ - lib/pvn/svn/environment.rb
119
+ - lib/pvn/revision/entry.rb
120
+ - lib/pvn/upp/uppcmd.rb
121
+ - lib/pvn.rb
122
+ - test/unit/synoption/set_test.rb
123
+ - test/unit/synoption/match_test.rb
124
+ - test/unit/synoption/base_option_test.rb
125
+ - test/unit/synoption/option_test.rb
126
+ - test/unit/system/command/caching_test.rb
127
+ - test/unit/system/command/line_test.rb
128
+ - test/unit/svnx/status/entry_test.rb
129
+ - test/unit/svnx/info/entry_test.rb
130
+ - test/unit/svnx/log/entries_test.rb
131
+ - test/unit/svnx/log/entry_test.rb
132
+ - test/unit/svnx/log/cmargs_test.rb
133
+ - test/unit/pvn/subcommands/log/options_test.rb
134
+ - test/unit/pvn/subcommands/log/command_test.rb
135
+ - test/unit/pvn/subcommands/revision/multiple_revisions_option_test.rb
136
+ - test/unit/pvn/subcommands/revision/revision_regexp_option_test.rb
137
+ - test/unit/pvn/subcommands/revision/revision_option_test.rb
138
+ - test/unit/pvn/io/element/log/log_test.rb
139
+ - test/unit/pvn/log/formatter/entry_formatter_test.rb
140
+ - test/unit/pvn/app_test.rb
141
+ - test/unit/pvn/revision/entry_test.rb
142
+ - test/integration/svnx/log/test.rb
143
+ - README.markdown
144
+ has_rdoc: true
145
+ homepage: http://www.incava.org/projects/pvn
146
+ licenses: []
147
+
148
+ post_install_message:
149
+ rdoc_options: []
150
+
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ hash: 3
159
+ segments:
160
+ - 0
161
+ version: "0"
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ none: false
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ hash: 3
168
+ segments:
169
+ - 0
170
+ version: "0"
171
+ requirements: []
172
+
173
+ rubyforge_project:
174
+ rubygems_version: 1.4.2
175
+ signing_key:
176
+ specification_version: 3
177
+ summary: What Subversion should have.
178
+ test_files:
179
+ - test/unit/synoption/set_test.rb
180
+ - test/unit/synoption/match_test.rb
181
+ - test/unit/synoption/base_option_test.rb
182
+ - test/unit/synoption/option_test.rb
183
+ - test/unit/system/command/caching_test.rb
184
+ - test/unit/system/command/line_test.rb
185
+ - test/unit/svnx/status/entry_test.rb
186
+ - test/unit/svnx/info/entry_test.rb
187
+ - test/unit/svnx/log/entries_test.rb
188
+ - test/unit/svnx/log/entry_test.rb
189
+ - test/unit/svnx/log/cmargs_test.rb
190
+ - test/unit/pvn/subcommands/log/options_test.rb
191
+ - test/unit/pvn/subcommands/log/command_test.rb
192
+ - test/unit/pvn/subcommands/revision/multiple_revisions_option_test.rb
193
+ - test/unit/pvn/subcommands/revision/revision_regexp_option_test.rb
194
+ - test/unit/pvn/subcommands/revision/revision_option_test.rb
195
+ - test/unit/pvn/io/element/log/log_test.rb
196
+ - test/unit/pvn/log/formatter/entry_formatter_test.rb
197
+ - test/unit/pvn/app_test.rb
198
+ - test/unit/pvn/revision/entry_test.rb
199
+ - test/integration/svnx/log/test.rb