super_stamper 0.0.1
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/.gemtest +0 -0
- data/History.txt +4 -0
- data/Manifest.txt +19 -0
- data/PostInstall.txt +10 -0
- data/README.rdoc +50 -0
- data/Rakefile +26 -0
- data/bin/super_stamper +10 -0
- data/lib/super_stamper/cli.rb +42 -0
- data/lib/super_stamper.rb +73 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/data/header1.txt +24 -0
- data/test/data/header2.txt +19 -0
- data/test/data/step1.txt +15 -0
- data/test/data/step2.txt +40 -0
- data/test/data/step3.txt +35 -0
- data/test/test_helper.rb +3 -0
- data/test/test_super_stamper.rb +40 -0
- data/test/test_super_stamper_cli.rb +14 -0
- metadata +104 -0
data/.gemtest
ADDED
File without changes
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
bin/super_stamper
|
7
|
+
lib/super_stamper.rb
|
8
|
+
lib/super_stamper/cli.rb
|
9
|
+
script/console
|
10
|
+
script/destroy
|
11
|
+
script/generate
|
12
|
+
test/test_helper.rb
|
13
|
+
test/test_super_stamper.rb
|
14
|
+
test/test_super_stamper_cli.rb
|
15
|
+
test/data/header1.txt
|
16
|
+
test/data/header2.txt
|
17
|
+
test/data/step1.txt
|
18
|
+
test/data/step2.txt
|
19
|
+
test/data/step3.txt
|
data/PostInstall.txt
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Just one more step until you're ready:
|
2
|
+
|
3
|
+
Create a file called 'header.txt' and put it in the directory that contains your source files.
|
4
|
+
Every line should be commented (e.g. prefixed with a hash '#')
|
5
|
+
|
6
|
+
Then, change directory to your project and run super_stamper:
|
7
|
+
|
8
|
+
$ super_stamper
|
9
|
+
|
10
|
+
Enjoy stamping your own files!
|
data/README.rdoc
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
= super_stamper
|
2
|
+
|
3
|
+
* http://github.com/cmdjohnson/super_stamper
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Easily add a header recursively to multiple files in your project directory.
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
Stamp your files!
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
1. Create a file called 'header.txt' in your project dir
|
16
|
+
2. Run 'super_stamper'
|
17
|
+
3. Enjoy your freshly stamped files and impress yourself with a super-long 'git status' overview.
|
18
|
+
|
19
|
+
== REQUIREMENTS:
|
20
|
+
|
21
|
+
Ruby
|
22
|
+
|
23
|
+
== INSTALL:
|
24
|
+
|
25
|
+
$ sudo gem install super_stamper
|
26
|
+
|
27
|
+
== LICENSE:
|
28
|
+
|
29
|
+
(The MIT License)
|
30
|
+
|
31
|
+
Copyright (c) 2011 Commander Johnson <commanderjohnson@gmail.com>
|
32
|
+
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
34
|
+
a copy of this software and associated documentation files (the
|
35
|
+
'Software'), to deal in the Software without restriction, including
|
36
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
37
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
38
|
+
permit persons to whom the Software is furnished to do so, subject to
|
39
|
+
the following conditions:
|
40
|
+
|
41
|
+
The above copyright notice and this permission notice shall be
|
42
|
+
included in all copies or substantial portions of the Software.
|
43
|
+
|
44
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
45
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
46
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
47
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
48
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
49
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
50
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/super_stamper'
|
6
|
+
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
# Hoe.plugin :website
|
9
|
+
# Hoe.plugin :cucumberfeatures
|
10
|
+
|
11
|
+
# Generate all the Rake tasks
|
12
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
|
+
$hoe = Hoe.spec 'super_stamper' do
|
14
|
+
self.developer 'Commander Johnson', 'commanderjohnson@gmail.com'
|
15
|
+
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
16
|
+
self.rubyforge_name = self.name # TODO this is default value
|
17
|
+
# self.extra_deps = [['activesupport','>= 2.0.2']]
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'newgem/tasks'
|
22
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
23
|
+
|
24
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
25
|
+
# remove_task :default
|
26
|
+
# task :default => [:spec, :features]
|
data/bin/super_stamper
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created on 2011-10-2.
|
4
|
+
# Copyright (c) 2011. All rights reserved.
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/super_stamper")
|
8
|
+
require "super_stamper/cli"
|
9
|
+
|
10
|
+
SuperStamper::CLI.execute(STDOUT, ARGV)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module SuperStamper
|
4
|
+
class CLI
|
5
|
+
def self.execute(stdout, arguments=[])
|
6
|
+
|
7
|
+
options = {
|
8
|
+
:filename => 'header.txt'
|
9
|
+
}
|
10
|
+
mandatory_options = %w( )
|
11
|
+
|
12
|
+
parser = OptionParser.new do |opts|
|
13
|
+
opts.banner = <<-BANNER.gsub(/^ /,'')
|
14
|
+
Easily add a header recursively to multiple files in your project directory.
|
15
|
+
|
16
|
+
Usage: #{File.basename($0)} [options]
|
17
|
+
|
18
|
+
Options are:
|
19
|
+
BANNER
|
20
|
+
opts.separator ""
|
21
|
+
########################################################################
|
22
|
+
opts.on("-f", "--filename PATH", String,
|
23
|
+
"Which file to use as header.",
|
24
|
+
"Default: header.txt") { |arg| options[:filename] = arg }
|
25
|
+
########################################################################
|
26
|
+
opts.on("-h", "--help",
|
27
|
+
"Show this help message.") { stdout.puts opts; exit }
|
28
|
+
########################################################################
|
29
|
+
opts.on("-v", "--version", "Print version (#{SuperStamper::VERSION})") { stdout.puts "#{SuperStamper::VERSION}"; exit }
|
30
|
+
opts.parse!(arguments)
|
31
|
+
|
32
|
+
if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
|
33
|
+
stdout.puts opts; exit
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
filename = options[:filename]
|
38
|
+
|
39
|
+
SuperStamper::Base.stamp_recursively( :header_file_name => filename )
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
4
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
5
|
+
|
6
|
+
module SuperStamper
|
7
|
+
# a version constant
|
8
|
+
VERSION = '0.0.1'
|
9
|
+
# a class
|
10
|
+
class Base
|
11
|
+
BEGIN_HEADER = "# -- begin header --"
|
12
|
+
END_HEADER = "# -- end header --"
|
13
|
+
DEFAULT_HEADER_FILE_NAME = "header.txt"
|
14
|
+
NEWLINE = "\n"
|
15
|
+
|
16
|
+
def self.stamp_recursively(options = {})
|
17
|
+
extension = options[:extension] || "rb"
|
18
|
+
|
19
|
+
count = 0
|
20
|
+
|
21
|
+
Dir["**/*.#{extension}"].each do |f|
|
22
|
+
le_stamp_options = { :filename => f, :header_file_name => options[:header_file_name] }
|
23
|
+
stamp_single le_stamp_options
|
24
|
+
count += 1
|
25
|
+
end
|
26
|
+
|
27
|
+
# Informative!
|
28
|
+
puts "super_stamper: I inserted a header into #{count} files with extension .#{extension} (recursively)."
|
29
|
+
|
30
|
+
count
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.stamp_single(options = {})
|
34
|
+
ret = nil
|
35
|
+
|
36
|
+
file = nil
|
37
|
+
header = nil
|
38
|
+
|
39
|
+
filename = options[:filename]
|
40
|
+
header_file_name = options[:header_file_name] || "header.txt"
|
41
|
+
|
42
|
+
raise "I need a filename" if filename.nil?
|
43
|
+
raise "Please provide a valid filename (-f) or create a header.txt in your working directory." unless File.exists?(header_file_name)
|
44
|
+
|
45
|
+
file = File.new(filename)
|
46
|
+
header = File.new(header_file_name).read
|
47
|
+
|
48
|
+
unless file.nil? || header.nil?
|
49
|
+
str = file.read
|
50
|
+
# Let's remove the magic_encoding at the start, if any.
|
51
|
+
str.gsub!(/^# -\*-.+-\*-(\r)?#{NEWLINE}/, '')
|
52
|
+
# and now .. do this.
|
53
|
+
contents_array = [ BEGIN_HEADER, NEWLINE, header, NEWLINE, END_HEADER, NEWLINE ]
|
54
|
+
contents_str = contents_array.to_s
|
55
|
+
# Remove the header that was already in place, if any.
|
56
|
+
str.gsub!(/#{BEGIN_HEADER}.*#{END_HEADER}#{NEWLINE}/m, '')
|
57
|
+
# concat it
|
58
|
+
contents = contents_str + str
|
59
|
+
# Re-open file and write to it
|
60
|
+
file.close
|
61
|
+
file = File.new(filename, 'w')
|
62
|
+
# write
|
63
|
+
file.write(contents)
|
64
|
+
# close again
|
65
|
+
file.close
|
66
|
+
# Return it
|
67
|
+
ret = file
|
68
|
+
end
|
69
|
+
|
70
|
+
ret
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/super_stamper.rb'}"
|
9
|
+
puts "Loading super_stamper gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This is my header.
|
2
|
+
#
|
3
|
+
# I use it for copyright notices and whatnot.
|
4
|
+
#
|
5
|
+
#
|
6
|
+
#
|
7
|
+
#
|
8
|
+
#
|
9
|
+
# There are a lot of headers, but this one is mine.
|
10
|
+
#
|
11
|
+
#
|
12
|
+
# here's some ascii art of the word gopher
|
13
|
+
# _
|
14
|
+
# (_)
|
15
|
+
# _ _ _ _ _ _ _ _ _ _ _ (_) _ _ _ _ _ _ _ _ _ _
|
16
|
+
# _(_)(_)(_)(_) _ (_)(_)(_) _ (_)(_)(_)(_)_ (_)(_)(_)(_)_ (_)(_)(_)(_)_(_)_ _ (_)(_)
|
17
|
+
# (_) (_)(_) (_)(_) (_)(_) (_)(_) _ _ _ (_) (_)(_)
|
18
|
+
# (_) (_)(_) (_)(_) (_)(_) (_)(_)(_)(_)(_)(_) (_)
|
19
|
+
# (_)_ _ _ (_)(_) _ _ _ (_)(_) _ _ _(_)(_) (_)(_)_ _ _ _ (_)
|
20
|
+
# (_)(_)(_)(_) (_)(_)(_) (_)(_)(_)(_) (_) (_) (_)(_)(_)(_) (_)
|
21
|
+
# _ _ _ (_) (_)
|
22
|
+
# (_)(_)(_) (_)
|
23
|
+
#
|
24
|
+
# Done.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Let's put gopher in a different font now.
|
2
|
+
#
|
3
|
+
# :
|
4
|
+
# t#, ,;
|
5
|
+
# .Gt ;##W. t . . f#i j.
|
6
|
+
# j#W: :#L:WE ED. Di Dt .E#t EW,
|
7
|
+
# ;K#f .KG ,#D E#K: E#i E#i i#W, E##j
|
8
|
+
# .G#D. EE ;#f E##W; E#t E#t L#D. E###D.
|
9
|
+
# j#K; f#. t#iE#E##t E#t E#t :K#Wfff; E#jG#W;
|
10
|
+
# ,K#f ,GD;:#G GK E#ti##f E########f. i##WLLLLt E#t t##f
|
11
|
+
# j#Wi E#t ;#L LW. E#t ;##D. E#j..K#j... .E#L E#t :K#E:
|
12
|
+
# .G#D: E#t t#f f#: E#ELLE##K:E#t E#t f#E: E#KDDDD###i
|
13
|
+
# ,K#fK#t f#D#; E#L;;;;;;,E#t E#t ,WW; E#f,t#Wi,,,
|
14
|
+
# j###t G#t E#t f#t f#t .D#; E#t ;#W:
|
15
|
+
# .G#t t E#t ii ii tt DWi ,KK:
|
16
|
+
# ;;
|
17
|
+
#
|
18
|
+
#
|
19
|
+
# Done.
|
data/test/data/step1.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
################################################################################
|
4
|
+
# This is my source file. It has some comment lines already on the top.
|
5
|
+
################################################################################
|
6
|
+
# w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t
|
7
|
+
################################################################################
|
8
|
+
|
9
|
+
class Foo
|
10
|
+
# header should appear above the line 'class foo'
|
11
|
+
|
12
|
+
def bar
|
13
|
+
"baz"
|
14
|
+
end
|
15
|
+
end
|
data/test/data/step2.txt
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# -- begin header --
|
2
|
+
# This is my header.
|
3
|
+
#
|
4
|
+
# I use it for copyright notices and whatnot.
|
5
|
+
#
|
6
|
+
#
|
7
|
+
#
|
8
|
+
#
|
9
|
+
#
|
10
|
+
# There are a lot of headers, but this one is mine.
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# here's some ascii art of the word gopher
|
14
|
+
# _
|
15
|
+
# (_)
|
16
|
+
# _ _ _ _ _ _ _ _ _ _ _ (_) _ _ _ _ _ _ _ _ _ _
|
17
|
+
# _(_)(_)(_)(_) _ (_)(_)(_) _ (_)(_)(_)(_)_ (_)(_)(_)(_)_ (_)(_)(_)(_)_(_)_ _ (_)(_)
|
18
|
+
# (_) (_)(_) (_)(_) (_)(_) (_)(_) _ _ _ (_) (_)(_)
|
19
|
+
# (_) (_)(_) (_)(_) (_)(_) (_)(_)(_)(_)(_)(_) (_)
|
20
|
+
# (_)_ _ _ (_)(_) _ _ _ (_)(_) _ _ _(_)(_) (_)(_)_ _ _ _ (_)
|
21
|
+
# (_)(_)(_)(_) (_)(_)(_) (_)(_)(_)(_) (_) (_) (_)(_)(_)(_) (_)
|
22
|
+
# _ _ _ (_) (_)
|
23
|
+
# (_)(_)(_) (_)
|
24
|
+
#
|
25
|
+
# Done.
|
26
|
+
# -- end header --
|
27
|
+
|
28
|
+
################################################################################
|
29
|
+
# This is my source file. It has some comment lines already on the top.
|
30
|
+
################################################################################
|
31
|
+
# w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t
|
32
|
+
################################################################################
|
33
|
+
|
34
|
+
class Foo
|
35
|
+
# header should appear above the line 'class foo'
|
36
|
+
|
37
|
+
def bar
|
38
|
+
"baz"
|
39
|
+
end
|
40
|
+
end
|
data/test/data/step3.txt
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# -- begin header --
|
2
|
+
# Let's put gopher in a different font now.
|
3
|
+
#
|
4
|
+
# :
|
5
|
+
# t#, ,;
|
6
|
+
# .Gt ;##W. t . . f#i j.
|
7
|
+
# j#W: :#L:WE ED. Di Dt .E#t EW,
|
8
|
+
# ;K#f .KG ,#D E#K: E#i E#i i#W, E##j
|
9
|
+
# .G#D. EE ;#f E##W; E#t E#t L#D. E###D.
|
10
|
+
# j#K; f#. t#iE#E##t E#t E#t :K#Wfff; E#jG#W;
|
11
|
+
# ,K#f ,GD;:#G GK E#ti##f E########f. i##WLLLLt E#t t##f
|
12
|
+
# j#Wi E#t ;#L LW. E#t ;##D. E#j..K#j... .E#L E#t :K#E:
|
13
|
+
# .G#D: E#t t#f f#: E#ELLE##K:E#t E#t f#E: E#KDDDD###i
|
14
|
+
# ,K#fK#t f#D#; E#L;;;;;;,E#t E#t ,WW; E#f,t#Wi,,,
|
15
|
+
# j###t G#t E#t f#t f#t .D#; E#t ;#W:
|
16
|
+
# .G#t t E#t ii ii tt DWi ,KK:
|
17
|
+
# ;;
|
18
|
+
#
|
19
|
+
#
|
20
|
+
# Done.
|
21
|
+
# -- end header --
|
22
|
+
|
23
|
+
################################################################################
|
24
|
+
# This is my source file. It has some comment lines already on the top.
|
25
|
+
################################################################################
|
26
|
+
# w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t w00t
|
27
|
+
################################################################################
|
28
|
+
|
29
|
+
class Foo
|
30
|
+
# header should appear above the line 'class foo'
|
31
|
+
|
32
|
+
def bar
|
33
|
+
"baz"
|
34
|
+
end
|
35
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
class SuperStamperTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
# My files
|
8
|
+
@filenames = [ "step1", "step2", "step3", "header1", "header2" ]
|
9
|
+
# Copy these files to temp dir
|
10
|
+
for file in @filenames
|
11
|
+
FileUtils.cp(get_data_filename(file), get_tmp_filename(file))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_stamp_single
|
16
|
+
step2_str = get_tmp_file('step2').read
|
17
|
+
step3_str = get_tmp_file('step3').read
|
18
|
+
|
19
|
+
SuperStamper::Base.stamp_single( :filename => get_tmp_filename('step1'), :header_file_name => get_tmp_filename('header1') )
|
20
|
+
assert_equal step2_str, get_tmp_file('step1').read
|
21
|
+
|
22
|
+
SuperStamper::Base.stamp_single( :filename => get_tmp_filename('step2'), :header_file_name => get_tmp_filename('header2') )
|
23
|
+
assert_equal step3_str, get_tmp_file('step2').read
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def get_data_filename name
|
29
|
+
File.join("test", "data", "#{name}.txt")
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_tmp_file name
|
33
|
+
File.new(get_tmp_filename(name))
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_tmp_filename name
|
37
|
+
File.join("test", "tmp", "#{name}.txt")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_helper.rb")
|
2
|
+
require 'super_stamper/cli'
|
3
|
+
|
4
|
+
class TestSuperStamperCli < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
SuperStamper::CLI.execute(@stdout_io = StringIO.new, [])
|
7
|
+
@stdout_io.rewind
|
8
|
+
@stdout = @stdout_io.read
|
9
|
+
end
|
10
|
+
|
11
|
+
# def test_print_default_output
|
12
|
+
# assert_match(/To update this executable/, @stdout)
|
13
|
+
# end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: super_stamper
|
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
|
+
- Commander Johnson
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-10-01 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: hoe
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 27
|
29
|
+
segments:
|
30
|
+
- 2
|
31
|
+
- 12
|
32
|
+
version: "2.12"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Easily add a header recursively to multiple files in your project directory.
|
36
|
+
email:
|
37
|
+
- commanderjohnson@gmail.com
|
38
|
+
executables:
|
39
|
+
- super_stamper
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- History.txt
|
44
|
+
- Manifest.txt
|
45
|
+
- PostInstall.txt
|
46
|
+
files:
|
47
|
+
- History.txt
|
48
|
+
- Manifest.txt
|
49
|
+
- PostInstall.txt
|
50
|
+
- README.rdoc
|
51
|
+
- Rakefile
|
52
|
+
- bin/super_stamper
|
53
|
+
- lib/super_stamper.rb
|
54
|
+
- lib/super_stamper/cli.rb
|
55
|
+
- script/console
|
56
|
+
- script/destroy
|
57
|
+
- script/generate
|
58
|
+
- test/test_helper.rb
|
59
|
+
- test/test_super_stamper.rb
|
60
|
+
- test/test_super_stamper_cli.rb
|
61
|
+
- test/data/header1.txt
|
62
|
+
- test/data/header2.txt
|
63
|
+
- test/data/step1.txt
|
64
|
+
- test/data/step2.txt
|
65
|
+
- test/data/step3.txt
|
66
|
+
- .gemtest
|
67
|
+
homepage: http://github.com/cmdjohnson/super_stamper
|
68
|
+
licenses: []
|
69
|
+
|
70
|
+
post_install_message: PostInstall.txt
|
71
|
+
rdoc_options:
|
72
|
+
- --main
|
73
|
+
- README.rdoc
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
requirements: []
|
95
|
+
|
96
|
+
rubyforge_project: super_stamper
|
97
|
+
rubygems_version: 1.8.10
|
98
|
+
signing_key:
|
99
|
+
specification_version: 3
|
100
|
+
summary: Easily add a header recursively to multiple files in your project directory.
|
101
|
+
test_files:
|
102
|
+
- test/test_super_stamper.rb
|
103
|
+
- test/test_helper.rb
|
104
|
+
- test/test_super_stamper_cli.rb
|