gem-init 0.0.2 → 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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Marshall Huss
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,12 @@
1
+ # Install
2
+
3
+ gem install gem-init
4
+
5
+ # Usage
6
+
7
+ mkdir my_awesome_gem
8
+ cd my_awesome_gem
9
+ gem init my_awesome_gem
10
+
11
+ If the gem already exists on [rubygems.org](http://rubygems.org) it will stop and let you know. Use the ``-s`` option to skip the check.
12
+
@@ -11,13 +11,25 @@ class Gem::Commands::InitCommand < Gem::Command
11
11
 
12
12
  end
13
13
 
14
+ def description # :nodoc:
15
+ 'Rubygems plugin to assist in creating a barebones gem'
16
+ end
17
+
18
+ def arguments # :nodoc:
19
+ "GEMNAME name of your new rubygem"
20
+ end
21
+
22
+ def usage # :nodoc:
23
+ "#{program_name} GEMNAME"
24
+ end
25
+
14
26
  def execute
15
- gem_name = get_one_optional_argument
27
+ gem_name = get_new_gem_name
16
28
 
17
29
  gem_exists = options[:skip_check].nil? ? gem_exists?(gem_name) : false
18
30
 
19
31
  if gem_exists
20
- say "That gem already exists on rubygems.org! Find a new name or use the -s option to skip the check"
32
+ say "The #{gem_name} gem already exists on rubygems.org!\n\nChoose a new name or use the -s option to skip the check"
21
33
  else
22
34
  create_gemspec(gem_name)
23
35
  create_ruby_file(gem_name)
@@ -27,11 +39,7 @@ class Gem::Commands::InitCommand < Gem::Command
27
39
 
28
40
  def gem_exists?(gem_name)
29
41
  response = RestClient.get("http://rubygems.org/api/v1/gems/#{gem_name}.json") do |response, request, result|
30
- if response.code == 404
31
- return false
32
- else
33
- return true
34
- end
42
+ return response.code != 404
35
43
  end
36
44
  end
37
45
 
@@ -40,14 +48,17 @@ class Gem::Commands::InitCommand < Gem::Command
40
48
  f.puts <<-GEMSPEC
41
49
  Gem::Specification.new do |s|
42
50
  s.name = "#{gem_name}"
43
- s.version = '0.0.1'
51
+ s.version = '0.1.0'
44
52
  s.authors = ["YOURNAME"]
45
53
  s.email = "TODO YOUREMAIL"
46
54
  s.homepage = "TODO HOMEPAGE"
47
55
  s.summary = "TODO SUMMARY"
48
56
  s.description = "TODO DESCRIPTION"
49
57
  s.required_rubygems_version = ">= 1.3.6"
50
- s.files = ['lib/rubygems_plugin.rb']
58
+ s.files = ["lib/#{gem_name}.rb"]
59
+ # s.add_dependency 'some-gem'
60
+ # s.extra_rdoc_files = ['README.md', 'LICENSE']
61
+ # s.license = 'MIT'
51
62
  end
52
63
  GEMSPEC
53
64
  end
@@ -79,23 +90,18 @@ task :default => :test
79
90
  end
80
91
  end
81
92
 
82
- def arguments # :nodoc:
83
- "NAME name of your new rubygem"
84
- end
85
-
86
- def usage # :nodoc:
87
- "#{program_name} NAME"
93
+ # Taken from RubyGems get_one_gem_name
94
+ def get_new_gem_name
95
+ args = options[:args]
96
+ if args.nil? or args.empty?
97
+ fail Gem::CommandLineError,
98
+ "Please specify a gem name on the command line (e.g. gem init GEMNAME)"
99
+ end
100
+ if args.size > 1
101
+ fail Gem::CommandLineError,
102
+ "Too many gem names (#{args.join(', ')}); please specify only one"
103
+ end
104
+ args.first
88
105
  end
89
-
90
- # def defaults_str # :nodoc:
91
- # "--local --columns name,summary,author --fields name --no-installed"
92
- # end
93
-
94
- # def description # :nodoc:
95
- # 'Enhances search command by providing options to search (--fields) and display (--columns) ' +
96
- # 'gemspec attributes. Results are displayed in an ascii table. Gemspec attributes can be specified '+
97
- # 'by the first unique string that it starts with i.e. "su" for "summary". To specify multiple gemspec attributes, delimit ' +
98
- # "them with commas. Gemspec attributes available to options are: #{self.class.valid_gemspec_columns.join(', ')}."
99
- # end
100
-
106
+
101
107
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-init
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 0
9
- - 2
10
- version: 0.0.2
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marshall Huss
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-20 00:00:00 Z
18
+ date: 2011-05-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rest-client
@@ -31,17 +31,20 @@ dependencies:
31
31
  version: "0"
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
- description: description
34
+ description: Rubygems plugin to assist in creating a barebones gem
35
35
  email: mwhuss@gmail.com
36
36
  executables: []
37
37
 
38
38
  extensions: []
39
39
 
40
- extra_rdoc_files: []
41
-
40
+ extra_rdoc_files:
41
+ - README.md
42
+ - LICENSE
42
43
  files:
43
44
  - lib/rubygems_plugin.rb
44
45
  - lib/rubygems/commands/init_command.rb
46
+ - README.md
47
+ - LICENSE
45
48
  homepage: http://github.com/mwhuss/git-init
46
49
  licenses:
47
50
  - MIT
@@ -76,6 +79,6 @@ rubyforge_project:
76
79
  rubygems_version: 1.7.2
77
80
  signing_key:
78
81
  specification_version: 3
79
- summary: summary
82
+ summary: Rubygems plugin to assist in creating a barebones gem
80
83
  test_files: []
81
84