stdouttoggler 0.5.1.pre → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.txt CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
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 files), and ruby. You can configure it to handle
6
- any file type of your choice.
5
+ handles java, javascript (in .js and .jsp files), ruby, and perl files.
6
+ You can configure it to handle any file type of your choice.
7
7
 
8
8
  == Use Case
9
9
 
10
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
11
+ for example alert statements to javascript or System.out.println
12
+ statements to java. Then they discover need temporarily to comment out the statements
13
13
  from some files, because they're cluttering up the console or because they get tired
14
14
  of crawling through javascript alerts. Later, they may need to uncomment them again.
15
15
 
@@ -20,7 +20,7 @@ or uncommenting output lines from a command prompt.
20
20
 
21
21
  Run the executable from a directory of your choice using the toggle command.
22
22
  The only required option is the instruction option (-i), which tells stdouttoggler
23
- whether to comment or uncomment. Add one or more files as args (relative or absolute paths),
23
+ whether to comment or uncomment output lines. Add one or more files as args (relative or absolute paths),
24
24
  and run the program. For example:
25
25
 
26
26
  toggle -i comment JavaFile.java C:/programs/JavaScriptFile.js
@@ -31,7 +31,7 @@ toggle -i comment JavaFile.java C:/programs/JavaScriptFile.js
31
31
  <tt>-i <comment|uncomment></tt>:: Tells stdouttoggler whether to comment or uncomment output lines.
32
32
  <tt>-b</tt>:: Saves a backup of any changed file.
33
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.
34
+ <tt>-c</tt>:: Tells stdouttoggler that you're adding additional file types, using a file called additional_types.yaml in the current directory.
35
35
 
36
36
  Here are some sample commands:
37
37
 
@@ -42,7 +42,7 @@ toggle -i comment JavaFile.java C:/programs/JavaScriptFile.js
42
42
 
43
43
  toggle -i uncomment JavaFile.java C:/programs/JavaScriptFile.js
44
44
 
45
- * Uncomments out all System.out.print and System.out.println statements in the java file,
45
+ * Uncomments all System.out.print and System.out.println statements in the java file,
46
46
  and all the alert statements in the javascript file.
47
47
 
48
48
  toggle -i comment -b JavaFile.java
@@ -72,7 +72,7 @@ In the examples folder you'll find a sample YAML file called file_names.yaml tha
72
72
  files to comment/uncomment. You can use that file as a template for adding your own files,
73
73
  using relative or absolute paths.
74
74
 
75
- Activate this file using the <tt>-f</tt> option. Note that if you use this option, you
75
+ Activate this file using the -f option. Note that if you use this option, you
76
76
  cannot put any files as arguments on the command line.
77
77
 
78
78
  == Configuration
@@ -7,9 +7,9 @@ require 'yaml'
7
7
 
8
8
  module StdOutToggler
9
9
 
10
- #parses and validates command line options and configuration;
11
- #runs the application;
12
- #key instance variables:
10
+ #Parses and validates command line options and configuration;
11
+ #runs the application.
12
+ #Key instance variables:
13
13
  #@options: command line options
14
14
  #@stdout_type_maps: used to generate the regex class methods
15
15
  #@files: list of files to comment/uncomment
@@ -23,7 +23,7 @@ module StdOutToggler
23
23
  validate_stdout_type_maps
24
24
  end
25
25
 
26
- #parses command line options
26
+ #Parses command line options
27
27
  def prepare_options
28
28
  @options = {}
29
29
  begin
@@ -53,7 +53,7 @@ module StdOutToggler
53
53
  end
54
54
  end
55
55
 
56
- #ensures that we have the required instruction command
56
+ #Ensures that we have the required instruction command
57
57
  def validate_instruction
58
58
  unless @options[:instruction]
59
59
  puts "You need to have an -i (or --instruction) flag with an argument indicating comment or uncomment"
@@ -61,7 +61,7 @@ module StdOutToggler
61
61
  end
62
62
  end
63
63
 
64
- #builds the list of files designated for commenting/uncommenting
64
+ #Builds the list of files designated for commenting/uncommenting
65
65
  def prepare_files
66
66
  if @options[:file]
67
67
  unless ARGV.length == 0
@@ -91,7 +91,7 @@ module StdOutToggler
91
91
  end
92
92
  end
93
93
 
94
- #builds the list of type maps used to dynamically generate methods
94
+ #Builds the list of type maps used to dynamically generate methods
95
95
  #in the stdout_regex class
96
96
  def build_stdout_type_maps
