newgem 0.3.0 → 0.4.0

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/bin/newgem CHANGED
@@ -2,10 +2,41 @@
2
2
 
3
3
  require 'fileutils'
4
4
  require 'active_support'
5
+ require 'optparse'
5
6
 
6
7
  templates = File.dirname(__FILE__) + '/../templates/'
7
8
 
9
+ OPTIONS = {
10
+ :import_path => nil,
11
+ :version => '0.0.1',
12
+ }
13
+ parser = OptionParser.new do |opts|
14
+ opts.banner = <<BANNER
15
+ Take any library or Rails plugin or command line application,
16
+ gemify it, and easily share it with the Ruby world.
17
+
18
+ Usage: #{File.basename($0)} [options] <name of gem>
19
+
20
+ Options are:
21
+ BANNER
22
+ opts.separator ""
23
+ opts.on("-i", "--import_path=PATH", String,
24
+ "Path where your files could be copied from",
25
+ "Default: none") { |OPTIONS[:import_path]| }
26
+ opts.separator ""
27
+ opts.on("-v", "--version=YOUR_VERSION", String,
28
+ "Version of the gem you are creating",
29
+ "Default: 0.0.1") { |OPTIONS[:version]| }
30
+ opts.separator ""
31
+ opts.on("-h", "--help",
32
+ "Show this help message.") { puts opts; exit }
33
+ opts.parse!(ARGV)
34
+ end
35
+ OPTIONS[:version] = OPTIONS[:version].to_s.split(/\./)
36
+
8
37
  gem_name = project_name = ARGV[0]
38
+ parser.parse!(["-h"]) unless gem_name
39
+
9
40
  module_name = project_name.classify
10
41
  lib = project_name + '/lib'
11
42
  lib_project_name = project_name + '/lib/' + project_name
@@ -43,6 +74,12 @@ end
43
74
  puts "creating: " + lib
44
75
  Dir.mkdir lib
45
76
 
77
+ if OPTIONS[:import_path]
78
+ require 'fileutils'
79
+ OPTIONS[:import_path].chomp! if OPTIONS[:import_path][-1] == 47 # /
80
+ FileUtils.cp_r OPTIONS[:import_path] + '/.', lib, :preserve => true
81
+ end
82
+
46
83
  puts "creating: " + lib_project_name
47
84
  Dir.mkdir lib_project_name
48
85
 
@@ -56,9 +93,9 @@ File.open(version, 'w') do |file|
56
93
  file << <<-eos
57
94
  module #{module_name} #:nodoc:
58
95
  module VERSION #:nodoc:
59
- MAJOR = 0
60
- MINOR = 0
61
- TINY = 1
96
+ MAJOR = #{OPTIONS[:version][0] || '0'}
97
+ MINOR = #{OPTIONS[:version][1] || '0'}
98
+ TINY = #{OPTIONS[:version][2] || '0'}
62
99
 
63
100
  STRING = [MAJOR, MINOR, TINY].join('.')
64
101
  end
@@ -1,7 +1,7 @@
1
1
  module Newgem #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 3
4
+ MINOR = 4
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
data/templates/Rakefile CHANGED
@@ -13,6 +13,7 @@ AUTHOR = "you"
13
13
  EMAIL = "your contact email for bug fixes and info"
14
14
  DESCRIPTION = "description of gem"
15
15
  HOMEPATH = 'http://#{gem_name}.rubyforge.org'
16
+ BIN_FILES = %w( )
16
17
 
17
18
 
18
19
  NAME = "#{gem_name}"
@@ -24,7 +25,6 @@ RDOC_OPTS = ['--quiet', '--title', "#{gem_name} documentation",
24
25
  "--line-numbers",
25
26
  "--main", "README",
26
27
  "--inline-source"]
27
- BIN_FILES = %w( )
28
28
 
29
29
  desc "Packages up #{gem_name} gem."
30
30
  task :default => [:test]
@@ -64,7 +64,7 @@ spec =
64
64
  end
65
65
 
66
66
  Rake::GemPackageTask.new(spec) do |p|
67
- p.need_tar = false
67
+ p.need_tar = true
68
68
  p.gem_spec = spec
69
69
  end
70
70
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: newgem
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.0
7
- date: 2006-10-11 00:00:00 +02:00
6
+ version: 0.4.0
7
+ date: 2006-10-12 00:00:00 +02:00
8
8
  summary: Make your own gems at home
9
9
  require_paths:
10
10
  - lib