retrospec-plugingen 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3639afab2202a3e92b0e28e1c18441a5981a6a0f
4
- data.tar.gz: 33a2a797c72907da27150f65f55818e718d2d810
3
+ metadata.gz: a7459885713f1b9030a1a04b8803c5076f7eb258
4
+ data.tar.gz: f7048d9e02f55dcb648f7c9920e83e05f57636e0
5
5
  SHA512:
6
- metadata.gz: bf036166da33a0b89345329cfd41a2ec54cd81ec6b65e0a66080fc3913a8d3d36d09aec60ae1e4daf5458d2edc2d73a518c389b4c1b5b55971eac7cdb9c95a33
7
- data.tar.gz: 443359d19ae6dc2d141d23b8fca572d8b4e0db8cc4463a3cb35489c9393c0fc5a0a719fa6c4c46f49271ffca73cf31cc8020b5763bf7aa886c53e5edc17e74d5
6
+ metadata.gz: 216191c3a11f81b71ef5656b0861dabc5bfd8c0afd1becde08d27368b0f1f142c274675a3c176bead6cddc5bab07badb0698c454654857108fb7f381d192404b
7
+ data.tar.gz: 818ad60d696ef7a4919634f0bf40d42652794011245796d4a705c1d39c3f920c777a4a34565496d0618209eac276bb558c3e6a70f834949f6889a87271503e46
data/Gemfile CHANGED
@@ -1,10 +1,5 @@
1
1
  source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
2
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
3
  group :development do
9
4
  gem "rspec", "~> 3.2"
10
5
  gem "rdoc", "~> 3.12"
@@ -13,6 +8,5 @@ group :development do
13
8
  gem "simplecov", ">= 0"
14
9
  gem "pry"
15
10
  end
16
- #gem 'retrospec', :git => 'https://github.com/nwops/retrospec.git'
17
- gem 'retrospec', :path => '/Users/cosman/github/retrospec'
18
- gem 'facets'
11
+ gem 'facets' # used for snakecase
12
+ gem 'retrospec', "~> 0.2"
data/Gemfile.lock CHANGED
@@ -1,9 +1,3 @@
1
- PATH
2
- remote: /Users/cosman/github/retrospec
3
- specs:
4
- retrospec (0.1.0)
5
- trollop
6
-
7
1
  GEM
8
2
  remote: http://rubygems.org/
9
3
  specs:
@@ -60,6 +54,8 @@ GEM
60
54
  rake (10.4.2)
61
55
  rdoc (3.12.2)
62
56
  json (~> 1.4)
57
+ retrospec (0.2.0)
58
+ trollop
63
59
  rspec (3.3.0)
64
60
  rspec-core (~> 3.3.0)
65
61
  rspec-expectations (~> 3.3.0)
@@ -91,6 +87,6 @@ DEPENDENCIES
91
87
  jeweler (~> 2.0.1)
92
88
  pry
93
89
  rdoc (~> 3.12)
94
- retrospec!
90
+ retrospec (~> 0.2)
95
91
  rspec (~> 3.2)
96
92
  simplecov
data/README.md CHANGED
@@ -4,11 +4,66 @@
4
4
  This plugin is the starting point to create plugins for retrospec. Its a widget for creating widgets!
5
5
  Use the plugin to generate the retrospec plugin layout, along with basic tests and documentation.
6
6
 
7
+ ## Install
8
+ `gem install retrospec-plugingen`
7
9
 
10
+ ## Usage
8
11
 
