rubygems_plugin_generator 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +7 -23
- data/Rakefile +5 -1
- data/lib/rubygems/commands/plugin_command.rb +2 -1
- data/lib/rubygems_plugin_generator/generator.rb +26 -0
- data/lib/rubygems_plugin_generator/templates/command.tt +1 -0
- data/lib/rubygems_plugin_generator/templates/gemfile.tt +0 -1
- data/lib/rubygems_plugin_generator/templates/gemspec.tt +3 -3
- data/lib/rubygems_plugin_generator/templates/gitignore.tt +1 -0
- data/lib/rubygems_plugin_generator/templates/rakefile.tt +6 -0
- data/lib/rubygems_plugin_generator/templates/test.tt +23 -0
- data/lib/rubygems_plugin_generator/version.rb +1 -1
- data/rubygems_plugin_generator.gemspec +2 -1
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eed0549c5b971715f07b7954c041afe34bb48cc5
|
4
|
+
data.tar.gz: d310f4a33e5f0ebd8a3159a4067a17b6e13ac3ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 522bfb1b37acbbdd976636a8db5ba8c714beb0886cd0a07996807e05a249936e52ecd81254bee6e1c70192b700ac647d1400f0a332f347d19058bb4968fd0386
|
7
|
+
data.tar.gz: 2d0a4c1f3a73d087bdf59e4604fb7ac7b6ee623781cb15e2236fc0194e5fd03abd2cac1f33fa9380be2e7dfbe27cf780075dc2d531184cb19f22263e3a0b3d78
|
data/README.md
CHANGED
@@ -1,38 +1,22 @@
|
|
1
|
-
#
|
1
|
+
# Rubygems plugin generator
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
This is a `RubyGems` plugin to generate `RubyGems` plugins.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'rubygems_plugin_generator'
|
7
|
+
```bash
|
8
|
+
$ gem install rubygems_plugin_generator
|
13
9
|
```
|
14
10
|
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install rubygems_plugin_generator
|
22
|
-
|
23
11
|
## Usage
|
24
12
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
13
|
+
`gem plugin <your-plugin-name>`
|
30
14
|
|
31
|
-
|
15
|
+
This command should generate all the code you need to have a working `RubyGems` plugin. Just change the file `lib/rubygems/commands/<your-command>_command.rb` and you should be good to go.
|
32
16
|
|
33
17
|
## Contributing
|
34
18
|
|
35
|
-
1. Fork it
|
19
|
+
1. Fork it
|
36
20
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
21
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
22
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/Rakefile
CHANGED
@@ -5,7 +5,8 @@ class Gem::Commands::PluginCommand < Gem::Command
|
|
5
5
|
|
6
6
|
def execute
|
7
7
|
name = options[:args].first
|
8
|
-
|
8
|
+
name = name.tr('-', '_')
|
9
|
+
klass = name.split('_').map(&:capitalize).join
|
9
10
|
|
10
11
|
generator_args = []
|
11
12
|
generator_args << name
|
@@ -30,5 +30,31 @@ module RubygemsPluginGenerator
|
|
30
30
|
def create_command_file
|
31
31
|
template('templates/command.tt', "#{name}/lib/rubygems/commands/#{name}_command.rb")
|
32
32
|
end
|
33
|
+
|
34
|
+
def create_test_file
|
35
|
+
template('templates/test.tt', "#{name}/test/#{name}_command_test.rb")
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_rakefile
|
39
|
+
template('templates/rakefile.tt', "#{name}/Rakefile")
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_gitignore_file
|
43
|
+
template('templates/gitignore.tt', "#{name}/.gitignore")
|
44
|
+
end
|
45
|
+
|
46
|
+
def init_git_repo
|
47
|
+
`cd #{name} && git init && git add .`
|
48
|
+
end
|
49
|
+
|
50
|
+
def print_final_message
|
51
|
+
say "\n"
|
52
|
+
say "*****************************************************************************************"
|
53
|
+
say "Please edit #{name}.gemspec with your plugin information."
|
54
|
+
say "The file lib/rubygems/commands/#{name}_command.rb was created for you, there you will"
|
55
|
+
say "find a method called 'execute'. That's the method that will be called when someone runs"
|
56
|
+
say "'gem #{name}'"
|
57
|
+
say "*****************************************************************************************"
|
58
|
+
end
|
33
59
|
end
|
34
60
|
end
|
@@ -10,9 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["Your name here"]
|
11
11
|
spec.email = ["Your email here"]
|
12
12
|
|
13
|
-
spec.summary = "
|
14
|
-
spec.description = "
|
15
|
-
spec.homepage = "TODO: Add a homepage"
|
13
|
+
spec.summary = "Add a summary"
|
14
|
+
spec.description = "Add a description"
|
16
15
|
spec.license = "MIT"
|
17
16
|
|
18
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -22,4 +21,5 @@ Gem::Specification.new do |spec|
|
|
22
21
|
|
23
22
|
spec.add_development_dependency "bundler", "~> 1.8"
|
24
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
25
25
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'rubygems/command_manager'
|
3
|
+
require 'rubygems/test_case'
|
4
|
+
|
5
|
+
require_relative '../lib/rubygems/commands/<%= name %>_command'
|
6
|
+
|
7
|
+
class <%= klass %>CommandTest < Gem::TestCase
|
8
|
+
def setup
|
9
|
+
super
|
10
|
+
@cmd = Gem::Commands::<%= klass %>Command.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_execute
|
14
|
+
@cmd.handle_options %w[here goes you params]
|
15
|
+
|
16
|
+
ui = Gem::MockGemUi.new
|
17
|
+
use_ui(ui) do
|
18
|
+
@cmd.execute
|
19
|
+
end
|
20
|
+
|
21
|
+
assert_equal "It works!\n", ui.output
|
22
|
+
end
|
23
|
+
end
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Generates skeleton for a rubygems plugin}
|
13
13
|
spec.description = %q{Generates skeleton for a rubygems plugin when you run 'gem plugin <plugin-name>'}
|
14
|
-
spec.homepage = "
|
14
|
+
spec.homepage = "https://github.com/brianstorti/rubygems_plugin_generator"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.8"
|
25
25
|
spec.add_development_dependency "byebug", "~> 0"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
27
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubygems_plugin_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Thomas Storti
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
69
83
|
description: Generates skeleton for a rubygems plugin when you run 'gem plugin <plugin-name>'
|
70
84
|
email:
|
71
85
|
- btstorti@gmail.com
|
@@ -87,11 +101,14 @@ files:
|
|
87
101
|
- lib/rubygems_plugin_generator/templates/command.tt
|
88
102
|
- lib/rubygems_plugin_generator/templates/gemfile.tt
|
89
103
|
- lib/rubygems_plugin_generator/templates/gemspec.tt
|
104
|
+
- lib/rubygems_plugin_generator/templates/gitignore.tt
|
105
|
+
- lib/rubygems_plugin_generator/templates/rakefile.tt
|
90
106
|
- lib/rubygems_plugin_generator/templates/rubygems_plugin.tt
|
107
|
+
- lib/rubygems_plugin_generator/templates/test.tt
|
91
108
|
- lib/rubygems_plugin_generator/templates/version.tt
|
92
109
|
- lib/rubygems_plugin_generator/version.rb
|
93
110
|
- rubygems_plugin_generator.gemspec
|
94
|
-
homepage:
|
111
|
+
homepage: https://github.com/brianstorti/rubygems_plugin_generator
|
95
112
|
licenses:
|
96
113
|
- MIT
|
97
114
|
metadata: {}
|