97
97
  default_stdout_type_maps = [] #part of gem configuration
@@ -121,7 +121,7 @@ module StdOutToggler
121
121
  @stdout_type_maps = (default_stdout_type_maps + configured_stdout_type_maps).uniq
122
122
  end
123
123
 
124
- #ensures that all type maps are valid
124
+ #Ensures that all type maps are valid
125
125
  def validate_stdout_type_maps
126
126
  type_maps_validator = TypesValidator.new(@stdout_type_maps)
127
127
 
@@ -149,7 +149,7 @@ module StdOutToggler
149
149
  end
150
150
  end
151
151
 
152
- #comment/uncomment designated files, per command line instruction
152
+ #Comment/uncomment designated files, per command line instruction
153
153
  def run
154
154
  @stdout_type_maps.each do |type_map|
155
155
  StdOutRegex::Producer.create_methods_for_producing_stdout_regex_strings(type_map)
@@ -202,7 +202,7 @@ module StdOutToggler
202
202
 
203
203
  end
204
204
 
205
- #displays results
205
+ #Displays results
206
206
  def notify
207
207
  file_string = @files.reduce(""){|a,file| a << (file + ", ")}.chop.chop
208
208
  puts "All standard output lines in #{file_string} have been #{@options[:instruction]}ed#{@options[:instruction] == "comment" ? " out" : ""}."
@@ -1,6 +1,6 @@
1
1
  module StdOutToggler
2
2
 
3
- #provides a clean, testable interface that
3
+ #Provides a clean, testable interface that
4
4
  #handles the process of commenting out a file
5
5
  class FileWriter
6
6
  def self.modify_file(input_file_handle, output_file_handle, stdout_regex)
@@ -9,7 +9,7 @@ module StdOutToggler
9
9
  #See lib/stdouttoggler/types.rb for the default list of maps used by stdouttoggler.
10
10
  module StdOutRegex
11
11
 
12
- #data type for regex and substitution strings
12
+ #Data type for regex and substitution strings
13
13
  class Holder
14
14
  attr_accessor :regex_interpolation, :substitution_string_interpolation
15
15
  def initialize(regex_interpolation, substitution_string_interpolation)
@@ -17,7 +17,7 @@ module StdOutToggler
17
17
  end
18
18
  end
19
19
 
20
- #uses dynamically generated methods to produce necessary regexes and string substitutions for files
20
+ #Uses dynamically generated methods to produce necessary regexes and string substitutions for files
21
21
  class Producer
22
22
  #From the options map argument, this macro creates methods of the form <type>_comment_regex and <type>_uncomment_regex,
23
23
  #for example: java_comment_regex and java_uncomment_regex
@@ -1,6 +1,6 @@
1
1
  module StdOutToggler
2
2
 
3
- #class to hold our default file types
3
+ #Class to hold our default file types
4
4
  class Types
5
5
  attr_accessor :type_maps
6
6
  def initialize
@@ -9,6 +9,7 @@ module StdOutToggler
9
9
  type_maps[1] = {:type => "javascript", :extension => ".js", :keyword => "alert", :comment_string => "//", :comment_string_escaped => "\\/\\/"}
10
10
  type_maps[2] = {:type => "jsp", :extension => ".jsp", :keyword => "alert", :comment_string => "//", :comment_string_escaped => "\\/\\/"}
11
11
  type_maps[3] = {:type => "ruby", :extension => ".rb", :keyword => "puts", :comment_string => "#", :comment_string_escaped => "#"}
12
+ type_maps[4] = {:type => "perl", :extension => ".pl", :keyword => "print", :comment_string => "#", :comment_string_escaped => "#"}
12
13
  end
13
14
  end
14
15
 
data/lib/stdouttoggler.rb CHANGED
@@ -10,7 +10,7 @@
10
10
  require 'stdouttoggler/application.rb'
11
11
  require 'pathname'
12
12
 
13
- #application namespace
13
+ #Application namespace
14
14
  module StdOutToggler
15
15
  #returns the name of the executable file
16
16
  def self.executable
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name="stdouttoggler"
3
- s.version="0.5.1.pre"
3
+ s.version="1.0.0"
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"
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stdouttoggler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1.pre
5
- prerelease: 6
4
+ version: 1.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mark Buechler
@@ -52,9 +52,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
52
  required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
- - - ! '>'
55
+ - - ! '>='
56
56
  - !ruby/object:Gem::Version
57
- version: 1.3.1
57
+ version: '0'
58
58
  requirements: []
59
59
  rubyforge_project:
60
60
  rubygems_version: 1.8.24