stdouttoggler 0.5.0.pre → 0.5.1.pre
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.
- data/README.txt +44 -84
- data/stdouttoggler.gemspec +4 -1
- metadata +6 -3
data/README.txt
CHANGED
@@ -1,129 +1,89 @@
|
|
1
1
|
= Standard Out Toggler
|
2
2
|
|
3
|
-
Standard Out Toggler is
|
3
|
+
Standard Out Toggler is an executable gem that comments and uncomments
|
4
4
|
output lines from a variety of different file types. Out of the box, this gem
|
5
|
-
handles java, javascript in .js and .jsp, and ruby
|
5
|
+
handles java, javascript (in .js and .jsp files), and ruby. You can configure it to handle
|
6
6
|
any file type of your choice.
|
7
7
|
|
8
8
|
== Use Case
|
9
9
|
|
10
|
-
|
11
|
-
for example alert statements to javascript code
|
12
|
-
statements to java code. Then
|
13
|
-
from some files, because they're cluttering up
|
14
|
-
of crawling through javascript alerts. Later,
|
10
|
+
Sometimes when debugging, developers add output statements to code,
|
11
|
+
for example alert statements to javascript code or System.out.println
|
12
|
+
statements to java code. Then they discover need temporarily to comment out the statements
|
13
|
+
from some files, because they're cluttering up the console or because they get tired
|
14
|
+
of crawling through javascript alerts. Later, they may need to uncomment them again.
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
When I decided to add JSP files to the mix, and had to hard code another set
|
20
|
-
of constants and and case statements, I realized that this was a prime opportunity
|
21
|
-
for ruby metaprogramming.
|
22
|
-
|
23
|
-
As a result, Standard Out Toggler dynamically builds support for default file types
|
24
|
-
from a config file in the lib/config directory and offers you the option
|
25
|
-
to add additional types via a YAML file in the current directory.
|
16
|
+
The Standard Out Toggler gem solves this problem by automatically commenting
|
17
|
+
or uncommenting output lines from a command prompt.
|
26
18
|
|
27
19
|
== Running the program
|
28
20
|
|
29
|
-
Run the executable from a directory of your choice using the
|
21
|
+
Run the executable from a directory of your choice using the toggle command.
|
30
22
|
The only required option is the instruction option (-i), which tells stdouttoggler
|
31
23
|
whether to comment or uncomment. Add one or more files as args (relative or absolute paths),
|
32
24
|
and run the program. For example:
|
33
25
|
|
34
|
-
|
26
|
+
toggle -i comment JavaFile.java C:/programs/JavaScriptFile.js
|
35
27
|
|
36
28
|
== Command Line Options
|
37
29
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
-f Tells stdouttoggler to find files for commenting or uncommenting
|
45
|
-
in a file called file_names.yaml, which you put in the current
|
46
|
-
directory. This can come in handy if you're changing a lot of files
|
47
|
-
or using files with long paths. Note that if you use this option,
|
48
|
-
you can't put any files on the command line.
|
49
|
-
|
50
|
-
-c Tells stdouttoggler that you're adding additional file types to the
|
51
|
-
default java, javascript, JSP, and ruby types, using a file called
|
52
|
-
additional_types.yaml in the current directory.
|
30
|
+
<tt>-h</tt>:: Help screen.
|
31
|
+
<tt>-i <comment|uncomment></tt>:: Tells stdouttoggler whether to comment or uncomment output lines.
|
32
|
+
<tt>-b</tt>:: Saves a backup of any changed file.
|
33
|
+
<tt>-f</tt>:: Tells stdouttoggler to find files for commenting or uncommenting in a file called file_names.yaml, which you put in the current directory. This can come in handy if you're changing a lot of files or using files with long paths. Note that if you use this option, you cannot put any files on the command line.
|
34
|
+
<tt>-c</tt>:: Tells stdouttoggler that you're adding additional file types to the default java, javascript, JSP, and ruby types, using a file called additional_types.yaml in the current directory.
|
53
35
|
|
54
36
|
Here are some sample commands:
|
55
37
|
|
56
|
-
|
57
|
-
|
58
|
-
Comments out all System.out.print and System.out.println statements
|
59
|
-
in the java file, and all the alert statements in the javascript file.
|
38
|
+
toggle -i comment JavaFile.java C:/programs/JavaScriptFile.js
|
60
39
|
|
61
|
-
|
40
|
+
* Comments out all System.out.print and System.out.println statements in the java file,
|
41
|
+
and all the alert statements in the javascript file.
|
62
42
|
|
63
|
-
|
64
|
-
in the java file, and all the alert statements in the javascript file.
|
43
|
+
toggle -i uncomment JavaFile.java C:/programs/JavaScriptFile.js
|
65
44
|
|
66
|
-
|
45
|
+
* Uncomments out all System.out.print and System.out.println statements in the java file,
|
46
|
+
and all the alert statements in the javascript file.
|
67
47
|
|
68
|
-
|
69
|
-
in the java file and saves a backup (JavaFile.java.bak) of the original file.
|
48
|
+
toggle -i comment -b JavaFile.java
|
70
49
|
|
71
|
-
|
50
|
+
* Comments out all System.out.print and System.out.println statements in the java file
|
51
|
+
and saves a backup (JavaFile.java.bak) of the original file.
|
72
52
|
|
73
|
-
|
74
|
-
current directory. See the Using a File section below for an explanation
|
75
|
-
of the structure of that file.
|
53
|
+
toggle -i comment -f
|
76
54
|
|
77
|
-
|
55
|
+
* Comments out all output statements in the file_names.yaml file in your current directory.
|
56
|
+
See the Using a File section below for an explanation of the structure of that file.
|
78
57
|
|
79
|
-
|
80
|
-
in your current directory, based on configuration instructions in
|
81
|
-
additional_types.yaml in your current directory. See the Configuration
|
82
|
-
section below for an explanation of the structure of the YAML configuration file.
|
58
|
+
toggle -i comment -c AnotherFileType.al
|
83
59
|
|
84
|
-
|
60
|
+
* Comments out all the output statements in AnotherFileType.al in your current directory,
|
61
|
+
based on configuration instructions in additional_types.yaml in your current directory.
|
62
|
+
See the Configuration section below for an explanation of the structure of the YAML configuration file.
|
85
63
|
|
86
|
-
|
87
|
-
current directory, based on configuration instructions in
|
88
|
-
additional_types.yaml in your current directory.
|
64
|
+
toggle -i comment -f -c
|
89
65
|
|
90
|
-
|
66
|
+
* Comments out all output statements in the file_names.yaml file in your current directory,
|
67
|
+
based on configuration instructions in additional_types.yaml in your current directory.
|
91
68
|
|
92
|
-
|
93
|
-
files to comment/uncomment:
|
69
|
+
== Using a File Instead of Command Line Arguments
|
94
70
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
- C:/programs/ruby/ruby_file.rb
|
99
|
-
- AnotherLanguage.al
|
71
|
+
In the examples folder you'll find a sample YAML file called file_names.yaml that lists
|
72
|
+
files to comment/uncomment. You can use that file as a template for adding your own files,
|
73
|
+
using relative or absolute paths.
|
100
74
|
|
101
|
-
Note that you
|
75
|
+
Activate this file using the <tt>-f</tt> option. Note that if you use this option, you
|
76
|
+
cannot put any files as arguments on the command line.
|
102
77
|
|
103
78
|
== Configuration
|
104
79
|
|
105
|
-
In the
|
80
|
+
In the examples folder you'll find a sample YAML configuration file called additional_types.yaml
|
106
81
|
that lists three (imaginary) additional languages for commenting/uncommenting. You can use this file
|
107
82
|
as a template for types you wish to add.
|
108
83
|
|
109
|
-
---
|
110
|
-
- :type: anotherlang
|
111
|
-
:extension: .al
|
112
|
-
:keyword: out
|
113
|
-
:comment_string: --
|
114
|
-
:comment_string_escaped: --
|
115
|
-
- :type: otherlang
|
116
|
-
:extension: .ol
|
117
|
-
:keyword: print
|
118
|
-
:comment_string: //
|
119
|
-
:comment_string_escaped: \/\/
|
120
|
-
- :type: rub
|
121
|
-
:extension: .rub
|
122
|
-
:keyword: putt
|
123
|
-
:comment_string: "#"
|
124
|
-
:comment_string_escaped: "#"
|
125
|
-
|
126
84
|
The comment_string_escaped is the tricky one. It will be used in a regular expression,
|
127
85
|
so if it contains metacharacters, they need to be escaped. Additionally, if any of the
|
128
86
|
values use a character that means something special to the ruby interpreter, such as
|
129
87
|
the hash sign, it must be put in quotation marks.
|
88
|
+
|
89
|
+
Activate this file using the -c option.
|
data/stdouttoggler.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name="stdouttoggler"
|
3
|
-
s.version="0.5.
|
3
|
+
s.version="0.5.1.pre"
|
4
4
|
s.platform=Gem::Platform::RUBY
|
5
5
|
s.date="2012-09-14"
|
6
6
|
s.summary="Comments and uncomments output lines in code"
|
@@ -10,4 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.homepage="http://rubygems.org/stdouttoggler"
|
11
11
|
s.executables=["toggle"]
|
12
12
|
s.require_paths=["lib"]
|
13
|
+
s.has_rdoc=true
|
14
|
+
s.extra_rdoc_files=["README.txt"]
|
15
|
+
s.rdoc_options=["--main", "README.txt"]
|
13
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stdouttoggler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1.pre
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -17,7 +17,8 @@ email:
|
|
17
17
|
executables:
|
18
18
|
- toggle
|
19
19
|
extensions: []
|
20
|
-
extra_rdoc_files:
|
20
|
+
extra_rdoc_files:
|
21
|
+
- README.txt
|
21
22
|
files:
|
22
23
|
- stdouttoggler.gemspec
|
23
24
|
- Rakefile
|
@@ -37,7 +38,9 @@ files:
|
|
37
38
|
homepage: http://rubygems.org/stdouttoggler
|
38
39
|
licenses: []
|
39
40
|
post_install_message:
|
40
|
-
rdoc_options:
|
41
|
+
rdoc_options:
|
42
|
+
- --main
|
43
|
+
- README.txt
|
41
44
|
require_paths:
|
42
45
|
- lib
|
43
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|