Neurogami-rhesus 0.2.0 → 0.2.3
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.
- data/Manifest.txt +1 -0
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/bin/rhesus +29 -2
- data/lib/rhesus/core.rb +3 -3
- data/lib/version.rb +1 -1
- metadata +2 -2
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -113,9 +113,9 @@ What you call these directories is up to you; there is no code in place to do an
|
|
113
113
|
as grouping projects and templates). But something like that may be added if managing growing numbers of templates
|
114
114
|
becomes an issue. So, the suggested format is `project_type.template_name`
|
115
115
|
|
116
|
-
Rhesus starts with some assumptions about what files might be using Erb. You can add your own file
|
116
|
+
Rhesus starts with some assumptions about what files might be using Erb. You can add your own file patterns (sort of) by placing a `haz_vars.txt` file in your `.rhesus` folder.
|
117
117
|
|
118
|
-
By default, the
|
118
|
+
By default, the file-end patterns are: `rb txt rhtml ini yml yaml Rakefile gemspec`.
|
119
119
|
|
120
120
|
When you select a template set, Rhesus scans these files for Erb variables. It then prompts
|
121
121
|
you to provide values. If you use any of these variable names in file or path names then Rhesus
|
data/Rakefile
CHANGED
data/bin/rhesus
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib rhesus]))
|
4
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib version]))
|
5
|
+
|
6
|
+
require 'fileutils'
|
4
7
|
|
5
8
|
def help(message = nil)
|
6
9
|
puts message + "\\\n-----------------------------------\\\n" unless message.nil?
|
@@ -8,6 +11,8 @@ def help(message = nil)
|
|
8
11
|
Usage:
|
9
12
|
rhesus -h/--help
|
10
13
|
rhesus -v/--version
|
14
|
+
rhesus --setup
|
15
|
+
|
11
16
|
rhesus command [options]
|
12
17
|
|
13
18
|
Commands:
|
@@ -67,6 +72,25 @@ def list_templates
|
|
67
72
|
puts Neurogami::Rhesus::Core.templates
|
68
73
|
end
|
69
74
|
|
75
|
+
def setup
|
76
|
+
# Needs to create ~/.rhesus if it does not exist,
|
77
|
+
# then copy over some default templates, such as one for
|
78
|
+
# creating gems that bundle a template
|
79
|
+
warn "Setting up Rhesus ..."
|
80
|
+
create_rhesus_dir
|
81
|
+
copy_over_default_templates
|
82
|
+
end
|
83
|
+
|
84
|
+
def create_rhesus_dir
|
85
|
+
return if Neurogami::Rhesus::Core.user_dir_exists?
|
86
|
+
FileUtils.mkdir_p Neurogami::Rhesus::Core.user_template_directory
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
def copy_over_default_templates
|
91
|
+
raise "Can not find your .rhesus directory!" unless Neurogami::Rhesus::Core.user_dir_exists?
|
92
|
+
FileUtils.cp_r File.dirname(__FILE__) + "/../default-templates/.", Neurogami::Rhesus::Core.user_template_directory
|
93
|
+
end
|
70
94
|
|
71
95
|
def generate_from_template
|
72
96
|
if ARGV.first
|
@@ -93,12 +117,15 @@ else
|
|
93
117
|
when "-h" || "--help"
|
94
118
|
help
|
95
119
|
when "-v" || "--version"
|
96
|
-
puts "Rhesus version #{Rhesus
|
120
|
+
puts "Rhesus version #{Neurogami::Rhesus::VERSION}"
|
97
121
|
when "list"
|
98
122
|
puts "Templates"
|
99
123
|
list_templates
|
100
|
-
when"gen"
|
124
|
+
when "gen"
|
101
125
|
generate_from_template
|
126
|
+
|
127
|
+
when '--setup'
|
128
|
+
setup
|
102
129
|
else
|
103
130
|
puts "Nothing known about #{ARGV[0]}"
|
104
131
|
end
|
data/lib/rhesus/core.rb
CHANGED
@@ -19,9 +19,9 @@ module Neurogami
|
|
19
19
|
module Rhesus
|
20
20
|
|
21
21
|
class Core
|
22
|
-
|
23
|
-
haz_vars = %w{ rb txt rhtml ini yml yaml }
|
24
|
-
@@re = haz_vars.map { |x| '
|
22
|
+
# Hacky :( FIXME Add a better way to define what files get slurped for parsing
|
23
|
+
haz_vars = %w{ rb txt rhtml ini yml yaml Rakefile rake gemspec}
|
24
|
+
@@re = haz_vars.map { |x| x + '$' }.join( '|')
|
25
25
|
@@re = Regexp.new "(#{@@re})$"
|
26
26
|
|
27
27
|
# http://refactormycode.com/codes/281-given-a-hash-of-variables-render-an-erb-template
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Neurogami-rhesus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Britt / Neurogami
|
@@ -55,7 +55,7 @@ files:
|
|
55
55
|
- test/.bacon
|
56
56
|
- test/test_rhesus.rb
|
57
57
|
has_rdoc: false
|
58
|
-
homepage: http://
|
58
|
+
homepage: http://www.neurogami.com/code
|
59
59
|
post_install_message:
|
60
60
|
rdoc_options:
|
61
61
|
- --main
|