retrospec 0.4.0 → 0.5.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/.gitignore +49 -0
- data/.travis.yml +16 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +18 -42
- data/README.md +1 -0
- data/Rakefile +2 -30
- data/VERSION +1 -1
- data/lib/retrospec.rb +14 -1
- data/lib/retrospec/cli.rb +10 -2
- data/lib/retrospec/config.rb +1 -1
- data/lib/retrospec/plugins/v1/module_helpers.rb +88 -35
- data/lib/{version.rb → retrospec/version.rb} +1 -1
- data/retrospec.gemspec +42 -84
- metadata +25 -27
- data/spec/cli_spec.rb +0 -4
- data/spec/config_spec.rb +0 -21
- data/spec/plugin_loader_spec.rb +0 -5
- data/spec/plugins_spec.rb +0 -5
- data/spec/retrospec_spec.rb +0 -3
- data/spec/spec_helper.rb +0 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: de9cb03c603a30dfd2960ee0e4a7fdcf3a778927
|
|
4
|
+
data.tar.gz: 51896d567e95b02289d4f8f38f7cfadb87fccffe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27c57f7bb0898407b4c85743c98bb0081ce30b76c0ba7a91baf29adafaf074123dc5f8ebea49e74deab645bde18ce7177ef7db10bfd2b1947780dc9a203c0b84
|
|
7
|
+
data.tar.gz: ac71765db43b6f4d641924aa666dadc4d4ef0ddaa174a29d6d5a88b9d55bbdb2d787c6d294494f4f195e42e4ced264cbb9dca59a892ac82037b5ecee54d790f3
|
data/.gitignore
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# rcov generated
|
|
2
|
+
coverage
|
|
3
|
+
coverage.data
|
|
4
|
+
|
|
5
|
+
# rdoc generated
|
|
6
|
+
rdoc
|
|
7
|
+
|
|
8
|
+
# yard generated
|
|
9
|
+
doc
|
|
10
|
+
.yardoc
|
|
11
|
+
|
|
12
|
+
# bundler
|
|
13
|
+
.bundle
|
|
14
|
+
|
|
15
|
+
# jeweler generated
|
|
16
|
+
pkg
|
|
17
|
+
|
|
18
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
|
19
|
+
#
|
|
20
|
+
# * Create a file at ~/.gitignore
|
|
21
|
+
# * Include files you want ignored
|
|
22
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
|
23
|
+
#
|
|
24
|
+
# After doing this, these files will be ignored in all your git projects,
|
|
25
|
+
# saving you from having to 'pollute' every project you touch with them
|
|
26
|
+
#
|
|
27
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
|
28
|
+
#
|
|
29
|
+
# For MacOS:
|
|
30
|
+
#
|
|
31
|
+
#.DS_Store
|
|
32
|
+
|
|
33
|
+
# For TextMate
|
|
34
|
+
#*.tmproj
|
|
35
|
+
#tmtags
|
|
36
|
+
|
|
37
|
+
# For emacs:
|
|
38
|
+
#*~
|
|
39
|
+
#\#*
|
|
40
|
+
#.\#*
|
|
41
|
+
|
|
42
|
+
# For vim:
|
|
43
|
+
#*.swp
|
|
44
|
+
|
|
45
|
+
# For redcar:
|
|
46
|
+
#.redcar
|
|
47
|
+
|
|
48
|
+
# For rubinius:
|
|
49
|
+
#*.rbc
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
|
@@ -4,9 +4,10 @@ gem 'trollop'
|
|
|
4
4
|
group :development do
|
|
5
5
|
gem "rspec", "~> 3.2"
|
|
6
6
|
gem "rdoc", "~> 3.12"
|
|
7
|
+
gem 'rake'
|
|
7
8
|
gem "bundler", "~> 1.0"
|
|
8
|
-
gem "jeweler", "~> 2.0.1"
|
|
9
9
|
gem "simplecov", ">= 0"
|
|
10
10
|
gem 'pry'
|
|
11
11
|
gem "fakefs", :require => "fakefs/safe"
|
|
12
|
+
gem 'rubocop'
|
|
12
13
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,56 +1,21 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
builder (3.2.2)
|
|
4
|
+
ast (2.3.0)
|
|
6
5
|
coderay (1.1.0)
|
|
7
|
-
descendants_tracker (0.0.4)
|
|
8
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
|
9
6
|
diff-lcs (1.2.5)
|
|
10
7
|
docile (1.1.5)
|
|
11
8
|
fakefs (0.6.7)
|
|
12
|
-
faraday (0.9.1)
|
|
13
|
-
multipart-post (>= 1.2, < 3)
|
|
14
|
-
git (1.2.9.1)
|
|
15
|
-
github_api (0.12.4)
|
|
16
|
-
addressable (~> 2.3)
|
|
17
|
-
descendants_tracker (~> 0.0.4)
|
|
18
|
-
faraday (~> 0.8, < 0.10)
|
|
19
|
-
hashie (>= 3.4)
|
|
20
|
-
multi_json (>= 1.7.5, < 2.0)
|
|
21
|
-
nokogiri (~> 1.6.6)
|
|
22
|
-
oauth2
|
|
23
|
-
hashie (3.4.2)
|
|
24
|
-
highline (1.7.7)
|
|
25
|
-
jeweler (2.0.1)
|
|
26
|
-
builder
|
|
27
|
-
bundler (>= 1.0)
|
|
28
|
-
git (>= 1.2.5)
|
|
29
|
-
github_api
|
|
30
|
-
highline (>= 1.6.15)
|
|
31
|
-
nokogiri (>= 1.5.10)
|
|
32
|
-
rake
|
|
33
|
-
rdoc
|
|
34
9
|
json (1.8.3)
|
|
35
|
-
jwt (1.5.1)
|
|
36
10
|
method_source (0.8.2)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
multipart-post (2.0.0)
|
|
41
|
-
nokogiri (1.6.6.2)
|
|
42
|
-
mini_portile (~> 0.6.0)
|
|
43
|
-
oauth2 (1.0.0)
|
|
44
|
-
faraday (>= 0.8, < 0.10)
|
|
45
|
-
jwt (~> 1.0)
|
|
46
|
-
multi_json (~> 1.3)
|
|
47
|
-
multi_xml (~> 0.5)
|
|
48
|
-
rack (~> 1.2)
|
|
11
|
+
parser (2.3.3.1)
|
|
12
|
+
ast (~> 2.2)
|
|
13
|
+
powerpack (0.1.1)
|
|
49
14
|
pry (0.10.2)
|
|
50
15
|
coderay (~> 1.1.0)
|
|
51
16
|
method_source (~> 0.8.1)
|
|
52
17
|
slop (~> 3.4)
|
|
53
|
-
|
|
18
|
+
rainbow (2.2.1)
|
|
54
19
|
rake (10.4.2)
|
|
55
20
|
rdoc (3.12.2)
|
|
56
21
|
json (~> 1.4)
|
|
@@ -67,14 +32,21 @@ GEM
|
|
|
67
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
68
33
|
rspec-support (~> 3.3.0)
|
|
69
34
|
rspec-support (3.3.0)
|
|
35
|
+
rubocop (0.47.1)
|
|
36
|
+
parser (>= 2.3.3.1, < 3.0)
|
|
37
|
+
powerpack (~> 0.1)
|
|
38
|
+
rainbow (>= 1.99.1, < 3.0)
|
|
39
|
+
ruby-progressbar (~> 1.7)
|
|
40
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
41
|
+
ruby-progressbar (1.8.1)
|
|
70
42
|
simplecov (0.10.0)
|
|
71
43
|
docile (~> 1.1.0)
|
|
72
44
|
json (~> 1.8)
|
|
73
45
|
simplecov-html (~> 0.10.0)
|
|
74
46
|
simplecov-html (0.10.0)
|
|
75
47
|
slop (3.6.0)
|
|
76
|
-
thread_safe (0.3.5)
|
|
77
48
|
trollop (2.1.2)
|
|
49
|
+
unicode-display_width (1.1.3)
|
|
78
50
|
|
|
79
51
|
PLATFORMS
|
|
80
52
|
ruby
|
|
@@ -82,9 +54,13 @@ PLATFORMS
|
|
|
82
54
|
DEPENDENCIES
|
|
83
55
|
bundler (~> 1.0)
|
|
84
56
|
fakefs
|
|
85
|
-
jeweler (~> 2.0.1)
|
|
86
57
|
pry
|
|
58
|
+
rake
|
|
87
59
|
rdoc (~> 3.12)
|
|
88
60
|
rspec (~> 3.2)
|
|
61
|
+
rubocop
|
|
89
62
|
simplecov
|
|
90
63
|
trollop
|
|
64
|
+
|
|
65
|
+
BUNDLED WITH
|
|
66
|
+
1.13.6
|
data/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Retrospec
|
|
2
2
|
[](http://badge.fury.io/rb/retrospec)
|
|
3
|
+
[](https://travis-ci.org/nwops/retrospec)
|
|
3
4
|
|
|
4
5
|
Retrospec is a framework that allows the automation of repetitive project file creation with just about any kind of programming
|
|
5
6
|
project through the use of a pluggable architecture.
|
data/Rakefile
CHANGED
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
require 'rubygems'
|
|
4
|
-
require 'bundler'
|
|
5
|
-
begin
|
|
6
|
-
Bundler.setup(:default, :development)
|
|
7
|
-
rescue Bundler::BundlerError => e
|
|
8
|
-
$stderr.puts e.message
|
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
|
10
|
-
exit e.status_code
|
|
11
|
-
end
|
|
12
|
-
require 'rake'
|
|
13
|
-
|
|
14
|
-
require 'jeweler'
|
|
15
|
-
Jeweler::Tasks.new do |gem|
|
|
16
|
-
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
|
17
|
-
gem.name = "retrospec"
|
|
18
|
-
gem.homepage = "http://github.com/nwops/retrospec"
|
|
19
|
-
gem.license = "MIT"
|
|
20
|
-
gem.summary = %Q{A devops framework for automating your development workflow}
|
|
21
|
-
gem.description = %Q{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.}
|
|
22
|
-
gem.email = "corey@logicminds.biz"
|
|
23
|
-
gem.authors = ["Corey Osman"]
|
|
24
|
-
# dependencies defined in Gemfile
|
|
25
|
-
end
|
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
|
27
|
-
|
|
28
|
-
require 'rspec/core'
|
|
2
|
+
require 'bundler/gem_tasks'
|
|
29
3
|
require 'rspec/core/rake_task'
|
|
30
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
31
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
|
32
|
-
end
|
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
33
5
|
|
|
34
6
|
desc "Code coverage detail"
|
|
35
7
|
task :simplecov do
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.5.0
|
data/lib/retrospec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require_relative 'version'
|
|
1
|
+
require_relative 'retrospec/version'
|
|
2
2
|
# monkey patch in some color effects string methods
|
|
3
3
|
class String
|
|
4
4
|
def red; "\033[31m#{self}\033[0m" end
|
|
@@ -8,4 +8,17 @@ class String
|
|
|
8
8
|
def warning; yellow end
|
|
9
9
|
def fatal; red end
|
|
10
10
|
def info; green end
|
|
11
|
+
|
|
12
|
+
def camel_case
|
|
13
|
+
return self if self !~ /_/ && self =~ /[A-Z]+.*/
|
|
14
|
+
split('_').map(&:capitalize).join
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def underscore
|
|
18
|
+
self.gsub(/::/, '/').
|
|
19
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
|
20
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
|
21
|
+
tr("-", "_").
|
|
22
|
+
downcase
|
|
23
|
+
end
|
|
11
24
|
end
|
data/lib/retrospec/cli.rb
CHANGED
|
@@ -18,11 +18,15 @@ module Retrospec
|
|
|
18
18
|
banner <<-EOS
|
|
19
19
|
A framework to automate your development workflow by generating common files and test patterns.
|
|
20
20
|
|
|
21
|
-
Usage: retrospec [global options]
|
|
21
|
+
Usage: retrospec [global options] plugin [plugin options]
|
|
22
22
|
Available subcommands:
|
|
23
23
|
#{cmd_help}
|
|
24
24
|
|
|
25
25
|
EOS
|
|
26
|
+
opt :enable_overwrite, "Enable overwriting of files, will prompt for each file",
|
|
27
|
+
:type => :boolean, :default => false
|
|
28
|
+
opt :enable_overwrite_all, "Always overwrites files without prompting",
|
|
29
|
+
:type => :boolean, :default => false
|
|
26
30
|
opt :module_path, "The path (relative or absolute) to the module directory" ,
|
|
27
31
|
:type => :string, :required => false, :default => File.expand_path('.')
|
|
28
32
|
opt :config_map, "The global retrospec config file", :type => :string, :required => false, :default => File.expand_path(File.join(ENV['HOME'], '.retrospec', 'config.yaml' ))
|
|
@@ -30,8 +34,12 @@ Available subcommands:
|
|
|
30
34
|
stop_on sub_commands
|
|
31
35
|
end
|
|
32
36
|
cmd = ARGV.shift # get the subcommand
|
|
37
|
+
# these variables are used in the module helpers to determine if we should overwrite files
|
|
38
|
+
ENV['RETROSPEC_OVERWRITE_ALL'] = global_opts[:enable_overwrite_all].to_s if global_opts[:enable_overwrite_all]
|
|
39
|
+
ENV['RETROSPEC_OVERWRITE_ENABLE'] = global_opts[:enable_overwrite].to_s if global_opts[:enable_overwrite]
|
|
40
|
+
|
|
33
41
|
if plugin_class = cli.plugin_map[cmd]
|
|
34
|
-
# this is what generates the cli options for the
|
|
42
|
+
# this is what generates the cli options for the plugin
|
|
35
43
|
# this is also the main entry point that runs the plugin's cli
|
|
36
44
|
global_config = Retrospec::Config.config_data(global_opts[:config_map])
|
|
37
45
|
plugin_name = plugin_class.send(:plugin_name)
|
data/lib/retrospec/config.rb
CHANGED
|
@@ -5,6 +5,72 @@ module Retrospec
|
|
|
5
5
|
module Plugins
|
|
6
6
|
module V1
|
|
7
7
|
module ModuleHelpers
|
|
8
|
+
|
|
9
|
+
# stores the answer if the user wants to overwrite all files
|
|
10
|
+
# @return [Boolean] true if overwrite_all mode is enabled
|
|
11
|
+
def overwrite_all
|
|
12
|
+
@@overwrite_all ||= !ENV['RETROSPEC_OVERWRITE_ALL'].nil?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @return [Boolean] true if overwrite mode is enabled
|
|
16
|
+
def overwrite_enabled?
|
|
17
|
+
!ENV['RETROSPEC_OVERWRITE_ENABLE'].nil?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# notifies the user of what action will be performed
|
|
21
|
+
# + creates a file
|
|
22
|
+
# - + overwrites a file
|
|
23
|
+
def notify(dest, overwrite=false)
|
|
24
|
+
if overwrite
|
|
25
|
+
puts " - + #{dest}".info
|
|
26
|
+
else
|
|
27
|
+
puts " + #{dest}".info
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# creates the content, then notifies the user
|
|
32
|
+
def create_content(type, dest, src = nil, overwrite = false)
|
|
33
|
+
case type
|
|
34
|
+
when :file
|
|
35
|
+
File.open(dest, 'w') do |f|
|
|
36
|
+
f.puts(src)
|
|
37
|
+
end
|
|
38
|
+
when :dir
|
|
39
|
+
FileUtils.mkdir_p(dest)
|
|
40
|
+
when :link
|
|
41
|
+
FileUtils.copy_entry(src,dest,false,false,true) # always remove destination
|
|
42
|
+
when :mv
|
|
43
|
+
FileUtils.mv(src,dest)
|
|
44
|
+
when :touch
|
|
45
|
+
FileUtils.touch(dest)
|
|
46
|
+
when :cp
|
|
47
|
+
FileUtils.cp(src,dest)
|
|
48
|
+
end
|
|
49
|
+
notify(dest, overwrite)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# @returns [Boolean] true if the user wants to overwrite the dest
|
|
53
|
+
# sets @overwrite_all if the user chooses 'a' and saves for next time
|
|
54
|
+
# @param dest [String] - the destination of the file
|
|
55
|
+
def overwrite?(dest)
|
|
56
|
+
return true if overwrite_all
|
|
57
|
+
return false unless overwrite_enabled?
|
|
58
|
+
answer = prompt_for_overwrite(dest)
|
|
59
|
+
if answer == 'a'
|
|
60
|
+
print "Are you sure you wish to overwrite all generated files?(y/n): ".fatal
|
|
61
|
+
sure = gets.chomp.downcase
|
|
62
|
+
return @@overwrite_all = true if sure == 'y'
|
|
63
|
+
overwrite?(dest)
|
|
64
|
+
else
|
|
65
|
+
answer == 'y'
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def prompt_for_overwrite(dest)
|
|
70
|
+
print "Overwrite #{dest}?(y/n/a): ".cyan
|
|
71
|
+
gets.chomp.downcase
|
|
72
|
+
end
|
|
73
|
+
|
|
8
74
|
# only creates a directory if the directory doesn't already exist
|
|
9
75
|
def safe_mkdir(dir)
|
|
10
76
|
dir = File.expand_path(dir)
|
|
@@ -13,43 +79,34 @@ module Retrospec
|
|
|
13
79
|
$stderr.puts "!! #{dir} already exists and is not a directory".fatal
|
|
14
80
|
end
|
|
15
81
|
else
|
|
16
|
-
|
|
17
|
-
puts " + #{dir}/".info
|
|
82
|
+
create_content(:dir, dir)
|
|
18
83
|
end
|
|
19
84
|
end
|
|
20
85
|
|
|
86
|
+
# move the file, safely
|
|
21
87
|
def safe_move_file(src,dest)
|
|
22
|
-
if File.exists?(dest)
|
|
23
|
-
$stderr.puts "!! #{dest} already exists and differs from template".warning
|
|
24
|
-
else
|
|
25
|
-
FileUtils.mv(src,dest)
|
|
26
|
-
puts " + #{dest}".info
|
|
88
|
+
if File.exists?(dest) && !overwrite?(dest)
|
|
89
|
+
return $stderr.puts "!! #{dest} already exists and differs from template".warning
|
|
27
90
|
end
|
|
91
|
+
create_content(:mv, dest, src)
|
|
28
92
|
end
|
|
29
93
|
|
|
30
94
|
# copy the symlink and preserve the link
|
|
31
95
|
def safe_create_symlink(src,dest)
|
|
32
|
-
if File.exists? dest
|
|
33
|
-
$stderr.puts "!! #{dest} already exists and differs from template".warning
|
|
34
|
-
else
|
|
35
|
-
FileUtils.copy_entry(src,dest)
|
|
36
|
-
puts " + #{dest}".info
|
|
96
|
+
if File.exists?(dest) && !overwrite?(dest)
|
|
97
|
+
return $stderr.puts "!! #{dest} already exists and differs from template".warning
|
|
37
98
|
end
|
|
99
|
+
create_content(:link, dest, src)
|
|
38
100
|
end
|
|
39
101
|
|
|
40
|
-
# safely copy
|
|
102
|
+
# safely copy an existing file to another dest
|
|
41
103
|
def safe_copy_file(src, dest)
|
|
42
|
-
if File.exists?(dest) and
|
|
43
|
-
$stderr.puts "!! #{dest} already exists".warning
|
|
44
|
-
else
|
|
45
|
-
if not File.exists?(src)
|
|
46
|
-
safe_touch(src)
|
|
47
|
-
else
|
|
48
|
-
safe_mkdir(File.dirname(dest))
|
|
49
|
-
FileUtils.cp(src,dest)
|
|
50
|
-
end
|
|
51
|
-
puts " + #{dest}".info
|
|
104
|
+
if File.exists?(dest) and !File.zero?(dest) && !overwrite?(dest)
|
|
105
|
+
return $stderr.puts "!! #{dest} already exists".warning
|
|
52
106
|
end
|
|
107
|
+
return safe_touch(src) unless File.exists?(src)
|
|
108
|
+
safe_mkdir(File.dirname(dest))
|
|
109
|
+
create_content(:cp, dest, src)
|
|
53
110
|
end
|
|
54
111
|
|
|
55
112
|
# touch a file, this is useful for setting up trigger files
|
|
@@ -59,25 +116,21 @@ module Retrospec
|
|
|
59
116
|
$stderr.puts "!! #{file} already exists and is not a regular file".fatal
|
|
60
117
|
end
|
|
61
118
|
else
|
|
62
|
-
|
|
63
|
-
puts " + #{file}".info
|
|
119
|
+
create_content(:touch, file)
|
|
64
120
|
end
|
|
65
121
|
end
|
|
66
122
|
|
|
67
123
|
# safely creates a file and does not override the existing file
|
|
68
|
-
def safe_create_file(
|
|
69
|
-
if File.exists?
|
|
70
|
-
old_content = File.read(
|
|
124
|
+
def safe_create_file(dest, content)
|
|
125
|
+
if File.exists?(dest) && !overwrite?(dest)
|
|
126
|
+
old_content = File.read(dest)
|
|
71
127
|
# if we did a better comparison of content we could be smarter about when we create files
|
|
72
|
-
if old_content != content or not File.zero?(
|
|
73
|
-
$stderr.puts "!! #{
|
|
128
|
+
if old_content != content or not File.zero?(dest)
|
|
129
|
+
$stderr.puts "!! #{dest} already exists and differs from template".warning
|
|
74
130
|
end
|
|
75
131
|
else
|
|
76
|
-
safe_mkdir(File.dirname(
|
|
77
|
-
|
|
78
|
-
f.puts content
|
|
79
|
-
end
|
|
80
|
-
puts " + #{filepath}".info
|
|
132
|
+
safe_mkdir(File.dirname(dest)) unless File.exists? File.dirname(dest)
|
|
133
|
+
create_content(:file, dest, content)
|
|
81
134
|
end
|
|
82
135
|
end
|
|
83
136
|
|
data/retrospec.gemspec
CHANGED
|
@@ -1,91 +1,49 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'retrospec/version'
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "retrospec"
|
|
7
|
+
spec.version = Retrospec::VERSION
|
|
8
|
+
spec.authors = ['Corey Osman']
|
|
9
|
+
spec.email = ['corey@nwops.io']
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
spec.summary = "A devops framework for automating your development workflow"
|
|
12
|
+
spec.date = "2017-02-01"
|
|
13
|
+
spec.homepage = "http://github.com/nwops/retrospec"
|
|
14
|
+
spec.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."
|
|
15
|
+
spec.license = 'MIT'
|
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
18
|
+
# if spec.respond_to?(:metadata)
|
|
19
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
|
20
|
+
# else
|
|
21
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
|
22
|
+
# "public gem pushes."
|
|
23
|
+
# end
|
|
9
24
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
s.email = "corey@logicminds.biz"
|
|
15
|
-
s.executables = ["retrospec"]
|
|
16
|
-
s.extra_rdoc_files = [
|
|
17
|
-
"LICENSE.txt",
|
|
18
|
-
"README.md"
|
|
25
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
26
|
+
spec.extra_rdoc_files = [
|
|
27
|
+
"LICENSE.txt",
|
|
28
|
+
"README.md"
|
|
19
29
|
]
|
|
20
|
-
|
|
21
|
-
".document",
|
|
22
|
-
".rspec",
|
|
23
|
-
"Gemfile",
|
|
24
|
-
"Gemfile.lock",
|
|
25
|
-
"LICENSE.txt",
|
|
26
|
-
"README.md",
|
|
27
|
-
"Rakefile",
|
|
28
|
-
"VERSION",
|
|
29
|
-
"available_plugins.yaml",
|
|
30
|
-
"bin/retrospec",
|
|
31
|
-
"config.yaml.sample",
|
|
32
|
-
"lib/retrospec.rb",
|
|
33
|
-
"lib/retrospec/cli.rb",
|
|
34
|
-
"lib/retrospec/config.rb",
|
|
35
|
-
"lib/retrospec/exceptions.rb",
|
|
36
|
-
"lib/retrospec/plugin_loader.rb",
|
|
37
|
-
"lib/retrospec/plugins.rb",
|
|
38
|
-
"lib/retrospec/plugins/v1.rb",
|
|
39
|
-
"lib/retrospec/plugins/v1/context_object.rb",
|
|
40
|
-
"lib/retrospec/plugins/v1/module_helpers.rb",
|
|
41
|
-
"lib/retrospec/plugins/v1/plugin.rb",
|
|
42
|
-
"lib/version.rb",
|
|
43
|
-
"plugin_development.md",
|
|
44
|
-
"retrospec.gemspec",
|
|
45
|
-
"spec/cli_spec.rb",
|
|
46
|
-
"spec/config_spec.rb",
|
|
47
|
-
"spec/plugin_loader_spec.rb",
|
|
48
|
-
"spec/plugins_spec.rb",
|
|
49
|
-
"spec/retrospec_spec.rb",
|
|
50
|
-
"spec/spec_helper.rb"
|
|
51
|
-
]
|
|
52
|
-
s.homepage = "http://github.com/nwops/retrospec"
|
|
53
|
-
s.licenses = ["MIT"]
|
|
54
|
-
s.require_paths = ["lib"]
|
|
55
|
-
s.rubygems_version = "2.0.14"
|
|
56
|
-
s.summary = "A devops framework for automating your development workflow"
|
|
57
|
-
|
|
58
|
-
if s.respond_to? :specification_version then
|
|
59
|
-
s.specification_version = 4
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
60
31
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
s.add_development_dependency(%q<rspec>, ["~> 3.2"])
|
|
64
|
-
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
|
65
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
|
66
|
-
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
|
67
|
-
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
|
68
|
-
s.add_development_dependency(%q<pry>, [">= 0"])
|
|
69
|
-
s.add_development_dependency(%q<fakefs>, [">= 0"])
|
|
70
|
-
else
|
|
71
|
-
s.add_dependency(%q<trollop>, [">= 0"])
|
|
72
|
-
s.add_dependency(%q<rspec>, ["~> 3.2"])
|
|
73
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
|
74
|
-
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
|
75
|
-
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
|
76
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
|
77
|
-
s.add_dependency(%q<pry>, [">= 0"])
|
|
78
|
-
s.add_dependency(%q<fakefs>, [">= 0"])
|
|
79
|
-
end
|
|
80
|
-
else
|
|
81
|
-
s.add_dependency(%q<trollop>, [">= 0"])
|
|
82
|
-
s.add_dependency(%q<rspec>, ["~> 3.2"])
|
|
83
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
|
84
|
-
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
|
85
|
-
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
|
86
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
|
87
|
-
s.add_dependency(%q<pry>, [">= 0"])
|
|
88
|
-
s.add_dependency(%q<fakefs>, [">= 0"])
|
|
32
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
33
|
+
f.match(%r{^(test|spec|features)/})
|
|
89
34
|
end
|
|
35
|
+
spec.bindir = 'bin'
|
|
36
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
37
|
+
spec.require_paths = ['lib']
|
|
38
|
+
spec.add_dependency 'trollop'
|
|
39
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
|
40
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
41
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
42
|
+
spec.add_development_dependency 'pry', '>=0'
|
|
43
|
+
spec.add_development_dependency 'simplecov', '>=0'
|
|
44
|
+
spec.add_development_dependency 'fakefs', '>=0'
|
|
45
|
+
spec.add_development_dependency 'rubocop'
|
|
46
|
+
|
|
90
47
|
end
|
|
91
48
|
|
|
49
|
+
|
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.
|
|
4
|
+
version: 0.5.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:
|
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: trollop
|
|
@@ -25,61 +25,61 @@ dependencies:
|
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: bundler
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ~>
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '1.13'
|
|
34
34
|
type: :development
|
|
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: '
|
|
40
|
+
version: '1.13'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
42
|
+
name: rake
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - ~>
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '10.0'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - ~>
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '10.0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - ~>
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
61
|
+
version: '3.0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - ~>
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
68
|
+
version: '3.0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
70
|
+
name: pry
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- -
|
|
73
|
+
- - '>='
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
75
|
+
version: '0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- -
|
|
80
|
+
- - '>='
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
82
|
+
version: '0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: simplecov
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -95,7 +95,7 @@ dependencies:
|
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: fakefs
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
101
|
- - '>='
|
|
@@ -109,7 +109,7 @@ dependencies:
|
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
112
|
+
name: rubocop
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
115
|
- - '>='
|
|
@@ -124,7 +124,8 @@ dependencies:
|
|
|
124
124
|
version: '0'
|
|
125
125
|
description: Retrospec is a framework that allows the automation of repetitive file
|
|
126
126
|
creation with just about any kind of language through the use of a pluggable architecture.
|
|
127
|
-
email:
|
|
127
|
+
email:
|
|
128
|
+
- corey@nwops.io
|
|
128
129
|
executables:
|
|
129
130
|
- retrospec
|
|
130
131
|
extensions: []
|
|
@@ -133,7 +134,10 @@ extra_rdoc_files:
|
|
|
133
134
|
- README.md
|
|
134
135
|
files:
|
|
135
136
|
- .document
|
|
137
|
+
- .gitignore
|
|
136
138
|
- .rspec
|
|
139
|
+
- .travis.yml
|
|
140
|
+
- CHANGELOG.md
|
|
137
141
|
- Gemfile
|
|
138
142
|
- Gemfile.lock
|
|
139
143
|
- LICENSE.txt
|
|
@@ -153,15 +157,9 @@ files:
|
|
|
153
157
|
- lib/retrospec/plugins/v1/context_object.rb
|
|
154
158
|
- lib/retrospec/plugins/v1/module_helpers.rb
|
|
155
159
|
- lib/retrospec/plugins/v1/plugin.rb
|
|
156
|
-
- lib/version.rb
|
|
160
|
+
- lib/retrospec/version.rb
|
|
157
161
|
- plugin_development.md
|
|
158
162
|
- retrospec.gemspec
|
|
159
|
-
- spec/cli_spec.rb
|
|
160
|
-
- spec/config_spec.rb
|
|
161
|
-
- spec/plugin_loader_spec.rb
|
|
162
|
-
- spec/plugins_spec.rb
|
|
163
|
-
- spec/retrospec_spec.rb
|
|
164
|
-
- spec/spec_helper.rb
|
|
165
163
|
homepage: http://github.com/nwops/retrospec
|
|
166
164
|
licenses:
|
|
167
165
|
- MIT
|
|
@@ -182,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
182
180
|
version: '0'
|
|
183
181
|
requirements: []
|
|
184
182
|
rubyforge_project:
|
|
185
|
-
rubygems_version: 2.0.14
|
|
183
|
+
rubygems_version: 2.0.14.1
|
|
186
184
|
signing_key:
|
|
187
185
|
specification_version: 4
|
|
188
186
|
summary: A devops framework for automating your development workflow
|
data/spec/cli_spec.rb
DELETED
data/spec/config_spec.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'retrospec/config'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
describe 'config' do
|
|
6
|
-
let(:config_obj) do
|
|
7
|
-
Retrospec::Config.new
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it do
|
|
11
|
-
expect(config_obj.config_data['plugins::puppet::templates::ref']).to eq('master')
|
|
12
|
-
expect(config_obj.config_data).to be_a Hash
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it 'returns the correct context' do
|
|
16
|
-
context = Retrospec::Config.plugin_context(config_obj.config_data, 'puppet')
|
|
17
|
-
expect(context.keys.count).to eq(2)
|
|
18
|
-
expect(context['plugins::puppet::templates::ref']).to eq('master')
|
|
19
|
-
expect(context).to be_a Hash
|
|
20
|
-
end
|
|
21
|
-
end
|
data/spec/plugin_loader_spec.rb
DELETED
data/spec/plugins_spec.rb
DELETED
data/spec/retrospec_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require 'simplecov'
|
|
2
|
-
#require 'fakefs'
|
|
3
|
-
require 'fileutils'
|
|
4
|
-
require 'pry'
|
|
5
|
-
module SimpleCov::Configuration
|
|
6
|
-
def clean_filters
|
|
7
|
-
@filters = []
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
SimpleCov.configure do
|
|
12
|
-
clean_filters
|
|
13
|
-
load_adapter 'test_frameworks'
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
ENV["COVERAGE"] && SimpleCov.start do
|
|
17
|
-
add_filter "/.rvm/"
|
|
18
|
-
end
|
|
19
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
20
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
21
|
-
|
|
22
|
-
require 'rspec'
|
|
23
|
-
require 'retrospec'
|
|
24
|
-
|
|
25
|
-
# Requires supporting files with custom matchers and macros, etc,
|
|
26
|
-
# in ./support/ and its subdirectories.
|
|
27
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
28
|
-
|
|
29
|
-
RSpec.configure do |config|
|
|
30
|
-
|
|
31
|
-
end
|