project_templater 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Project Templater
2
2
 
3
- __V0.3.1__
3
+ __V0.3.3__
4
4
 
5
5
  ## Installation
6
6
 
@@ -60,6 +60,9 @@ Similarly, there is a `pre_install` method which is run just before `run`. Again
60
60
 
61
61
  ## Changelog
62
62
 
63
+ __0.3.3__
64
+ - tidy up some internal code
65
+
63
66
  __0.3.2__
64
67
  - logs to the terminal when it creates a file or folder
65
68
 
@@ -8,11 +8,9 @@ base_dir = ARGV[1]
8
8
 
9
9
  if template.nil?
10
10
  puts "Available Templates"
11
- # TODO: programmatically get this list
12
- %w{html_proto jekyll_basic js_project ruby_project sinatra_basic}.each do |t|
13
- puts "-> #{t}"
11
+ ProjectTemplater.generators.each do |g|
12
+ puts "-> #{g}"
14
13
  end
15
-
16
14
  else
17
15
  pt = ProjectTemplater.new(template)
18
16
  pt.run(base_dir) if pt.valid?
@@ -9,13 +9,12 @@ class RubyProject < Generator
9
9
  "--color"
10
10
  }
11
11
  make_file(".gitignore")
12
- make_dir("lib")
12
+ make_dir("src")
13
13
  make_dir("spec")
14
- make_dir("spec/unit")
15
- make_dir("spec/integration")
16
14
  end
17
15
 
18
16
  def post_install
19
- puts `cd #{@base} && git init && bundle`
17
+ puts `cd #{@base} && git init`
18
+ puts `cd #{@base} && bundle install`
20
19
  end
21
20
  end
@@ -11,7 +11,6 @@ require "generators/generator.rb"
11
11
  class ProjectTemplater
12
12
  def initialize(template)
13
13
  @template = template
14
- # load in the right generator
15
14
  puts "That generator doesn't exist." unless generator_exists?
16
15
  end
17
16
 
@@ -19,6 +18,13 @@ class ProjectTemplater
19
18
  generator_exists?
20
19
  end
21
20
 
21
+ def self.generators
22
+ Dir["lib/generators/*.rb"]
23
+ .map { |g| g.split("/").last }
24
+ .map { |g| g.gsub(".rb", "") }
25
+ .select { |g| g != "generator" }
26
+ end
27
+
22
28
  def run(base_dir)
23
29
  base_dir = Dir.pwd + "/" + (base_dir ||= "")
24
30
  class_name = @template.camel_case
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: project_templater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-14 00:00:00.000000000 Z
12
+ date: 2013-11-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A gem for creating file and folder structures.
15
15
  email: jack@jackfranklin.net