retrospec-plugingen 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/New_plugin.md +0 -0
- data/VERSION +1 -1
- data/lib/retrospec-plugingen.rb +1 -1
- data/lib/retrospec/plugins/v1/plugin/plugin_gen.rb +30 -3
- data/lib/retrospec/plugins/v1/plugin/templates/module_files/Gemfile +1 -1
- data/lib/retrospec/plugins/v1/plugin/templates/module_files/lib/retrospec/plugins/v1/plugin/templates/module_files/.gitkeep +2 -0
- data/lib/retrospec/plugins/v1/plugin/templates/module_files/lib/retrospec/plugins/v1/plugin/version.rb.retrospec.erb +5 -0
- data/lib/retrospec/plugins/v1/plugin/templates/module_files/spec/unit/plugin_spec.rb.retrospec.erb +21 -1
- data/lib/retrospec/plugins/v1/plugin/templates/plugin-name.rb.retrospec.erb +44 -14
- data/lib/retrospec/plugins/v1/plugin/version.rb +5 -0
- data/retrospec-plugingen.gemspec +9 -5
- data/spec/plugin_gen_spec.rb +12 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e361d21d5e66451543bf1ba5634623193b997f36
|
4
|
+
data.tar.gz: 33fd32aa5f0d8c6f20f37ce0d730fbe90c4a5c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff877210061dad170936b8481132ce42247ff4486b9786f03fe2ff026408c564ee368af54fcf84a308419ba68f66897991acccb98246190fc835589a42c781d
|
7
|
+
data.tar.gz: aab6305d9147efc76df7c94c30be98214caf94fed1d50d515818a008511b7e7371853d1b9b8aa27f117608bab58123e0155b87c648bedc6154b0e8d63eb68203
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -54,7 +54,7 @@ GEM
|
|
54
54
|
rake (10.4.2)
|
55
55
|
rdoc (3.12.2)
|
56
56
|
json (~> 1.4)
|
57
|
-
retrospec (0.
|
57
|
+
retrospec (0.4.0)
|
58
58
|
trollop
|
59
59
|
rspec (3.3.0)
|
60
60
|
rspec-core (~> 3.3.0)
|
@@ -87,6 +87,6 @@ DEPENDENCIES
|
|
87
87
|
jeweler (~> 2.0.1)
|
88
88
|
pry
|
89
89
|
rdoc (~> 3.12)
|
90
|
-
retrospec (~> 0.
|
90
|
+
retrospec (~> 0.4)
|
91
91
|
rspec (~> 3.2)
|
92
92
|
simplecov
|
data/New_plugin.md
ADDED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/retrospec-plugingen.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'retrospec/plugins/v1/plugin/plugin_gen'
|
1
|
+
require 'retrospec/plugins/v1/plugin/plugin_gen'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'retrospec/plugins/v1'
|
2
2
|
require_relative 'spec_object'
|
3
|
-
|
3
|
+
require_relative 'version'
|
4
4
|
# this plugin will generate the necessary scaffolding in order to build your own
|
5
5
|
# retrospec plugin.
|
6
6
|
module Retrospec
|
@@ -20,9 +20,36 @@ module Retrospec
|
|
20
20
|
create_plugin_file
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.
|
24
|
-
|
23
|
+
def self.run_cli(global_opts, global_config, plugin_config, args=ARGV)
|
24
|
+
# a list of subcommands for this plugin
|
25
|
+
sub_commands = []
|
26
|
+
if sub_commands.count > 0
|
27
|
+
sub_command_help = "Subcommands:\n#{sub_commands.join("\n")}\n"
|
28
|
+
else
|
29
|
+
sub_command_help = ""
|
30
|
+
end
|
31
|
+
plugin_opts = Trollop::options do
|
32
|
+
version "#{Retrospec::PluginGen::VERSION} (c) Corey Osman"
|
33
|
+
banner <<-EOS
|
34
|
+
A generator to create plugins for retrospec\n
|
35
|
+
#{sub_command_help}
|
36
|
+
|
37
|
+
EOS
|
25
38
|
opt :name, "The name of the new plugin", :require => false, :short => '-n', :type => :string, :default => File.basename(File.expand_path(global_opts[:module_path]))
|
39
|
+
stop_on sub_commands
|
40
|
+
end
|
41
|
+
# the passed in options will always override the config file
|
42
|
+
plugin_data = plugin_opts.merge(global_config).merge(global_opts).merge(plugin_config).merge(plugin_opts)
|
43
|
+
# define the default action to use the plugin here, the default is run
|
44
|
+
sub_command = (args.shift || :run).to_sym
|
45
|
+
# create an instance of this plugin
|
46
|
+
plugin = self.new(plugin_data[:module_path],plugin_data)
|
47
|
+
# check if the plugin supports the sub command
|
48
|
+
if plugin.respond_to?(sub_command)
|
49
|
+
plugin.send(sub_command)
|
50
|
+
else
|
51
|
+
puts "The subcommand #{sub_command} is not supported or valid"
|
52
|
+
exit 1
|
26
53
|
end
|
27
54
|
end
|
28
55
|
|
data/lib/retrospec/plugins/v1/plugin/templates/module_files/spec/unit/plugin_spec.rb.retrospec.erb
CHANGED
@@ -2,10 +2,16 @@ require 'spec_helper'
|
|
2
2
|
require 'retrospec'
|
3
3
|
|
4
4
|
describe "<%= plugin_name %>" do
|
5
|
+
|
6
|
+
let(:global_opts) do
|
7
|
+
{:module_path => '/tmp/testplugin_dir'}
|
8
|
+
end
|
9
|
+
|
5
10
|
let(:plugin) do
|
6
11
|
Retrospec::Plugins::V1::<%= capitalized_plugin_name %>.new('/tmp/testplugin_dir', {:name => 'testplugin', :config1 => 'test'})
|
7
12
|
end
|
8
13
|
|
14
|
+
|
9
15
|
it "can create plugin instance" do
|
10
16
|
expect(plugin).to be_a Retrospec::Plugins::V1::<%= capitalized_plugin_name %>
|
11
17
|
end
|
@@ -14,7 +20,7 @@ describe "<%= plugin_name %>" do
|
|
14
20
|
expect(plugin.config_data[:config1]).to eq('test')
|
15
21
|
end
|
16
22
|
|
17
|
-
it 'can module_path from context' do
|
23
|
+
it 'can get module_path from context' do
|
18
24
|
expect(plugin.context.module_path).to eq('/tmp/testplugin_dir')
|
19
25
|
end
|
20
26
|
|
@@ -25,4 +31,18 @@ describe "<%= plugin_name %>" do
|
|
25
31
|
it 'can run without error' do
|
26
32
|
expect{plugin.run}.to_not raise_error
|
27
33
|
end
|
34
|
+
|
35
|
+
it 'can run cli' do
|
36
|
+
expect(Retrospec::Plugins::V1::<%= capitalized_plugin_name %>.run_cli(global_opts, {},{}, []).count).to eq(2)
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'subcommands' do
|
40
|
+
# if your plugin has subcommands you can test them here by putting the subcommands in the array below
|
41
|
+
subcommands = []
|
42
|
+
subcommands.each do |cmd|
|
43
|
+
it "can run cli with subcommand #{cmd}" do
|
44
|
+
expect(Retrospec::Plugins::V1::Newplugin3.run_cli(global_opts, {},{}, [cmd]).count).to eq(2)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
28
48
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'retrospec/plugins/v1'
|
2
2
|
require_relative 'spec_object'
|
3
|
+
require_relative 'version'
|
3
4
|
|
4
5
|
module Retrospec
|
5
6
|
module Plugins
|
@@ -22,29 +23,58 @@ module Retrospec
|
|
22
23
|
# the global options are passed in for your usage
|
23
24
|
# http://trollop.rubyforge.org
|
24
25
|
# all options here are available in the config passed into config object
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
def self.run_cli(global_opts, global_config, plugin_config, args=ARGV)
|
27
|
+
# a list of subcommands for this plugin, if any
|
28
|
+
sub_commands = []
|
29
|
+
if sub_commands.count > 0
|
30
|
+
sub_command_help = "Subcommands:\n#{sub_commands.join("\n")}\n"
|
31
|
+
else
|
32
|
+
sub_command_help = ""
|
29
33
|
end
|
34
|
+
plugin_opts = Trollop::options do
|
35
|
+
version "#{Retrospec::<%= capitalized_plugin_name %>::VERSION} (c) Your Name"
|
36
|
+
banner <<-EOS
|
37
|
+
A short description of your plugin goes here\n
|
38
|
+
#{sub_command_help}
|
30
39
|
|
31
|
-
|
32
|
-
|
33
|
-
|
40
|
+
EOS
|
41
|
+
opt :option1, "Some Fancy option", :require => false, :short => '-n', :type => :string,
|
42
|
+
:default => File.basename(File.expand_path(global_opts[:module_path]))
|
43
|
+
stop_on sub_commands
|
44
|
+
end
|
45
|
+
# the passed in options will always override the config file
|
46
|
+
plugin_data = plugin_opts.merge(global_config).merge(global_opts).merge(plugin_config).merge(plugin_opts)
|
47
|
+
# define the default action to use the plugin here, the default is run
|
48
|
+
sub_command = (args.shift || :run).to_sym
|
49
|
+
# create an instance of this plugin
|
50
|
+
plugin = self.new(plugin_data[:module_path],plugin_data)
|
51
|
+
# check if the plugin supports the sub command
|
52
|
+
if plugin.respond_to?(sub_command)
|
53
|
+
plugin.send(sub_command)
|
54
|
+
else
|
55
|
+
puts "The subcommand #{sub_command} is not supported or valid"
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
# this is the main entry point that retrospec will use to make magic happen
|
62
|
+
# this is called after everything has been initialized
|
63
|
+
def run
|
34
64
|
# the safe_create_module_files will render every file that ends with .retrospec.erb
|
35
65
|
# under the templates/module_files folder in your gem and copy them to the destination.
|
36
66
|
safe_create_module_files(template_dir, module_path, context)
|
37
67
|
# Should you need to change the file name of the copied file you will have to move
|
38
68
|
# the file outside of the module_files directory and
|
39
69
|
# render it using: safe_create_template_file(file_path, template, context)
|
40
|
-
|
70
|
+
end
|
41
71
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
72
|
+
# the template directory located inside the your retrospec plugin gem
|
73
|
+
# you should not have to modify this unless you move the templates directory
|
74
|
+
# if this directory does not exist please create a directory templates/module_files
|
75
|
+
def template_dir
|
76
|
+
@template_dir ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
77
|
+
end
|
48
78
|
end
|
49
79
|
end
|
50
80
|
end
|
data/retrospec-plugingen.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "retrospec-plugingen"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Corey Osman"]
|
12
|
-
s.date = "2015-
|
12
|
+
s.date = "2015-10-11"
|
13
13
|
s.description = ""
|
14
14
|
s.email = "corey@logicminds.biz"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
"Gemfile",
|
23
23
|
"Gemfile.lock",
|
24
24
|
"LICENSE.txt",
|
25
|
+
"New_plugin.md",
|
25
26
|
"README.md",
|
26
27
|
"Rakefile",
|
27
28
|
"VERSION",
|
@@ -35,10 +36,13 @@ Gem::Specification.new do |s|
|
|
35
36
|
"lib/retrospec/plugins/v1/plugin/templates/module_files/README.md.retrospec.erb",
|
36
37
|
"lib/retrospec/plugins/v1/plugin/templates/module_files/Rakefile.retrospec.erb",
|
37
38
|
"lib/retrospec/plugins/v1/plugin/templates/module_files/lib/retrospec/plugins/v1/plugin/spec_object.rb.retrospec.erb",
|
39
|
+
"lib/retrospec/plugins/v1/plugin/templates/module_files/lib/retrospec/plugins/v1/plugin/templates/module_files/.gitkeep",
|
40
|
+
"lib/retrospec/plugins/v1/plugin/templates/module_files/lib/retrospec/plugins/v1/plugin/version.rb.retrospec.erb",
|
38
41
|
"lib/retrospec/plugins/v1/plugin/templates/module_files/spec/spec_helper.rb.retrospec.erb",
|
39
42
|
"lib/retrospec/plugins/v1/plugin/templates/module_files/spec/unit/plugin_spec.rb.retrospec.erb",
|
40
43
|
"lib/retrospec/plugins/v1/plugin/templates/plugin-name.rb.retrospec.erb",
|
41
44
|
"lib/retrospec/plugins/v1/plugin/templates/retrospec-main-plugin-file.rb.retrospec.erb",
|
45
|
+
"lib/retrospec/plugins/v1/plugin/version.rb",
|
42
46
|
"retrospec-plugingen.gemspec",
|
43
47
|
"spec/plugin_gen_spec.rb",
|
44
48
|
"spec/retrospec-plugin_spec.rb",
|
@@ -55,7 +59,7 @@ Gem::Specification.new do |s|
|
|
55
59
|
|
56
60
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
57
61
|
s.add_runtime_dependency(%q<facets>, [">= 0"])
|
58
|
-
s.add_runtime_dependency(%q<retrospec>, ["~> 0.
|
62
|
+
s.add_runtime_dependency(%q<retrospec>, ["~> 0.4"])
|
59
63
|
s.add_development_dependency(%q<rspec>, ["~> 3.2"])
|
60
64
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
61
65
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
@@ -64,7 +68,7 @@ Gem::Specification.new do |s|
|
|
64
68
|
s.add_development_dependency(%q<pry>, [">= 0"])
|
65
69
|
else
|
66
70
|
s.add_dependency(%q<facets>, [">= 0"])
|
67
|
-
s.add_dependency(%q<retrospec>, ["~> 0.
|
71
|
+
s.add_dependency(%q<retrospec>, ["~> 0.4"])
|
68
72
|
s.add_dependency(%q<rspec>, ["~> 3.2"])
|
69
73
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
70
74
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
@@ -74,7 +78,7 @@ Gem::Specification.new do |s|
|
|
74
78
|
end
|
75
79
|
else
|
76
80
|
s.add_dependency(%q<facets>, [">= 0"])
|
77
|
-
s.add_dependency(%q<retrospec>, ["~> 0.
|
81
|
+
s.add_dependency(%q<retrospec>, ["~> 0.4"])
|
78
82
|
s.add_dependency(%q<rspec>, ["~> 3.2"])
|
79
83
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
80
84
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
data/spec/plugin_gen_spec.rb
CHANGED
@@ -2,6 +2,14 @@ require 'spec_helper'
|
|
2
2
|
require 'retrospec'
|
3
3
|
|
4
4
|
describe "RetrospecPlugin" do
|
5
|
+
let(:global_opts) do
|
6
|
+
{:module_path => '/tmp/testplugin_dir'}
|
7
|
+
end
|
8
|
+
|
9
|
+
before :each do
|
10
|
+
FileUtils.rm_rf('/tmp/testplugin_dir')
|
11
|
+
end
|
12
|
+
|
5
13
|
let(:gen) do
|
6
14
|
Retrospec::Plugins::V1::PluginGen.new('/tmp/testplugin_dir', {:name => 'testplugin', :config1 => 'test'})
|
7
15
|
end
|
@@ -29,4 +37,8 @@ describe "RetrospecPlugin" do
|
|
29
37
|
it 'can run without error' do
|
30
38
|
expect{gen.run}.to_not raise_error
|
31
39
|
end
|
40
|
+
|
41
|
+
it 'can run cli' do
|
42
|
+
expect(Retrospec::Plugins::V1::PluginGen.run_cli(global_opts, {},{}, [])).to eq(nil)
|
43
|
+
end
|
32
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: retrospec-plugingen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Osman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- Gemfile
|
136
136
|
- Gemfile.lock
|
137
137
|
- LICENSE.txt
|
138
|
+
- New_plugin.md
|
138
139
|
- README.md
|
139
140
|
- Rakefile
|
140
141
|
- VERSION
|
@@ -148,10 +149,13 @@ files:
|
|
148
149
|
- lib/retrospec/plugins/v1/plugin/templates/module_files/README.md.retrospec.erb
|
149
150
|
- lib/retrospec/plugins/v1/plugin/templates/module_files/Rakefile.retrospec.erb
|
150
151
|
- lib/retrospec/plugins/v1/plugin/templates/module_files/lib/retrospec/plugins/v1/plugin/spec_object.rb.retrospec.erb
|
152
|
+
- lib/retrospec/plugins/v1/plugin/templates/module_files/lib/retrospec/plugins/v1/plugin/templates/module_files/.gitkeep
|
153
|
+
- lib/retrospec/plugins/v1/plugin/templates/module_files/lib/retrospec/plugins/v1/plugin/version.rb.retrospec.erb
|
151
154
|
- lib/retrospec/plugins/v1/plugin/templates/module_files/spec/spec_helper.rb.retrospec.erb
|
152
155
|
- lib/retrospec/plugins/v1/plugin/templates/module_files/spec/unit/plugin_spec.rb.retrospec.erb
|
153
156
|
- lib/retrospec/plugins/v1/plugin/templates/plugin-name.rb.retrospec.erb
|
154
157
|
- lib/retrospec/plugins/v1/plugin/templates/retrospec-main-plugin-file.rb.retrospec.erb
|
158
|
+
- lib/retrospec/plugins/v1/plugin/version.rb
|
155
159
|
- retrospec-plugingen.gemspec
|
156
160
|
- spec/plugin_gen_spec.rb
|
157
161
|
- spec/retrospec-plugin_spec.rb
|