kissgen 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,15 +1,22 @@
1
- RC Generator
2
- ============
1
+ = KISS Generator
3
2
 
4
- A simple code generator.
3
+ Keep it stupid simple (or simple stupid) code generator.
5
4
 
6
- = API Usage
5
+ == Installation
6
+
7
+ gem install kissgen
8
+
9
+ == API Usage
7
10
 
8
11
  require 'rcgen'
9
12
  KISSGen::Generator.new "/path/to/generator", "/path/where/files/are/generated"
10
13
  KISSGen::Generator.generate(:pretend => true)
11
14
  KISSGen::Generator.generate
12
15
 
13
- = Console Usage (TODO)
16
+ == Console Usage (TODO)
14
17
 
15
18
  rake generator:build <generator_name>
19
+
20
+ == Repository
21
+
22
+ visit http://github.com/lancecarlson/kissgen/ or git clone git://github.com/lancecarlson/kissgen.git
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ spec = Gem::Specification.new do |s|
14
14
  s.platform = Gem::Platform::RUBY
15
15
  s.author = "Lance Carlson"
16
16
  s.email = "lancecarlson@gmail.com"
17
- s.homepage = "http://rcgen.rubyforge.org"
17
+ s.homepage = "http://kissgen.rubyforge.org"
18
18
  s.summary = "A Simple Code Generator"
19
19
  s.bindir = "bin"
20
20
  s.description = s.summary
@@ -36,7 +36,7 @@ end
36
36
  desc "Run :package and install the resulting .gem"
37
37
  task :install do
38
38
  sh %{rake package}
39
- sh %{sudo gem install pkg/#{NAME}-#{VERS}}
39
+ sh %{sudo gem install pkg/#{NAME}-#{KISSGen::VERSION}}
40
40
  end
41
41
 
42
42
  desc "Run :clean and uninstall the .gem"
@@ -76,7 +76,7 @@ end
76
76
  desc 'send rdoc to rubyforge'
77
77
  task :rf_doc do
78
78
  sh %{sudo chmod -R 755 doc}
79
- sh %{/usr/bin/scp -r -p doc/* lancelot@rubyforge.org:/var/www/gforge-projects/anvil}
79
+ sh %{/usr/bin/scp -r -p doc/* lancelot@rubyforge.org:/var/www/gforge-projects/kissgen}
80
80
  end
81
81
 
82
82
  ##############################################################################
data/bin/kissgen CHANGED
@@ -7,4 +7,5 @@ unless ARGV.size == 2
7
7
  end
8
8
 
9
9
  require "kissgen"
10
- @generator = KISSGen::Generator.new ARGV.shift, ARGV.shift
10
+ @generator = KISSGen::Generator.new ARGV.shift, ARGV.shift
11
+ @generator.generate
@@ -37,7 +37,7 @@ module KISSGen
37
37
  puts(options[:pretend] ? @explain_pretend : @explain_generate)
38
38
 
39
39
  @files.each do |file|
40
- puts(options[:pretend] ? "#{file.copy_path}" : file.create)
40
+ options[:pretend] ? puts("#{file.copy_path}") : file.create
41
41
  end
42
42
 
43
43
  puts @explain_footer
@@ -23,20 +23,44 @@ module KISSGen
23
23
  File.join @generator.copy_path, @copy_path
24
24
  end
25
25
 
26
+ # Parsed ERB output
27
+ def output
28
+ ERB.new(IO.read(full_source_path)).result
29
+ end
30
+
31
+ def get_file
32
+
33
+ end
34
+
35
+ def write_or_prompt
36
+ if File.exists?(full_copy_path)
37
+ print "Already exists. Replace? (Yn)"
38
+ @replace = gets.chomp
39
+ if ["Y","y",""].include? @replace
40
+ write
41
+ puts "#{copy_path} Replaced."
42
+ else
43
+ puts "#{copy_path} Preserved."
44
+ end
45
+ else
46
+ write
47
+ end
48
+ end
49
+
26
50
  # This will create the file with parsed data in the destination directory
27
51
  def create
28
- puts copy_path
52
+ puts @copy_path
29
53
  FileUtils.mkdir_p(File.dirname(full_copy_path))
54
+
55
+ write_or_prompt
56
+ end
57
+
58
+ def write
30
59
  @file = File.new full_copy_path, "w"
31
60
  @file.print output # Taylor OWNZ
32
61
  @file.close
33
62
  end
34
63
 
35
- # Parsed ERB output
36
- def output
37
- ERB.new(IO.read(full_source_path)).result
38
- end
39
-
40
64
  # Will remove the file if it exists
41
65
  def delete
42
66
  raise "Need to create the file first. File: #{@file.inspect}" unless @file
@@ -1,3 +1,3 @@
1
1
  module KISSGen
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -32,9 +32,8 @@ describe KISSGen::Generator do
32
32
  end
33
33
 
34
34
  it "should generate new template files when no options are not set" do
35
- #@generator.generate
36
- #puts @copy_path
37
- #File.exists?(@copy_path + "/README").should be_true
35
+ @generator.generate
36
+ File.exists?(@copy_path + "/README").should be_true
38
37
  end
39
38
  end
40
39
  end
@@ -0,0 +1,3 @@
1
+ This is some test readme
2
+
3
+ woohoo!
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kissgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lance Carlson
@@ -28,12 +28,11 @@ files:
28
28
  - Rakefile
29
29
  - bin/kissgen
30
30
  - spec/public
31
- - spec/public/app
32
- - spec/public/app/views
33
- - spec/public/app/views/layout
34
31
  - spec/public/generator_spec.rb
35
32
  - spec/public/generators
36
33
  - spec/public/generators/empty
34
+ - spec/public/generators/empty/Rakefile
35
+ - spec/public/generators/empty/README
37
36
  - spec/public/generators/merb_app
38
37
  - spec/public/generators/merb_app/app
39
38
  - spec/public/generators/merb_app/app/controllers
@@ -57,9 +56,6 @@ files:
57
56
  - spec/public/generators/merb_app/README
58
57
  - spec/public/generators/merb_app/setup.rb
59
58
  - spec/public/template_spec.rb
60
- - spec/publicapp
61
- - spec/publicapp/views
62
- - spec/publicapp/views/layout
63
59
  - spec/spec.opts
64
60
  - spec/spec_helper.rb
65
61
  - lib/kissgen
@@ -68,7 +64,7 @@ files:
68
64
  - lib/kissgen/version.rb
69
65
  - lib/kissgen.rb
70
66
  has_rdoc: true
71
- homepage: http://rcgen.rubyforge.org
67
+ homepage: http://kissgen.rubyforge.org
72
68
  post_install_message:
73
69
  rdoc_options: []
74
70