gator 0.0.6.pre → 0.0.7.pre

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6.pre
1
+ 0.0.7.pre
data/gator.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gator}
8
- s.version = "0.0.6.pre"
8
+ s.version = "0.0.7.pre"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dominic Graefen"]
data/lib/gator/command.rb CHANGED
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/runner'
2
+
3
+ module Gator
4
+ class Command < Thor
5
+ def self.register_command( name, usage, description, mappings=[], options={} )
6
+ Gator::Runner.register self, name, usage,description,options
7
+ Gator::Runner.map mappings => name
8
+ end
9
+ end
10
+ end
data/lib/gator/project.rb CHANGED
@@ -1,19 +1,25 @@
1
1
  require "thor"
2
+ require "thor/actions"
2
3
  require "fileutils"
3
4
  require File.dirname(__FILE__) + '/util'
5
+ require File.dirname(__FILE__) + '/command'
4
6
 
5
7
  module Gator
6
- class Project < Thor
8
+ class Project < Command
7
9
  include Thor::Actions
8
10
 
11
+ register_command "project", "project TASK", "Set of tasks to manage project templates.", [:p]
12
+
9
13
  def self.source_root
10
14
  Gator::Util.project_template_root
11
15
  end
12
16
 
13
17
  desc "project install DIRECTORY TEMPLATE_NAME", "Install a project template."
14
- def install( dir, template )
18
+ def install( dir, template=nil )
19
+ entries = directory_entries dir
20
+ template ||= File.expand_path( File.dirname(entries.first) ).split(File::SEPARATOR).last
15
21
  empty_directory template_dir(template)
16
- FileUtils.cp_r File.expand_path( dir ), template_dir(template)
22
+ FileUtils.cp_r entries, template_dir(template)
17
23
  end
18
24
 
19
25
  desc "project uninstall TEMPLATE_NAME", "Uninstall a project template."
@@ -26,11 +32,36 @@ module Gator
26
32
  directory template_dir(template), File.expand_path( dir )
27
33
  end
28
34
 
35
+ desc "project wipe", "Delete all project templates."
36
+ def wipe
37
+ template_root_entries.each { |e| FileUtils.rm_r e }
38
+ end
39
+
40
+ desc "project list [SEARCH]", "Lists project templates."
41
+ def list(search=nil)
42
+ entries = template_root_entries
43
+ entries = entries.select { |e| e.include?(search) } unless search.nil?
44
+ entries.each {|e| say " #{e}" }
45
+ say "No templates found.", :blue if entries.empty?
46
+ end
47
+
29
48
  private
30
49
 
31
50
  def template_dir( template )
32
51
  File.join( Gator::Util.project_template_root, template )
33
52
  end
34
53
 
54
+ def directory_entries( dir, join_with_dir=true )
55
+ entries = Dir.entries(dir)
56
+ entries.delete(".")
57
+ entries.delete("..")
58
+ entries.collect! { |e| File.join(dir, e) } if join_with_dir
59
+ entries
60
+ end
61
+
62
+ def template_root_entries
63
+ directory_entries Gator::Util.project_template_root, false
64
+ end
65
+
35
66
  end
36
67
  end
data/lib/gator/runner.rb CHANGED
@@ -1,30 +1,18 @@
1
1
  require 'thor'
2
2
  require 'thor/group'
3
- require File.dirname(__FILE__) + '/project'
4
3
 
5
4
  module Gator
6
5
  class Runner < Thor
7
6
  namespace
8
7
 
9
- map "p" => :project
10
-
11
8
  def initialize(args=[], options={}, config={})
12
9
  super
13
10
  end
14
11
 
15
-
16
- # desc "project", "Project tasks"
17
- # def project
18
- #
19
- # end
20
-
21
12
  desc "version", "Show Gator version"
22
-
23
13
  def version
24
14
  say "Gator --pre"
25
15
  end
26
16
 
27
17
  end
28
- end
29
-
30
- Gator::Runner.register Gator::Project, "project", "project usage", "project description"
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.pre
4
+ version: 0.0.7.pre
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable: gator
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
17
- requirement: &2156004360 !ruby/object:Gem::Requirement
17
+ requirement: &2162001840 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.14.6
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2156004360
25
+ version_requirements: *2162001840
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &2156002300 !ruby/object:Gem::Requirement
28
+ requirement: &2162001260 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 2.3.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2156002300
36
+ version_requirements: *2162001260
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &2155999100 !ruby/object:Gem::Requirement
39
+ requirement: &2162000740 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2155999100
47
+ version_requirements: *2162000740
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: jeweler
50
- requirement: &2155996180 !ruby/object:Gem::Requirement
50
+ requirement: &2162000060 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.6.2
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2155996180
58
+ version_requirements: *2162000060
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rcov
61
- requirement: &2155994220 !ruby/object:Gem::Requirement
61
+ requirement: &2161999420 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *2155994220
69
+ version_requirements: *2161999420
70
70
  description: gator - the friendly code-generator
71
71
  email: dominic.graefen@gmail.com
72
72
  executables:
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  segments:
129
129
  - 0
130
- hash: 2347660495195831623
130
+ hash: -285001172832039557
131
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  none: false
133
133
  requirements: