retrospec 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d3d2153b5ed9d65c43e71ce71653a88908c1617
4
- data.tar.gz: 32f2c04b51cd9af890afce64a80b047a137f2e80
3
+ metadata.gz: b7d2ca1ab26a25a5e3525f03c1219baa4a48bf5b
4
+ data.tar.gz: 09e6d66b0435fdabd2e9e94e24bce88beeb335d5
5
5
  SHA512:
6
- metadata.gz: e6761648c36f88475ef7101863683bc51f59bd4ef6daf71f12e12d30ad4b2e451004f25cc8e32d9ee7a31a314638dd68de5c77f34c857571bb7435af88e1e57c
7
- data.tar.gz: d314b53bce2f2ba377faa2250277e71343f69c7c5a39c144a5b82b4326f130e4133608554f2535166eeb6477566878870051d6e2510d3ed9d8a5548dbbecd7f4
6
+ metadata.gz: 6b7e86d5b1ebc4ee7fd9dee9f989638dbe81def76510f02ea4bc78a7d7b92f3dd615b5d08419e32c8e65000adc164ef96bccbb3adfa2427beacf21f5e11fe986
7
+ data.tar.gz: 70bc46dccb59d700f1745061a86ea4f8d67772315da2fa12ea1ab1af5c6aadeb0da36719d88884f3597ce8a5e81e1d3f7ead84f3a98fcc03c0817af2a6214313
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Retrospec
2
+ [![Gem Version](https://badge.fury.io/rb/retrospec.svg)](http://badge.fury.io/rb/retrospec)
2
3
 
3
4
  Retrospec is a framework that allows the automation of repetitive project file creation with just about any kind of programming
4
5
  project through the use of a pluggable architecture.
@@ -100,9 +101,23 @@ no retrospec config options being read form the config file. By default retrosp
100
101
  Please see the following [list](https://raw.githubusercontent.com/nwops/retrospec/master/available_plugins.yaml) for available plugins.
101
102
 
102
103
 
103
- ## Plugin development
104
+ ## Plugin development and future plugin ideas
104
105
  Please see the [plugin document](plugin_development.md) for creating new retrospec plugins.
105
106
 
107
+ Some ideas I have in my head for future plugins that should be created.
108
+
109
+ * foreman plugin generator
110
+ * foreman hammer cli plugin generator
111
+ * smart-proxy plugin generator
112
+ * nodejs project generator
113
+ * chef module generator
114
+ * ansible module generator
115
+ * saltstack module generator (possibly multiple types of plugins to create here)
116
+ * groovy project generator
117
+ * puppet module generator (in progress)
118
+
119
+ The sky is really the limit for what we can create since the usage is limited to any project that contains files.
120
+
106
121
  ## Contributing to retrospec
107
122
 
108
123
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -1,5 +1,5 @@
1
1
  require_relative 'retrospec/module'
2
-
2
+ require_relative 'version'
3
3
  # monkey patch in some color effects string methods
4
4
  class String
5
5
  def red; "\033[31m#{self}\033[0m" end
@@ -1,6 +1,7 @@
1
1
  require_relative 'plugins'
2
2
  require 'trollop'
3
3
  require_relative '../retrospec'
4
+ require_relative 'config'
4
5
 
5
6
  module Retrospec
6
7
  class Cli
@@ -12,7 +13,7 @@ module Retrospec
12
13
  cmd_help = sub_commands.join("\n")
13
14
 
14
15
  global_opts = Trollop::options do
15
- version "0.1.0 (c) Corey Osman"
16
+ version "#{Retrospec::VERSION} (c) Corey Osman"
16
17
  banner <<-EOS
17
18
  A framework to automate your development workflow by generating common files and test patterns.
18
19
 
@@ -23,13 +24,15 @@ Available subcommands:
23
24
  EOS
24
25
  opt :module_path, "The path (relative or absolute) to the module directory" ,
25
26
  :type => :string, :required => false, :default => File.expand_path('.')
27
+ opt :config_map, "The global retrospec config file", :type => :string, :required => false, :default => File.expand_path(File.join(ENV['HOME'], '.retrospec', 'config.yaml' ))
26
28
  opt :available_plugins, "Show an online list of available plugins", :type => :boolean, :require => false, :short => '-a'
27
29
  stop_on sub_commands
28
30
  end
29
31
  cmd = ARGV.shift # get the subcommand
30
32
  if plugin_class = cli.plugin_map[cmd]
31
- # run the subcommand options
32
- cmd_opts = cli.plugin_map[cmd].send(:cli_options, global_opts)
33
+ # run the subcommand options but first send the config file and global options to the subcomamnd
34
+ plugin_config = Retrospec::Config.plugin_context(Retrospec::Config.config_data(global_opts[:config_map]), cmd)
35
+ cmd_opts = cli.plugin_map[cmd].send(:cli_options, global_opts.merge(plugin_config))
33
36
  opts = global_opts.merge(cmd_opts)
34
37
  Retrospec::Module.new(global_opts[:module_path], plugin_class, opts)
35
38
  else
@@ -10,7 +10,7 @@ module Retrospec
10
10
 
11
11
  # we should be able to lookup where the user stores the config map
12
12
  # so the user doesn't have to pass this info each time
13
- def initialize(file=nil, opts={})
13
+ def initialize(file=default_config_file, opts={})
14
14
  setup_config_file(file)
15
15
  end
16
16
 
@@ -19,7 +19,7 @@ module Retrospec
19
19
  if file.nil? or ! File.exists?(file)
20
20
  # config does not exist
21
21
  setup_config_dir
22
- dst_file = File.join(default_retrospec_dir, 'config.yaml.sample')
22
+ dst_file = File.join(default_retrospec_dir, 'config.yaml')
23
23
  src_file = File.join(gem_dir,'config.yaml.sample')
24
24
  safe_copy_file(src_file, dst_file)
25
25
  file = dst_file
@@ -29,7 +29,7 @@ module Retrospec
29
29
 
30
30
  # loads the config data into a ruby object
31
31
  def config_data
32
- @config_data ||= YAML.load_file(config_file)
32
+ @config_data ||= YAML.load_file(config_file) || {}
33
33
  end
34
34
 
35
35
  def self.config_data(file)
@@ -47,6 +47,10 @@ module Retrospec
47
47
 
48
48
  private
49
49
 
50
+ def default_config_file
51
+ File.join(default_retrospec_dir, 'config.yaml')
52
+ end
53
+
50
54
  def setup_config_dir
51
55
  FileUtils.mkdir_p(File.expand_path(default_retrospec_dir)) unless File.directory?(default_retrospec_dir)
52
56
  end
@@ -6,8 +6,7 @@ module Retrospec
6
6
  #
7
7
  # Returns nothing.
8
8
  def self.load_from_gems(version='v1')
9
- retorspec_plugin_paths = gem_directories.select { |path| (path + File.join('retrospec','plugins')).directory? }
10
- retorspec_plugin_paths.each do |gem_path|
9
+ gem_directories.each do |gem_path|
11
10
  Dir[File.join(gem_path,'*.rb')].each do |file|
12
11
  load file
13
12
  end
@@ -15,16 +14,19 @@ module Retrospec
15
14
  end
16
15
 
17
16
  # Internal: Retrieve a list of available gem paths from RubyGems.
17
+ # filter out the main retrospec gem, then filter out any plugin that is
18
+ # not a retrospec gem.
18
19
  #
19
20
  # Returns an Array of Pathname objects.
20
21
  def self.gem_directories
22
+ dirs = []
21
23
  if has_rubygems?
22
- gemspecs.reject { |spec| spec.name == 'retrospec' }.map do |spec|
23
- Pathname.new(spec.full_gem_path) + 'lib'
24
+ dirs = gemspecs.reject { |spec| spec.name == 'retrospec' }.map do |spec|
25
+ lib_path = File.expand_path(File.join(spec.full_gem_path,'lib'))
26
+ lib_path if File.exists? File.join(lib_path,'retrospec','plugins')
24
27
  end
25
- else
26
- []
27
28
  end
29
+ dirs.reject { |dir| dir.nil? }
28
30
  end
29
31
 
30
32
 
@@ -0,0 +1,4 @@
1
+ module Retrospec
2
+ VERSION = '0.3.0'
3
+ end
4
+
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "retrospec"
8
- s.version = "0.2.1"
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-09-26"
12
+ s.date = "2015-09-27"
13
13
  s.description = "Retrospec is a framework that allows the automation of repetitive file creation with just about any kind of language through the use of a pluggable architecture."
14
14
  s.email = "corey@logicminds.biz"
15
15
  s.executables = ["retrospec"]
@@ -40,6 +40,7 @@ Gem::Specification.new do |s|
40
40
  "lib/retrospec/plugins/v1/context_object.rb",
41
41
  "lib/retrospec/plugins/v1/module_helpers.rb",
42
42
  "lib/retrospec/plugins/v1/plugin.rb",
43
+ "lib/version.rb",
43
44
  "plugin_development.md",
44
45
  "retrospec.gemspec",
45
46
  "spec/cli_spec.rb",
@@ -1,7 +1,7 @@
1
1
  require 'simplecov'
2
2
  #require 'fakefs'
3
3
  require 'fileutils'
4
-
4
+ require 'pry'
5
5
  module SimpleCov::Configuration
6
6
  def clean_filters
7
7
  @filters = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retrospec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
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-09-26 00:00:00.000000000 Z
11
+ date: 2015-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop
@@ -154,6 +154,7 @@ files:
154
154
  - lib/retrospec/plugins/v1/context_object.rb
155
155
  - lib/retrospec/plugins/v1/module_helpers.rb
156
156
  - lib/retrospec/plugins/v1/plugin.rb
157
+ - lib/version.rb
157
158
  - plugin_development.md
158
159
  - retrospec.gemspec
159
160
  - spec/cli_spec.rb