gator 0.0.1.pre → 0.0.2.pre

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/Gemfile CHANGED
@@ -3,6 +3,8 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
+ gem "thor", "~>0.14.6"
7
+
6
8
  # Add dependencies to develop your gem here.
7
9
  # Include everything needed to run rake, tests, features, etc.
8
10
  group :development do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1.pre
1
+ 0.0.2.pre
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+ require "gator"
4
+
5
+ Gator.application.execute ARGV
@@ -0,0 +1,74 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{gator}
8
+ s.version = "0.0.2.pre"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Dominic Graefen"]
12
+ s.date = %q{2011-07-01}
13
+ s.default_executable = %q{gator}
14
+ s.description = %q{gator - the friendly code-generator}
15
+ s.email = %q{dominic.graefen@gmail.com}
16
+ s.executables = ["gator"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.rdoc"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ "Gemfile",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/gator",
29
+ "gator.gemspec",
30
+ "lib/core.rb",
31
+ "lib/core/cli.rb",
32
+ "lib/core/cli/application.rb",
33
+ "lib/core/cli/shell.rb",
34
+ "lib/core/command.rb",
35
+ "lib/core/configuration.rb",
36
+ "lib/core/configuration/configuration.rb",
37
+ "lib/core/plugin.rb",
38
+ "lib/core/project.rb",
39
+ "lib/core/project/project.rb",
40
+ "lib/gator.rb",
41
+ "test/helper.rb",
42
+ "test/test_gator.rb"
43
+ ]
44
+ s.homepage = %q{http://github.com/devboy/gator}
45
+ s.licenses = ["MIT"]
46
+ s.require_paths = ["lib"]
47
+ s.rubygems_version = %q{1.6.2}
48
+ s.summary = %q{gator - the friendly code-generator}
49
+
50
+ if s.respond_to? :specification_version then
51
+ s.specification_version = 3
52
+
53
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
+ s.add_runtime_dependency(%q<thor>, ["~> 0.14.6"])
55
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
56
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
57
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
58
+ s.add_development_dependency(%q<rcov>, [">= 0"])
59
+ else
60
+ s.add_dependency(%q<thor>, ["~> 0.14.6"])
61
+ s.add_dependency(%q<shoulda>, [">= 0"])
62
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
63
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
64
+ s.add_dependency(%q<rcov>, [">= 0"])
65
+ end
66
+ else
67
+ s.add_dependency(%q<thor>, ["~> 0.14.6"])
68
+ s.add_dependency(%q<shoulda>, [">= 0"])
69
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
70
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
71
+ s.add_dependency(%q<rcov>, [">= 0"])
72
+ end
73
+ end
74
+
@@ -0,0 +1,5 @@
1
+ require File.dirname(__FILE__) + '/core/cli'
2
+ require File.dirname(__FILE__) + '/core/command'
3
+ require File.dirname(__FILE__) + '/core/plugin'
4
+ require File.dirname(__FILE__) + '/core/configuration'
5
+ require File.dirname(__FILE__) + '/core/project'
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__) + '/cli/shell'
2
+ require File.dirname(__FILE__) + '/cli/application'
@@ -0,0 +1,61 @@
1
+ module Gator
2
+
3
+ class Application
4
+
5
+ def initialize
6
+ self
7
+ end
8
+
9
+ def execute( args )
10
+ configuration.load_configuration
11
+ end
12
+
13
+ def configuration
14
+ @configuration ||= Configuration.new
15
+ end
16
+
17
+ def project
18
+ @project
19
+ end
20
+
21
+ def project=( proj )
22
+ @project= proj
23
+ end
24
+
25
+ def shell
26
+ @shell ||= Shell.new
27
+ end
28
+
29
+ end
30
+
31
+ class << self
32
+
33
+ def application
34
+ @application
35
+ end
36
+
37
+ def application=(app)
38
+ @application = app
39
+ end
40
+
41
+ def configuration
42
+ application.configuration
43
+ end
44
+
45
+ def project
46
+ application.project
47
+ end
48
+
49
+ def project=(proj)
50
+ application.project= proj
51
+ end
52
+
53
+ def shell
54
+ application.shell
55
+ end
56
+
57
+ end
58
+
59
+ self.application= Application.new
60
+
61
+ end
@@ -0,0 +1,4 @@
1
+ module Gator
2
+ class Shell < Thor::Shell::Color
3
+ end
4
+ end
File without changes
@@ -0,0 +1 @@
1
+ require File.dirname(__FILE__) + '/configuration/configuration'
@@ -0,0 +1,77 @@
1
+ module Gator
2
+ class Configuration
3
+
4
+ def initialize
5
+ @values = {}
6
+ self
7
+ end
8
+
9
+ def load_configuration
10
+ load_global_configuration
11
+ load_project_configuration
12
+ end
13
+
14
+ def method_missing( sym, *args )
15
+ if sym.to_s.end_with? "="
16
+ @values[sym.to_s.gsub("=","")] = args.first unless args.empty?
17
+ else
18
+ @values[sym.to_s]
19
+ end
20
+ end
21
+
22
+ protected
23
+
24
+ def load_project_configuration
25
+ config_file = File.find_file_upwards("gator_config.rb") || File.join( ".gator","gator_config.rb")
26
+ ConfigurationGenerator.new.create_configuration config_file unless File.exists? config_file
27
+ load config_file
28
+ end
29
+
30
+ def load_global_configuration
31
+ config_file = File.join( File.expand_path("~"),".gator","gator_config.rb")
32
+ ConfigurationGenerator.new.create_configuration config_file, true unless File.exists? config_file
33
+ load config_file
34
+ end
35
+
36
+ end
37
+
38
+ #TODO: Refactor into gator default plugin
39
+ class ConfigurationGenerator < Thor
40
+ include Thor::Actions
41
+
42
+ no_tasks {
43
+
44
+ def create_configuration( config_file, global=false )
45
+ Gator.shell.say "#{global ? "Global " : "Project "}configuration file not found in: #{config_file}!", :red
46
+ Gator.shell.say "This is not a problem. Let's create one!", :green
47
+ create_file config_file do
48
+ render = ""
49
+ render += "#This file has been generated by gator and wants to be edited by you!\n"
50
+ if global
51
+ render += "Gator.configuration.author=\"#{Gator.shell.ask "Author:"}\"\n"
52
+ else
53
+ render += "Gator.project = Gator::Project.new \"#{Gator.shell.ask "Project name:"}\"\n"
54
+ end
55
+ render
56
+ end
57
+ end
58
+
59
+ }
60
+
61
+ end
62
+
63
+ end
64
+
65
+ class File
66
+ def self.find_file_upwards( file )
67
+ original_dir = here = Dir.pwd
68
+ while ! (File.file?(File.join(here,file)))
69
+ Dir.chdir("..")
70
+ return nil if Dir.pwd == here
71
+ here = Dir.pwd
72
+ end
73
+ File.join(here,file)
74
+ ensure
75
+ Dir.chdir(original_dir)
76
+ end
77
+ end
File without changes
@@ -0,0 +1 @@
1
+ require File.dirname(__FILE__) + '/project/project'
@@ -0,0 +1,11 @@
1
+ module Gator
2
+ class Project
3
+
4
+ attr_reader :name
5
+
6
+ def initialize( name )
7
+ @name = name
8
+ end
9
+
10
+ end
11
+ end
@@ -1,2 +1,2 @@
1
-
2
-
1
+ require "thor"
2
+ require File.dirname(__FILE__) + '/core'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gator
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 0.0.1.pre
5
+ version: 0.0.2.pre
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dominic Graefen
@@ -10,12 +10,23 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-29 00:00:00 +02:00
14
- default_executable:
13
+ date: 2011-07-01 00:00:00 +02:00
14
+ default_executable: gator
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: shoulda
17
+ name: thor
18
18
  requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 0.14.6
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: shoulda
29
+ requirement: &id002 !ruby/object:Gem::Requirement
19
30
  none: false
20
31
  requirements:
21
32
  - - ">="
@@ -23,10 +34,10 @@ dependencies:
23
34
  version: "0"
24
35
  type: :development
25
36
  prerelease: false
26
- version_requirements: *id001
37
+ version_requirements: *id002
27
38
  - !ruby/object:Gem::Dependency
28
39
  name: bundler
29
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ requirement: &id003 !ruby/object:Gem::Requirement
30
41
  none: false
31
42
  requirements:
32
43
  - - ~>
@@ -34,10 +45,10 @@ dependencies:
34
45
  version: 1.0.0
35
46
  type: :development
36
47
  prerelease: false
37
- version_requirements: *id002
48
+ version_requirements: *id003
38
49
  - !ruby/object:Gem::Dependency
39
50
  name: jeweler
40
- requirement: &id003 !ruby/object:Gem::Requirement
51
+ requirement: &id004 !ruby/object:Gem::Requirement
41
52
  none: false
42
53
  requirements:
43
54
  - - ~>
@@ -45,10 +56,10 @@ dependencies:
45
56
  version: 1.6.2
46
57
  type: :development
47
58
  prerelease: false
48
- version_requirements: *id003
59
+ version_requirements: *id004
49
60
  - !ruby/object:Gem::Dependency
50
61
  name: rcov
51
- requirement: &id004 !ruby/object:Gem::Requirement
62
+ requirement: &id005 !ruby/object:Gem::Requirement
52
63
  none: false
53
64
  requirements:
54
65
  - - ">="
@@ -56,11 +67,11 @@ dependencies:
56
67
  version: "0"
57
68
  type: :development
58
69
  prerelease: false
59
- version_requirements: *id004
70
+ version_requirements: *id005
60
71
  description: gator - the friendly code-generator
61
72
  email: dominic.graefen@gmail.com
62
- executables: []
63
-
73
+ executables:
74
+ - gator
64
75
  extensions: []
65
76
 
66
77
  extra_rdoc_files:
@@ -73,6 +84,18 @@ files:
73
84
  - README.rdoc
74
85
  - Rakefile
75
86
  - VERSION
87
+ - bin/gator
88
+ - gator.gemspec
89
+ - lib/core.rb
90
+ - lib/core/cli.rb
91
+ - lib/core/cli/application.rb
92
+ - lib/core/cli/shell.rb
93
+ - lib/core/command.rb
94
+ - lib/core/configuration.rb
95
+ - lib/core/configuration/configuration.rb
96
+ - lib/core/plugin.rb
97
+ - lib/core/project.rb
98
+ - lib/core/project/project.rb
76
99
  - lib/gator.rb
77
100
  - test/helper.rb
78
101
  - test/test_gator.rb
@@ -90,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
113
  requirements:
91
114
  - - ">="
92
115
  - !ruby/object:Gem::Version
93
- hash: 2837698617111005962
116
+ hash: 301234331673452016
94
117
  segments:
95
118
  - 0
96
119
  version: "0"