grimen-gemgen 0.1.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/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Jonas Grimfelt
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1,19 @@
1
+ h1. GEM-GEN
2
+
3
+ A very basic Ruby gem skeleton generator empowered by Jeweler. Fits most needs.
4
+
5
+ h2. Installation
6
+
7
+ <pre>sudo gem install grimen-gemgen</pre>
8
+
9
+ h2. Usage
10
+
11
+ Example:
12
+
13
+ <pre>gemgen my_cool_gem grimen grimen@gmail.com 'Jonas Grimfelt'</pre>
14
+
15
+ ...or more general:
16
+
17
+ <pre>gemgen GEM_NAME [AUTHOR_GITHUB_ALIAS] ['AUTHOR_EMAIL'] ['AUTHOR_FULL_NAME']</pre>
18
+
19
+ Copyright (c) Jonas Grimfelt, released under the MIT-license.
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ NAME = "gemgen"
6
+ SUMMARY = %Q{Ruby gem skeleton generator.}
7
+ HOMEPAGE = "http://github.com/grimen/#{NAME}/tree/master"
8
+ AUTHOR = "Jonas Grimfelt"
9
+ EMAIL = "grimen@gmail.com"
10
+ SUPPORT_FILES = %w(README.textile)
11
+
12
+ begin
13
+ require 'jeweler'
14
+ Jeweler::Tasks.new do |gem|
15
+ gem.name = NAME
16
+ gem.summary = SUMMARY
17
+ gem.description = SUMMARY
18
+ gem.homepage = HOMEPAGE
19
+ gem.author = AUTHOR
20
+ gem.email = EMAIL
21
+
22
+ gem.require_paths = %w{lib}
23
+ gem.files = SUPPORT_FILES + %w(MIT-LICENSE Rakefile) + Dir.glob(File.join('{bin,templates}', '**', '*'))
24
+ gem.executables = %w(gemgen)
25
+ gem.extra_rdoc_files = SUPPORT_FILES
26
+ end
27
+ rescue LoadError
28
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
29
+ end
30
+
31
+ desc %Q{Run unit tests for "#{NAME}".}
32
+ task :default => :test
33
+
34
+ desc %Q{Run unit tests for "#{NAME}".}
35
+ Rake::TestTask.new(:test) do |test|
36
+ test.libs << 'lib'
37
+ test.pattern = 'test/**/*_test.rb'
38
+ test.verbose = true
39
+ end
40
+
41
+ desc %Q{Generate documentation for "#{NAME}".}
42
+ Rake::RDocTask.new(:rdoc) do |rdoc|
43
+ rdoc.rdoc_dir = 'rdoc'
44
+ rdoc.title = NAME
45
+ rdoc.options << '--line-numbers' << '--inline-source' << '--charset=UTF-8'
46
+ rdoc.rdoc_files.include(SUPPORT_FILES)
47
+ rdoc.rdoc_files.include(File.join('lib', '**', '*.rb'))
48
+ end
data/bin/gemgen ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+
5
+ DIRS = %w(bin lib test tasks rails).freeze
6
+ TEMPLATE_FILES = [
7
+ 'MIT-LICENSE',
8
+ 'Rakefile',
9
+ 'README.textile',
10
+ File.join('lib', 'GEM_NAME.rb'),
11
+ File.join('test', 'GEM_NAME_test.rb'),
12
+ File.join('tasks', 'GEM_NAME.rake'),
13
+ File.join('rails', 'init.rb')
14
+ ].freeze
15
+
16
+ begin
17
+ raise if ARGV.size == 0
18
+
19
+ gem_name = ARGV[0].strip
20
+ gem_author_alias = ARGV[1].strip rescue 'grimen'
21
+ gem_author_name = ARGV[2].strip rescue gem_author_alias
22
+ gem_author_email = ARGV[3].strip rescue 'grimen@gmail.com'
23
+ gem_name_full = "#{gem_author_alias}-#{gem_name}"
24
+
25
+ new_gem_path = File.join(FileUtils.pwd, gem_name)
26
+ templates_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'templates'))
27
+
28
+ FileUtils.mkdir(new_gem_path)
29
+
30
+ # Generate directories.
31
+ DIRS.each do |directory|
32
+ FileUtils.mkdir(File.join(new_gem_path, directory))
33
+ end
34
+
35
+ # Generate files from templates.
36
+ TEMPLATE_FILES.each do |file|
37
+ FileUtils.cp(File.join(templates_path, file),
38
+ File.join(new_gem_path, file.gsub('GEM_NAME', gem_name)))
39
+ end
40
+
41
+ # Replace placeholder constants in the generated files with proper values.
42
+ TEMPLATE_FILES.each do |file|
43
+ new_file = File.join(new_gem_path, file.gsub('GEM_NAME', gem_name))
44
+ file_source = File.read(new_file)
45
+ file_source.gsub!('{{GEM_NAME}}', gem_name)
46
+ file_source.gsub!('{{GEM_NAME_FULL}}', gem_name_full)
47
+ file_source.gsub!('{{AUTHOR_ALIAS}}', gem_author_alias)
48
+ file_source.gsub!('{{AUTHOR_NAME}}', gem_author_name)
49
+ file_source.gsub!('{{AUTHOR_EMAIL}}', gem_author_email)
50
+ File.open(new_file, 'wb') { |f| f.write(file_source) }
51
+ end
52
+ rescue
53
+ puts "USAGE: gemgen GEM_NAME [AUTHOR_GITHUB_ALIAS] ['AUTHOR_EMAIL'] ['AUTHOR_FULL_NAME']"
54
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) {{YEAR}} {{AUTHOR_NAME}}
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ h1. {{GEM_NAME}}
2
+
3
+ h2. Installation
4
+
5
+ <pre>sudo gem install {{GEM_NAME_FULL}}</pre>
6
+
7
+ Copyright (c) {{AUTHOR_NAME}}, released under the MIT-license.
@@ -0,0 +1,48 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ NAME = "{{GEM_NAME}}"
6
+ SUMMARY = %Q{}
7
+ HOMEPAGE = "http://github.com/{{AUTHOR_ALIAS}}/#{NAME}/tree/master"
8
+ AUTHOR = "{{AUTHOR_NAME}}"
9
+ EMAIL = "{{AUTHOR_EMAIL}}"
10
+ SUPPORT_FILES = %w(README.textile)
11
+
12
+ begin
13
+ require 'jeweler'
14
+ Jeweler::Tasks.new do |gem|
15
+ gem.name = NAME
16
+ gem.summary = SUMMARY
17
+ gem.description = SUMMARY
18
+ gem.homepage = HOMEPAGE
19
+ gem.author = AUTHOR
20
+ gem.email = EMAIL
21
+
22
+ gem.require_paths = %w{lib}
23
+ gem.files = SUPPORT_FILES + %w(MIT-LICENSE Rakefile) + Dir.glob(File.join('{bin,lib,test,rails}', '**', '*'))
24
+ gem.executables = %w()
25
+ gem.extra_rdoc_files = SUPPORT_FILES
26
+ end
27
+ rescue LoadError
28
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
29
+ end
30
+
31
+ desc %Q{Run unit tests for "#{NAME}".}
32
+ task :default => :test
33
+
34
+ desc %Q{Run unit tests for "#{NAME}".}
35
+ Rake::TestTask.new(:test) do |test|
36
+ test.libs << 'lib'
37
+ test.pattern = 'test/**/*_test.rb'
38
+ test.verbose = true
39
+ end
40
+
41
+ desc %Q{Generate documentation for "#{NAME}".}
42
+ Rake::RDocTask.new(:rdoc) do |rdoc|
43
+ rdoc.rdoc_dir = 'rdoc'
44
+ rdoc.title = NAME
45
+ rdoc.options << '--line-numbers' << '--inline-source' << '--charset=UTF-8'
46
+ rdoc.rdoc_files.include(SUPPORT_FILES)
47
+ rdoc.rdoc_files.include(File.join('lib', '**', '*.rb'))
48
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), 'lib', '**', '*.rb'))).uniq.each do |file|
2
+ require file
3
+ end
@@ -0,0 +1,9 @@
1
+ namespace :{{GEM_NAME}} do
2
+
3
+ GEM_ROOT = File.join(File.dirname(__FILE__), '..').freeze
4
+
5
+ task :setup do
6
+
7
+ end
8
+
9
+ end
File without changes
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grimen-gemgen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Jonas Grimfelt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-11 00:00:00 -07:00
13
+ default_executable: gemgen
14
+ dependencies: []
15
+
16
+ description: Ruby gem skeleton generator.
17
+ email: grimen@gmail.com
18
+ executables:
19
+ - gemgen
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.textile
24
+ files:
25
+ - MIT-LICENSE
26
+ - README.textile
27
+ - Rakefile
28
+ - bin/gemgen
29
+ - templates/MIT-LICENSE
30
+ - templates/README.textile
31
+ - templates/Rakefile
32
+ - templates/lib/GEM_NAME.rb
33
+ - templates/rails/init.rb
34
+ - templates/tasks/GEM_NAME.rake
35
+ - templates/test/GEM_NAME_test.rb
36
+ has_rdoc: false
37
+ homepage: http://github.com/grimen/gemgen/tree/master
38
+ post_install_message:
39
+ rdoc_options:
40
+ - --charset=UTF-8
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ requirements: []
56
+
57
+ rubyforge_project:
58
+ rubygems_version: 1.2.0
59
+ signing_key:
60
+ specification_version: 3
61
+ summary: Ruby gem skeleton generator.
62
+ test_files: []
63
+