12
+ To create a new plugin for retrospec use the following command `retrospec -m /tmp/test4 plugingen`.
13
+ By default plugingen will use the current directory as the name of the plugin.
14
+ If you wish to override this name please pass the `-n` option. `retrospec -m /tmp/test4 plugingen -n test_plugin`
15
+
16
+ ```shell
17
+ % retrospec -m /tmp/test4 plugingen -h
18
+ %
19
+ Options:
20
+ -n, --name=<s> The name of the new plugin (default: test4)
21
+ -h, --help Show this message
22
+ MacBook-Pro~ % retrospec -m /tmp/test4 plugingen
23
+ !! /Users/cosman/.retrospec/config.yaml.sample already exists
24
+ + /tmp/test4/
25
+ + /tmp/test4/.gitignore
26
+ + /tmp/test4/.rspec
27
+ + /tmp/test4/Gemfile
28
+ + /tmp/test4/LICENSE.txt
29
+ + /tmp/test4/README.md
30
+ + /tmp/test4/Rakefile
31
+ + /tmp/test4/lib/
32
+ + /tmp/test4/lib/retrospec/
33
+ + /tmp/test4/lib/retrospec/plugins/
34
+ + /tmp/test4/lib/retrospec/plugins/v1/
35
+ + /tmp/test4/lib/retrospec/plugins/v1/plugin/
36
+ + /tmp/test4/lib/retrospec/plugins/v1/plugin/spec_object.rb
37
+ + /tmp/test4/spec/
38
+ + /tmp/test4/spec/plugin_spec.rb
39
+ + /tmp/test4/spec/spec_helper.rb
40
+ + /tmp/test4/lib/retrospec-test4.rb
41
+ + /tmp/test4/lib/retrospec/plugins/v1/plugin/test4.rb
42
+ ```
43
+
44
+ Once the plugin directory has been created you are ready to start development on your plugin. This plugin
45
+ produces a working retrospec plugin with unit tests. So just add your code and go. The templates are based off the jeweler gem
46
+ so if you currently use [jeweler](https://github.com/technicalpickles/jeweler) you should feel right at home.
47
+
48
+ At a minimum run:
49
+
50
+ ```
51
+ bundle install
52
+ bundle exec rake -T
53
+ bundle exec rake version:write
54
+ # edit the Rakefile and fill with our gem information
55
+ bundle exec rake spec
56
+ bundle exec rake gemspec (recreate the gemspec)
57
+ bundle exec rake version:bump:minor (when releasing)
58
+ bundle exec git:release
59
+ bundle exec release (send to rubygems.org)
60
+ # submit a PR to retrospec and tell me about your new plugin
61
+ https://github.com/nwops/retrospec/blob/master/available_plugins.yaml
62
+
63
+
64
+ ## Contributing to retrospec-plugingen
65
+ Got a change you want to see in this plugin? Submit a PR.
9
66
 
10
- ## Contributing to retrospec-plugin
11
-
12
67
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
13
68
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
14
69
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -1,4 +1,3 @@
1
- require 'retrospec/plugins/v1/module_helpers'
2
1
  require 'retrospec/plugins/v1'
3
2
  require_relative 'spec_object'
4
3
 
@@ -7,14 +6,11 @@ require_relative 'spec_object'
7
6
  module Retrospec
8
7
  module Plugins
9
8
  module V1
10
- class PluginGen
11
- attr_reader :template_dir, :module_path, :config_data, :context
9
+ class PluginGen < Retrospec::Plugins::V1::Plugin
10
+ attr_reader :template_dir, :context
12
11
 
13
- include Retrospec::Plugins::V1::ModuleHelpers
14
-
15
- def initialize(supplied_module_path=nil,config={})
16
- @config_data = config
17
- @module_path = File.expand_path(supplied_module_path)
12
+ def initialize(supplied_module_path='.',config={})
13
+ super
18
14
  @context = ::PluginGen::SpecObject.new(module_path, config)
19
15
  end
20
16
 
@@ -24,20 +20,27 @@ module Retrospec
24
20
  create_plugin_file
25
21
  end
26
22
 
23
+ def self.cli_options(global_opts)
24
+ Trollop::options do
25
+ opt :name, "The name of the new plugin", :require => false, :short => '-n', :type => :string, :default => File.basename(File.expand_path(global_opts[:module_path]))
26
+ end
27
+ end
28
+
27
29
  private
28
30
 
29
- def plugin_name
31
+ # this is the name of the plugin the user wants to create
32
+ def external_plugin_name
30
33
  context.plugin_name
31
34
  end
32
35
 
33
36
  def create_main_file
34
- file_path = File.join(module_path, 'lib', "retrospec-#{plugin_name}.rb" )
37
+ file_path = File.join(module_path, 'lib', "retrospec-#{external_plugin_name}.rb" )
35
38
  template = File.join(template_dir, 'retrospec-main-plugin-file.rb.erb' )
36
39
  safe_create_template_file(file_path, template, context)
37
40
  end
38
41
 
39
42
  def create_plugin_file
40
- file_path = File.join(module_path, 'lib', 'retrospec', 'plugins', 'v1', 'plugin', "#{plugin_name}.rb" )
43
+ file_path = File.join(module_path, 'lib', 'retrospec', 'plugins', 'v1', 'plugin', "#{external_plugin_name}.rb" )
41
44
  template = File.join(template_dir, 'plugin-name.rb.erb' )
42
45
  safe_create_template_file(file_path, template, context)
43
46
  end
@@ -1,8 +1,8 @@
1
1
  require 'facets'
2
-
2
+ require 'retrospec/plugins/v1/context_object'
3
3
  module PluginGen
4
4
 
5
- class SpecObject
5
+ class SpecObject < Retrospec::Plugins::V1::ContextObject
6
6
  attr_reader :instance, :module_path, :capitalized_plugin_name, :plugin_name, :snakecase_plugin_name
7
7
 
8
8
  def initialize(mod_path, data)
@@ -18,12 +18,9 @@ module PluginGen
18
18
  @capitalized_plugin_name ||= plugin_name.capitalize
19
19
  end
20
20
 
21
+ # the name of the plugin you wish to create, automatically is inherited from the basename of the module_path
21
22
  def plugin_name
22
23
  @plugin_name ||= instance[:name]
23
24
  end
24
-
25
- def get_binding
26
- binding
27
- end
28
25
  end
29
26
  end
@@ -9,6 +9,14 @@ bundle install
9
9
  bundle exec rake spec
10
10
  ```
11
11
 
12
+ ## Install
13
+
14
+ `gem install retrospec-<%= plugin_name %>`
15
+
16
+ ## Usage
17
+
18
+ `retrospec -m /tmp/test4 <%= plugin_name %> -h`
19
+
12
20
  ## Contributing to retrospec-<%= plugin_name %>
13
21
 
14
22
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
@@ -1,6 +1,10 @@
1
+ require 'retrospec/plugins/v1/context_object'
2
+
1
3
  module <%= capitalized_plugin_name %>
4
+ # this object is passed to the templates for erb template rendering
5
+ # you can use data contained in this object in your templates
6
+ class SpecObject < Retrospec::Plugins::V1::ContextObject
2
7
 
3
- class SpecObject
4
8
  attr_reader :instance, :module_path, :module_name
5
9
 
6
10
  def initialize(mod_path, data)
@@ -15,9 +19,5 @@ module <%= capitalized_plugin_name %>
15
19
  def module_name
16
20
  instance[:name]
17
21
  end
18
-
19
- def get_binding
20
- binding
21
- end
22
22
  end
23
23
  end
@@ -1,30 +1,50 @@
1
- require 'retrospec/plugins/v1/module_helpers'
2
1
  require 'retrospec/plugins/v1'
3
2
  require_relative 'spec_object'
4
3
 
5
4
  module Retrospec
6
5
  module Plugins
7
6
  module V1
8
- class <%= capitalized_plugin_name %>
9
- attr_reader :template_dir, :module_path, :config_data, :context
7
+ class <%= capitalized_plugin_name %> < Retrospec::Plugins::V1::Plugin
10
8
 
11
- include Retrospec::Plugins::V1::ModuleHelpers
9
+ attr_reader :template_dir, :context
12
10
 
11
+ # retrospec will initilalize this class so its up to you
12
+ # to set any additional variables you need to get the job done.
13
13
  def initialize(supplied_module_path=nil,config={})
14
- @config_data = config
15
- @module_path = File.expand_path(supplied_module_path)
14
+ super
15
+ # below is the Spec Object which serves as a context for template rendering
16
+ # you will need to initialize this object, so the erb templates can get the binding
17
+ # the SpecObject can be customized to your liking as its different for every plugin gem.
16
18
  @context = ::<%= capitalized_plugin_name %>::SpecObject.new(module_path, config)
17
19
  end
18
20
 
21
+ # used to display subcommand options to the cli
22
+ # the global options are passed in for your usage
23
+ # http://trollop.rubyforge.org
24
+ # all options here are available in the config passed into config object
25
+ def self.cli_options(global_opts)
26
+ Trollop::options do
27
+ opt :option1, "Some fancy option"
28
+ end
29
+ end
30
+
31
+ # this is the main entry point that retrospec will use to make magic happen
32
+ # this is called after everything has been initialized
19
33
  def run
34
+ # the safe_create_module_files will render every file under the templates/module_files
35
+ # folder in your gem and copy them to the destination.
20
36
  safe_create_module_files(template_dir, module_path, context)
37
+ # Should you need to change the file name of the copied file you will have to move
38
+ # the file outside of the module_files directory and
39
+ # render if using: safe_create_template_file(file_path, template, context)
21
40
  end
22
41
 
23
- # the template directory located inside the retrospec gem
42
+ # the template directory located inside the your retrospec plugin gem
43
+ # you should not have to modify this unless you move the templates directory
24
44
  def template_dir
25
45
  @template_dir ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
26
46
  end
27
47
  end
28
48
  end
29
49
  end
30
- end
50
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "retrospec-plugingen"
8
- s.version = "0.1.0"
8
+ s.version = "0.2.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-09-25"
12
+ s.date = "2015-09-26"
13
13
  s.description = ""
14
14
  s.email = "corey@logicminds.biz"
15
15
  s.extra_rdoc_files = [
@@ -54,8 +54,8 @@ Gem::Specification.new do |s|
54
54
  s.specification_version = 4
55
55
 
56
56
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
- s.add_runtime_dependency(%q<retrospec>, [">= 0"])
58
57
  s.add_runtime_dependency(%q<facets>, [">= 0"])
58
+ s.add_runtime_dependency(%q<retrospec>, ["~> 0.2"])
59
59
  s.add_development_dependency(%q<rspec>, ["~> 3.2"])
60
60
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
61
61
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
@@ -63,8 +63,8 @@ Gem::Specification.new do |s|
63
63
  s.add_development_dependency(%q<simplecov>, [">= 0"])
64
64
  s.add_development_dependency(%q<pry>, [">= 0"])
65
65
  else
66
- s.add_dependency(%q<retrospec>, [">= 0"])
67
66
  s.add_dependency(%q<facets>, [">= 0"])
67
+ s.add_dependency(%q<retrospec>, ["~> 0.2"])
68
68
  s.add_dependency(%q<rspec>, ["~> 3.2"])
69
69
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
70
70
  s.add_dependency(%q<bundler>, ["~> 1.0"])
@@ -73,8 +73,8 @@ Gem::Specification.new do |s|
73
73
  s.add_dependency(%q<pry>, [">= 0"])
74
74
  end
75
75
  else
76
- s.add_dependency(%q<retrospec>, [">= 0"])
77
76
  s.add_dependency(%q<facets>, [">= 0"])
77
+ s.add_dependency(%q<retrospec>, ["~> 0.2"])
78
78
  s.add_dependency(%q<rspec>, ["~> 3.2"])
79
79
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
80
80
  s.add_dependency(%q<bundler>, ["~> 1.0"])
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retrospec-plugingen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.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-09-25 00:00:00.000000000 Z
11
+ date: 2015-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: retrospec
14
+ name: facets
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - '>='
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: facets
28
+ name: retrospec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.2'
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.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement