gator 0.0.8.pre → 0.0.9.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/VERSION +1 -1
- data/gator.gemspec +4 -21
- data/lib/gator.rb +3 -1
- data/lib/gator/commands/project_command.rb +13 -4
- data/lib/gator/config.rb +23 -0
- data/lib/{__legacy/core → gator}/project/layout.rb +0 -0
- data/lib/gator/project/project.rb +39 -0
- data/lib/gator/runner.rb +8 -0
- data/lib/gator/util.rb +76 -0
- metadata +15 -32
- data/lib/__legacy/core.rb +0 -4
- data/lib/__legacy/core/cli.rb +0 -2
- data/lib/__legacy/core/cli/application.rb +0 -46
- data/lib/__legacy/core/cli/shell.rb +0 -4
- data/lib/__legacy/core/command.rb +0 -1
- data/lib/__legacy/core/command/command.rb +0 -50
- data/lib/__legacy/core/configuration.rb +0 -1
- data/lib/__legacy/core/configuration/configuration.rb +0 -60
- data/lib/__legacy/core/project.rb +0 -2
- data/lib/__legacy/core/project/project.rb +0 -101
- data/lib/__legacy/default.rb +0 -3
- data/lib/__legacy/default/commands/generator_command.rb +0 -74
- data/lib/__legacy/default/commands/new_command.rb +0 -31
- data/lib/__legacy/default/commands/new_template/.gator/project.rb.tt +0 -1
- data/lib/__legacy/default/generators/AS3ClassTemplate.as.tt +0 -9
- data/lib/__legacy/default/generators/as3_class_generator.rb +0 -27
- data/lib/__legacy/gator.rb +0 -11
- data/spec/core/command/command_spec.rb +0 -65
- data/spec/core/project/project_spec.rb +0 -49
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.0. | 
| 1 | 
            +
            0.0.9.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. | 
| 8 | 
            +
              s.version = "0.0.9.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"]
         | 
| @@ -28,31 +28,14 @@ Gem::Specification.new do |s| | |
| 28 28 | 
             
                "VERSION",
         | 
| 29 29 | 
             
                "bin/gator",
         | 
| 30 30 | 
             
                "gator.gemspec",
         | 
| 31 | 
            -
                "lib/__legacy/core.rb",
         | 
| 32 | 
            -
                "lib/__legacy/core/cli.rb",
         | 
| 33 | 
            -
                "lib/__legacy/core/cli/application.rb",
         | 
| 34 | 
            -
                "lib/__legacy/core/cli/shell.rb",
         | 
| 35 | 
            -
                "lib/__legacy/core/command.rb",
         | 
| 36 | 
            -
                "lib/__legacy/core/command/command.rb",
         | 
| 37 | 
            -
                "lib/__legacy/core/configuration.rb",
         | 
| 38 | 
            -
                "lib/__legacy/core/configuration/configuration.rb",
         | 
| 39 | 
            -
                "lib/__legacy/core/project.rb",
         | 
| 40 | 
            -
                "lib/__legacy/core/project/layout.rb",
         | 
| 41 | 
            -
                "lib/__legacy/core/project/project.rb",
         | 
| 42 | 
            -
                "lib/__legacy/default.rb",
         | 
| 43 | 
            -
                "lib/__legacy/default/commands/generator_command.rb",
         | 
| 44 | 
            -
                "lib/__legacy/default/commands/new_command.rb",
         | 
| 45 | 
            -
                "lib/__legacy/default/commands/new_template/.gator/project.rb.tt",
         | 
| 46 | 
            -
                "lib/__legacy/default/generators/AS3ClassTemplate.as.tt",
         | 
| 47 | 
            -
                "lib/__legacy/default/generators/as3_class_generator.rb",
         | 
| 48 | 
            -
                "lib/__legacy/gator.rb",
         | 
| 49 31 | 
             
                "lib/gator.rb",
         | 
| 50 32 | 
             
                "lib/gator/commands/command.rb",
         | 
| 51 33 | 
             
                "lib/gator/commands/project_command.rb",
         | 
| 34 | 
            +
                "lib/gator/config.rb",
         | 
| 35 | 
            +
                "lib/gator/project/layout.rb",
         | 
| 36 | 
            +
                "lib/gator/project/project.rb",
         | 
| 52 37 | 
             
                "lib/gator/runner.rb",
         | 
| 53 38 | 
             
                "lib/gator/util.rb",
         | 
| 54 | 
            -
                "spec/core/command/command_spec.rb",
         | 
| 55 | 
            -
                "spec/core/project/project_spec.rb",
         | 
| 56 39 | 
             
                "spec/spec_helper.rb"
         | 
| 57 40 | 
             
              ]
         | 
| 58 41 | 
             
              s.homepage = %q{http://github.com/devboy/gator}
         | 
    
        data/lib/gator.rb
    CHANGED
    
    | @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            require File.dirname(__FILE__) + '/gator/config'
         | 
| 2 | 
            +
            require File.dirname(__FILE__) + '/gator/util'
         | 
| 1 3 | 
             
            require File.dirname(__FILE__) + '/gator/runner'
         | 
| 2 4 | 
             
            require File.dirname(__FILE__) + '/gator/commands/command'
         | 
| 3 | 
            -
            require File.dirname(__FILE__) + '/gator/commands/project_command'
         | 
| 5 | 
            +
            require File.dirname(__FILE__) + '/gator/commands/project_command'
         | 
| @@ -14,7 +14,7 @@ module Gator | |
| 14 14 | 
             
                  Gator::Util.project_template_root
         | 
| 15 15 | 
             
                end
         | 
| 16 16 |  | 
| 17 | 
            -
                desc "project install  | 
| 17 | 
            +
                desc "project install NAME TEMPLATE_NAME", "Install a project template."
         | 
| 18 18 | 
             
                def install( dir, template=nil )
         | 
| 19 19 | 
             
                  entries = directory_entries dir
         | 
| 20 20 | 
             
                  template ||= File.expand_path( File.dirname(entries.first) ).split(File::SEPARATOR).last
         | 
| @@ -28,9 +28,10 @@ module Gator | |
| 28 28 | 
             
                  FileUtils.rm_r template_dir(template)
         | 
| 29 29 | 
             
                end
         | 
| 30 30 |  | 
| 31 | 
            -
                desc "project new  | 
| 32 | 
            -
                def new(  | 
| 33 | 
            -
                   | 
| 31 | 
            +
                desc "project new NAME TEMPLATE_NAME", "Create a new project by template."
         | 
| 32 | 
            +
                def new( name, template )
         | 
| 33 | 
            +
                  @project_name = name
         | 
| 34 | 
            +
                  directory template_dir(template), File.expand_path( name )
         | 
| 34 35 | 
             
                end
         | 
| 35 36 |  | 
| 36 37 | 
             
                desc "project wipe", "Delete all project templates."
         | 
| @@ -46,6 +47,14 @@ module Gator | |
| 46 47 | 
             
                  say "No templates found.", :blue if entries.empty?
         | 
| 47 48 | 
             
                end
         | 
| 48 49 |  | 
| 50 | 
            +
                no_tasks {
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                  def project_name
         | 
| 53 | 
            +
                    @project_name
         | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                }
         | 
| 57 | 
            +
             | 
| 49 58 | 
             
                private
         | 
| 50 59 |  | 
| 51 60 | 
             
                def create_empty_directory_files( dir )
         | 
    
        data/lib/gator/config.rb
    ADDED
    
    | @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            module Gator
         | 
| 2 | 
            +
              module Configuration
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                def self.config
         | 
| 5 | 
            +
                  @configuration ||= GatorConfiguration.new
         | 
| 6 | 
            +
                end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                def config
         | 
| 9 | 
            +
                  Configuration.config
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
                alias_method :configuration, :config
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
              class GatorConfiguration
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                attr_accessor :user
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                def options
         | 
| 19 | 
            +
                  @options ||= {}
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| 
            File without changes
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            require File.dirname(__FILE__) + '/../util'
         | 
| 2 | 
            +
            require File.dirname(__FILE__) + '/layout'
         | 
| 3 | 
            +
            module Gator
         | 
| 4 | 
            +
              module Project
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                def self.project
         | 
| 7 | 
            +
                  @project
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                def self.project=(project)
         | 
| 11 | 
            +
                  @project = project
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                def project( project= nil )
         | 
| 15 | 
            +
                  Project.project = project unless project.nil?
         | 
| 16 | 
            +
                  Project.project
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                class ProjectBase
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  attr_accessor :name, :layout
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  def initialize
         | 
| 24 | 
            +
                    @name = ""
         | 
| 25 | 
            +
                    @layout = Layout.default
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  def path(*args)
         | 
| 29 | 
            +
                    File.join(Gator::Util.find_gator_project, layout.expand(*args))
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  def options
         | 
| 33 | 
            +
                    @options ||= {}
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            end
         | 
    
        data/lib/gator/runner.rb
    CHANGED
    
    | @@ -1,8 +1,16 @@ | |
| 1 1 | 
             
            require 'thor'
         | 
| 2 2 | 
             
            require 'thor/group'
         | 
| 3 | 
            +
            require 'thor/actions'
         | 
| 4 | 
            +
            require File.dirname(__FILE__) + '/util'
         | 
| 3 5 |  | 
| 4 6 | 
             
            module Gator
         | 
| 5 7 | 
             
              class Runner < Thor
         | 
| 8 | 
            +
                include Thor::Actions
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                def self.start
         | 
| 11 | 
            +
                  Gator::Util.initialize_files
         | 
| 12 | 
            +
                  super
         | 
| 13 | 
            +
                end
         | 
| 6 14 |  | 
| 7 15 | 
             
                desc "version", "Show Gator version"
         | 
| 8 16 | 
             
                def version
         | 
    
        data/lib/gator/util.rb
    CHANGED
    
    | @@ -1,6 +1,27 @@ | |
| 1 | 
            +
            require "thor"
         | 
| 1 2 | 
             
            require "thor/util"
         | 
| 3 | 
            +
            require "thor/actions"
         | 
| 4 | 
            +
            require "pathname"
         | 
| 5 | 
            +
            require File.dirname(__FILE__) + '/config'
         | 
| 6 | 
            +
            require File.dirname(__FILE__) + '/project/project'
         | 
| 2 7 | 
             
            module Gator
         | 
| 8 | 
            +
              module Sandbox
         | 
| 9 | 
            +
                extend Gator::Configuration
         | 
| 10 | 
            +
                extend Gator::Project
         | 
| 11 | 
            +
              end
         | 
| 3 12 | 
             
              class Util
         | 
| 13 | 
            +
                def self.gator_files
         | 
| 14 | 
            +
                  [ "gator", "gator.rb" ]
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def self.gator_files_for(dir)
         | 
| 18 | 
            +
                  gator_files.collect { |f| File.join(dir, f) }
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                def self.gator_config
         | 
| 22 | 
            +
                  File.join(gator_root, "configuration.rb")
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 4 25 | 
             
                def self.gator_root
         | 
| 5 26 | 
             
                  File.join(Thor::Util.user_home, ".gator").gsub(/\\/, '/')
         | 
| 6 27 | 
             
                end
         | 
| @@ -8,5 +29,60 @@ module Gator | |
| 8 29 | 
             
                def self.project_template_root
         | 
| 9 30 | 
             
                  File.join(gator_root, "templates", "projects")
         | 
| 10 31 | 
             
                end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                def self.load_rubyfile(path, content=nil, debug=false)
         | 
| 34 | 
            +
                  content ||= File.binread(path)
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  begin
         | 
| 37 | 
            +
                    Gator::Sandbox.module_eval(content, path)
         | 
| 38 | 
            +
                  rescue Exception => e
         | 
| 39 | 
            +
                    $stderr.puts "WARNING: unable to load file #{path.inspect}: #{e.message}"
         | 
| 40 | 
            +
                    if debug
         | 
| 41 | 
            +
                      $stderr.puts *e.backtrace
         | 
| 42 | 
            +
                    else
         | 
| 43 | 
            +
                      $stderr.puts e.backtrace.first
         | 
| 44 | 
            +
                    end
         | 
| 45 | 
            +
                  end
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                def self.find_gator_project_file(path= Dir.getwd)
         | 
| 49 | 
            +
                  gatorfile = nil
         | 
| 50 | 
            +
                  Pathname.new(path).ascend do |dir|
         | 
| 51 | 
            +
                    gatorfile = gator_files_for(dir).map { |g| Dir[g] }.flatten.first
         | 
| 52 | 
            +
                    break unless gatorfile.nil?
         | 
| 53 | 
            +
                  end
         | 
| 54 | 
            +
                  gatorfile
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                def self.find_gator_project(path= Dir.getwd)
         | 
| 58 | 
            +
                  file = find_gator_project_file path
         | 
| 59 | 
            +
                  File.dirname file unless file.nil?
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                def self.initialize_files
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                  if File.exists? gator_config
         | 
| 65 | 
            +
                    load_rubyfile gator_config
         | 
| 66 | 
            +
                  else
         | 
| 67 | 
            +
                    FileCreator.new.config_file
         | 
| 68 | 
            +
                  end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                  p_file = find_gator_project_file
         | 
| 71 | 
            +
                  load_rubyfile p_file unless p_file.nil?
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                class FileCreator < Thor
         | 
| 76 | 
            +
                  include Thor::Actions
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                  desc "no cli usage", "create config file"
         | 
| 79 | 
            +
                  def config_file
         | 
| 80 | 
            +
                    file = Gator::Util.gator_config
         | 
| 81 | 
            +
                    user = ask "Username:"
         | 
| 82 | 
            +
                    create_file file, "config.user='#{user}'"
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                end
         | 
| 86 | 
            +
             | 
| 11 87 | 
             
              end
         | 
| 12 88 | 
             
            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. | 
| 4 | 
            +
              version: 0.0.9.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: & | 
| 17 | 
            +
              requirement: &2156481240 !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: * | 
| 25 | 
            +
              version_requirements: *2156481240
         | 
| 26 26 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 27 27 | 
             
              name: rspec
         | 
| 28 | 
            -
              requirement: & | 
| 28 | 
            +
              requirement: &2156480640 !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: * | 
| 36 | 
            +
              version_requirements: *2156480640
         | 
| 37 37 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 38 38 | 
             
              name: bundler
         | 
| 39 | 
            -
              requirement: & | 
| 39 | 
            +
              requirement: &2156480040 !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: * | 
| 47 | 
            +
              version_requirements: *2156480040
         | 
| 48 48 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 49 49 | 
             
              name: jeweler
         | 
| 50 | 
            -
              requirement: & | 
| 50 | 
            +
              requirement: &2156479460 !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: * | 
| 58 | 
            +
              version_requirements: *2156479460
         | 
| 59 59 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 60 60 | 
             
              name: rcov
         | 
| 61 | 
            -
              requirement: & | 
| 61 | 
            +
              requirement: &2156478860 !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: * | 
| 69 | 
            +
              version_requirements: *2156478860
         | 
| 70 70 | 
             
            description: gator - the friendly code-generator
         | 
| 71 71 | 
             
            email: dominic.graefen@gmail.com
         | 
| 72 72 | 
             
            executables:
         | 
| @@ -85,31 +85,14 @@ files: | |
| 85 85 | 
             
            - VERSION
         | 
| 86 86 | 
             
            - bin/gator
         | 
| 87 87 | 
             
            - gator.gemspec
         | 
| 88 | 
            -
            - lib/__legacy/core.rb
         | 
| 89 | 
            -
            - lib/__legacy/core/cli.rb
         | 
| 90 | 
            -
            - lib/__legacy/core/cli/application.rb
         | 
| 91 | 
            -
            - lib/__legacy/core/cli/shell.rb
         | 
| 92 | 
            -
            - lib/__legacy/core/command.rb
         | 
| 93 | 
            -
            - lib/__legacy/core/command/command.rb
         | 
| 94 | 
            -
            - lib/__legacy/core/configuration.rb
         | 
| 95 | 
            -
            - lib/__legacy/core/configuration/configuration.rb
         | 
| 96 | 
            -
            - lib/__legacy/core/project.rb
         | 
| 97 | 
            -
            - lib/__legacy/core/project/layout.rb
         | 
| 98 | 
            -
            - lib/__legacy/core/project/project.rb
         | 
| 99 | 
            -
            - lib/__legacy/default.rb
         | 
| 100 | 
            -
            - lib/__legacy/default/commands/generator_command.rb
         | 
| 101 | 
            -
            - lib/__legacy/default/commands/new_command.rb
         | 
| 102 | 
            -
            - lib/__legacy/default/commands/new_template/.gator/project.rb.tt
         | 
| 103 | 
            -
            - lib/__legacy/default/generators/AS3ClassTemplate.as.tt
         | 
| 104 | 
            -
            - lib/__legacy/default/generators/as3_class_generator.rb
         | 
| 105 | 
            -
            - lib/__legacy/gator.rb
         | 
| 106 88 | 
             
            - lib/gator.rb
         | 
| 107 89 | 
             
            - lib/gator/commands/command.rb
         | 
| 108 90 | 
             
            - lib/gator/commands/project_command.rb
         | 
| 91 | 
            +
            - lib/gator/config.rb
         | 
| 92 | 
            +
            - lib/gator/project/layout.rb
         | 
| 93 | 
            +
            - lib/gator/project/project.rb
         | 
| 109 94 | 
             
            - lib/gator/runner.rb
         | 
| 110 95 | 
             
            - lib/gator/util.rb
         | 
| 111 | 
            -
            - spec/core/command/command_spec.rb
         | 
| 112 | 
            -
            - spec/core/project/project_spec.rb
         | 
| 113 96 | 
             
            - spec/spec_helper.rb
         | 
| 114 97 | 
             
            has_rdoc: true
         | 
| 115 98 | 
             
            homepage: http://github.com/devboy/gator
         | 
| @@ -127,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 127 110 | 
             
                  version: '0'
         | 
| 128 111 | 
             
                  segments:
         | 
| 129 112 | 
             
                  - 0
         | 
| 130 | 
            -
                  hash:  | 
| 113 | 
            +
                  hash: 875943467517881199
         | 
| 131 114 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 132 115 | 
             
              none: false
         | 
| 133 116 | 
             
              requirements:
         | 
    
        data/lib/__legacy/core.rb
    DELETED
    
    
    
        data/lib/__legacy/core/cli.rb
    DELETED
    
    
| @@ -1,46 +0,0 @@ | |
| 1 | 
            -
            require File.dirname(__FILE__) + '/../../../lib/core/project'
         | 
| 2 | 
            -
            require File.dirname(__FILE__) + '/../../../lib/core/configuration'
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            module Gator
         | 
| 5 | 
            -
              def self.set_argv(args)
         | 
| 6 | 
            -
                ARGV.length.times do |i|
         | 
| 7 | 
            -
                  ARGV.delete_at i
         | 
| 8 | 
            -
                end
         | 
| 9 | 
            -
                args.length.times do |i|
         | 
| 10 | 
            -
                  ARGV[i] = args[i]
         | 
| 11 | 
            -
                end
         | 
| 12 | 
            -
              end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
              module CLI
         | 
| 15 | 
            -
                class Application
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                  def initialize
         | 
| 18 | 
            -
                    self
         | 
| 19 | 
            -
                  end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                  def execute(args)
         | 
| 22 | 
            -
                    raise "No command specified." if args.empty?
         | 
| 23 | 
            -
                    command = args.shift
         | 
| 24 | 
            -
                    raise "Command: \"#{command}\" could not be found." unless Gator::Command.has?(command)
         | 
| 25 | 
            -
                    args << "--help" if args.empty?
         | 
| 26 | 
            -
                    Gator::Command.get(command).start args
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                  def shell
         | 
| 30 | 
            -
                    @shell ||= Shell.new
         | 
| 31 | 
            -
                  end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                end
         | 
| 34 | 
            -
              end
         | 
| 35 | 
            -
              class << self
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                attr_accessor :application
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                def shell
         | 
| 40 | 
            -
                  application.shell
         | 
| 41 | 
            -
                end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
              end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
              self.application= Gator::CLI::Application.new
         | 
| 46 | 
            -
            end
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            require File.dirname(__FILE__) + '/command/command'
         | 
| @@ -1,50 +0,0 @@ | |
| 1 | 
            -
            module Gator
         | 
| 2 | 
            -
              module Command
         | 
| 3 | 
            -
             | 
| 4 | 
            -
                class << self
         | 
| 5 | 
            -
             | 
| 6 | 
            -
                  def add(command)
         | 
| 7 | 
            -
                    unless will_collide? command
         | 
| 8 | 
            -
                      commands.push(command)
         | 
| 9 | 
            -
                      return true
         | 
| 10 | 
            -
                    end
         | 
| 11 | 
            -
                    false
         | 
| 12 | 
            -
                  end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                  def remove(command)
         | 
| 15 | 
            -
                    commands.delete(command) != nil?
         | 
| 16 | 
            -
                  end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                  def has?(name_or_alias)
         | 
| 19 | 
            -
                    commands.any? { |command| command.command_name == name_or_alias || command.command_alias == name_or_alias }
         | 
| 20 | 
            -
                  end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                  def get(name_or_alias)
         | 
| 23 | 
            -
                    commands.detect { |command| command.command_name == name_or_alias || command.command_alias == name_or_alias }
         | 
| 24 | 
            -
                  end
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                  protected
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                  def commands
         | 
| 29 | 
            -
                    @commands ||= []
         | 
| 30 | 
            -
                  end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                  def will_collide?(command)
         | 
| 33 | 
            -
                    has?(command.command_name) || has?(command.command_alias)
         | 
| 34 | 
            -
                  end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                class Base < Thor::Group
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                  class << self
         | 
| 41 | 
            -
                    attr_reader :command_name, :command_alias
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                    def specify( command_name, command_alias )
         | 
| 44 | 
            -
                      @command_name, @command_alias = command_name, command_alias
         | 
| 45 | 
            -
                    end
         | 
| 46 | 
            -
                  end
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                end
         | 
| 49 | 
            -
              end
         | 
| 50 | 
            -
            end
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            require File.dirname(__FILE__) + '/configuration/configuration'
         | 
| @@ -1,60 +0,0 @@ | |
| 1 | 
            -
            module Gator
         | 
| 2 | 
            -
              module Configuration
         | 
| 3 | 
            -
             | 
| 4 | 
            -
                class Config
         | 
| 5 | 
            -
             | 
| 6 | 
            -
                  attr_reader :options
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  def initialize
         | 
| 9 | 
            -
                    @options = {}
         | 
| 10 | 
            -
                    @loaded = false
         | 
| 11 | 
            -
                    self
         | 
| 12 | 
            -
                  end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                  def loaded
         | 
| 15 | 
            -
                    @loaded
         | 
| 16 | 
            -
                  end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                  def load_config
         | 
| 19 | 
            -
                    config_file = File.join(File.expand_path("~"), ".gator", "configuration.rb")
         | 
| 20 | 
            -
                    ConfigurationGenerator.new.create_configuration config_file unless File.exists? config_file
         | 
| 21 | 
            -
                    @loaded = true
         | 
| 22 | 
            -
                    load config_file
         | 
| 23 | 
            -
                  end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                class << self
         | 
| 28 | 
            -
                  attr_accessor :config
         | 
| 29 | 
            -
                end
         | 
| 30 | 
            -
                self.config = Config.new
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                def configuration
         | 
| 33 | 
            -
                  config = Gator::Configuration.config
         | 
| 34 | 
            -
                  config.load_config unless config.loaded
         | 
| 35 | 
            -
                  config
         | 
| 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)
         | 
| 45 | 
            -
                      Gator.shell.say "Configuration file not found at: #{config_file}!", :red
         | 
| 46 | 
            -
                      Gator.shell.say ""
         | 
| 47 | 
            -
                      Gator.shell.say "Let's create one!", :green
         | 
| 48 | 
            -
                      create_file config_file do
         | 
| 49 | 
            -
                        render = ""
         | 
| 50 | 
            -
                        render += "#This file has been generated by gator and wants to be edited by you!\n"
         | 
| 51 | 
            -
                        render += "configuration.options[:author] = \"#{Gator.shell.ask "\nAuthor:"}\"\n"
         | 
| 52 | 
            -
                        render
         | 
| 53 | 
            -
                      end
         | 
| 54 | 
            -
                    end
         | 
| 55 | 
            -
             | 
| 56 | 
            -
                  }
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                end
         | 
| 59 | 
            -
              end
         | 
| 60 | 
            -
            end
         | 
| @@ -1,101 +0,0 @@ | |
| 1 | 
            -
            module Gator
         | 
| 2 | 
            -
              module Project
         | 
| 3 | 
            -
             | 
| 4 | 
            -
                class Base
         | 
| 5 | 
            -
             | 
| 6 | 
            -
                  attr_reader :name
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  def initialize(name)
         | 
| 9 | 
            -
                    @name = name
         | 
| 10 | 
            -
                    @layout = Layout.default
         | 
| 11 | 
            -
                  end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                  def path(*args)
         | 
| 14 | 
            -
                    File.join(Gator::Project.project_dir, layout.expand(*args))
         | 
| 15 | 
            -
                  end
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                  def layout
         | 
| 18 | 
            -
                    @layout
         | 
| 19 | 
            -
                  end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                  def layout=(layout)
         | 
| 22 | 
            -
                    @layout= layout
         | 
| 23 | 
            -
                  end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                class << self
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                  def project=(project)
         | 
| 30 | 
            -
                    @project = project
         | 
| 31 | 
            -
                  end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                  def project
         | 
| 34 | 
            -
                    @project
         | 
| 35 | 
            -
                  end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                  def is_project_directory(path= Dir.getwd)
         | 
| 38 | 
            -
                    File.exists? File.join(path, relative_project_file)
         | 
| 39 | 
            -
                  end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                  def is_project_subdirectory(path= Dir.getwd)
         | 
| 42 | 
            -
                    !get_project_directory_of_subdirectory(path).nil?
         | 
| 43 | 
            -
                  end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                  def get_project_directory_of_subdirectory(path= Dir.getwd)
         | 
| 46 | 
            -
                    original_dir = Dir.getwd
         | 
| 47 | 
            -
                    here = path
         | 
| 48 | 
            -
                    Dir.chdir(here)
         | 
| 49 | 
            -
                    while !(is_project_directory(Dir.getwd))
         | 
| 50 | 
            -
                      Dir.chdir("..")
         | 
| 51 | 
            -
                      return nil if Dir.pwd == here
         | 
| 52 | 
            -
                      here = Dir.pwd
         | 
| 53 | 
            -
                    end
         | 
| 54 | 
            -
                    return here
         | 
| 55 | 
            -
                  ensure
         | 
| 56 | 
            -
                    Dir.chdir(original_dir)
         | 
| 57 | 
            -
                  end
         | 
| 58 | 
            -
             | 
| 59 | 
            -
                  def project_file(path= Dir.getwd)
         | 
| 60 | 
            -
                    if is_project_directory(path)
         | 
| 61 | 
            -
                      File.join(path, relative_project_file)
         | 
| 62 | 
            -
                    elsif is_project_subdirectory(path)
         | 
| 63 | 
            -
                      File.join(get_project_directory_of_subdirectory, relative_project_file)
         | 
| 64 | 
            -
                    else
         | 
| 65 | 
            -
                      nil
         | 
| 66 | 
            -
                    end
         | 
| 67 | 
            -
                  end
         | 
| 68 | 
            -
             | 
| 69 | 
            -
                  def project_dir(path= Dir.getwd)
         | 
| 70 | 
            -
                    File.dirname( File.dirname( project_file(path) ))
         | 
| 71 | 
            -
                  end
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                  private
         | 
| 74 | 
            -
             | 
| 75 | 
            -
                  def relative_project_file
         | 
| 76 | 
            -
                    File.join(".gator", "project.rb")
         | 
| 77 | 
            -
                  end
         | 
| 78 | 
            -
                end
         | 
| 79 | 
            -
             | 
| 80 | 
            -
                def project(project=nil)
         | 
| 81 | 
            -
                  Gator::Project.project= project unless project.nil?
         | 
| 82 | 
            -
                  load_project unless Gator::Project.project
         | 
| 83 | 
            -
                  if Gator::Project.project.nil?
         | 
| 84 | 
            -
                    Gator.shell.say "Project is not defined!\nMake sure to define a project in #{Gator::Project.project_file}",:red
         | 
| 85 | 
            -
                    raise "ProjectNotDefined"
         | 
| 86 | 
            -
                  end
         | 
| 87 | 
            -
                  Gator::Project.project
         | 
| 88 | 
            -
                end
         | 
| 89 | 
            -
             | 
| 90 | 
            -
                def load_project
         | 
| 91 | 
            -
                  pfile = Gator::Project.project_file
         | 
| 92 | 
            -
                  if pfile.nil?
         | 
| 93 | 
            -
                    Gator.shell.say "This is not a project directory!\nPlease create a gator project first.", :red
         | 
| 94 | 
            -
                    raise "NotInsideProjectDirectory"
         | 
| 95 | 
            -
                  else
         | 
| 96 | 
            -
                    load pfile
         | 
| 97 | 
            -
                  end
         | 
| 98 | 
            -
                end
         | 
| 99 | 
            -
             | 
| 100 | 
            -
              end
         | 
| 101 | 
            -
            end
         | 
    
        data/lib/__legacy/default.rb
    DELETED
    
    
| @@ -1,74 +0,0 @@ | |
| 1 | 
            -
            module Gator
         | 
| 2 | 
            -
              module Generators
         | 
| 3 | 
            -
                class << self
         | 
| 4 | 
            -
             | 
| 5 | 
            -
                  def add(generator)
         | 
| 6 | 
            -
                    unless will_collide? generator
         | 
| 7 | 
            -
                      generators.push(generator)
         | 
| 8 | 
            -
                      return true
         | 
| 9 | 
            -
                    end
         | 
| 10 | 
            -
                    false
         | 
| 11 | 
            -
                  end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                  def remove(generator)
         | 
| 14 | 
            -
                    generators.delete(generator) != nil?
         | 
| 15 | 
            -
                  end
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                  def has?(name_or_alias)
         | 
| 18 | 
            -
                    generators.any? { |generator| generator.generator_name == name_or_alias || generator.generator_alias == name_or_alias }
         | 
| 19 | 
            -
                  end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                  def get(name_or_alias)
         | 
| 22 | 
            -
                    generators.detect { |generator| generator.generator_name == name_or_alias || generator.generator_alias == name_or_alias }
         | 
| 23 | 
            -
                  end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                  protected
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                  def generators
         | 
| 28 | 
            -
                    @generators ||= []
         | 
| 29 | 
            -
                  end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                  def will_collide?(generator)
         | 
| 32 | 
            -
                    has?(generator.generator_name) || has?(generator.generator_alias)
         | 
| 33 | 
            -
                  end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                class Base < Thor::Group
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                  class << self
         | 
| 40 | 
            -
                    attr_reader :generator_name, :generator_alias
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                    def specify( generator_name, generator_alias )
         | 
| 43 | 
            -
                      @generator_name, @generator_alias = generator_name, generator_alias
         | 
| 44 | 
            -
                    end
         | 
| 45 | 
            -
                  end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
                end
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                class GeneratorCommand < Gator::Command::Base
         | 
| 50 | 
            -
                  include Thor::Actions
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                  specify "generate", "g"
         | 
| 53 | 
            -
             | 
| 54 | 
            -
                  def self.source_root
         | 
| 55 | 
            -
                    File.dirname(__FILE__)
         | 
| 56 | 
            -
                  end
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                  argument :name, :type => :string, :desc => "The name of the generator."
         | 
| 59 | 
            -
            #      argument :args, :type => :array
         | 
| 60 | 
            -
                  desc "Finds and executes a generator."
         | 
| 61 | 
            -
             | 
| 62 | 
            -
                  def find_and_execute
         | 
| 63 | 
            -
                    raise "Generator: \"#{name}\" could not be found." unless Gator::Generators.has?(name)
         | 
| 64 | 
            -
                    ARGV.shift
         | 
| 65 | 
            -
                    ARGV << "--help" if ARGV.empty?
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                    Gator::Generators.get(name).start
         | 
| 68 | 
            -
                  end
         | 
| 69 | 
            -
             | 
| 70 | 
            -
                end
         | 
| 71 | 
            -
             | 
| 72 | 
            -
                Gator::Command.add GeneratorCommand
         | 
| 73 | 
            -
              end
         | 
| 74 | 
            -
            end
         | 
| @@ -1,31 +0,0 @@ | |
| 1 | 
            -
            require "thor/actions"
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Gator
         | 
| 4 | 
            -
              module Default
         | 
| 5 | 
            -
                module Commands
         | 
| 6 | 
            -
             | 
| 7 | 
            -
                  class NewCommand < Gator::Command::Base
         | 
| 8 | 
            -
                    include Thor::Actions
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                    specify "new", "n"
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                    def self.source_root
         | 
| 13 | 
            -
                      File.dirname(__FILE__)
         | 
| 14 | 
            -
                    end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                    argument :name, :type => :string, :desc => "The name of the project."
         | 
| 17 | 
            -
                    desc "Creates an empty gator project."
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                    def create
         | 
| 20 | 
            -
                      directory "new_template", name
         | 
| 21 | 
            -
                      # we need to call directories starting with a . seperately
         | 
| 22 | 
            -
                      directory "new_template/.gator", "#{name}/.gator"
         | 
| 23 | 
            -
                    end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                  end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                  Gator::Command.add NewCommand
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                end
         | 
| 30 | 
            -
              end
         | 
| 31 | 
            -
            end
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            project Gator::Project::Base.new "<%= name %>"
         | 
| @@ -1,27 +0,0 @@ | |
| 1 | 
            -
            require "thor/actions"
         | 
| 2 | 
            -
            module Gator
         | 
| 3 | 
            -
              module AS3
         | 
| 4 | 
            -
                class AS3ClassGenerator < Gator::Generators::Base
         | 
| 5 | 
            -
                  include Gator::ProjectCommand, Thor::Actions
         | 
| 6 | 
            -
             | 
| 7 | 
            -
                  specify "as3class", "as3c"
         | 
| 8 | 
            -
             | 
| 9 | 
            -
                  argument :package_name, :type => :string, :desc => "The name of the package."
         | 
| 10 | 
            -
                  argument :class_name, :type => :string, :desc => "The name of the class."
         | 
| 11 | 
            -
                  desc "Creates an ActionScript3 Class"
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                  def self.source_root
         | 
| 14 | 
            -
                    File.dirname(__FILE__)
         | 
| 15 | 
            -
                  end
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                  def create_class
         | 
| 18 | 
            -
                    src = project.path(:source, :main, :as3)
         | 
| 19 | 
            -
                    template "AS3ClassTemplate.as.tt", File.join(src, "#{class_name}.as" )
         | 
| 20 | 
            -
                  end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                Gator::Generators.add AS3ClassGenerator
         | 
| 25 | 
            -
              end
         | 
| 26 | 
            -
            end
         | 
| 27 | 
            -
             | 
    
        data/lib/__legacy/gator.rb
    DELETED
    
    | @@ -1,11 +0,0 @@ | |
| 1 | 
            -
            require "thor"
         | 
| 2 | 
            -
            require "thor/group"
         | 
| 3 | 
            -
            require File.dirname(__FILE__) + '/core'
         | 
| 4 | 
            -
            require File.dirname(__FILE__) + '/default'
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            # This makes gator module functions locally available in config & project files
         | 
| 7 | 
            -
            module Gator
         | 
| 8 | 
            -
              include Gator::Project
         | 
| 9 | 
            -
              include Gator::Configuration
         | 
| 10 | 
            -
            end
         | 
| 11 | 
            -
            class << self; include Gator end
         | 
| @@ -1,65 +0,0 @@ | |
| 1 | 
            -
            require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            class TestCommandA < Gator::Command::Base
         | 
| 4 | 
            -
              specify "command_a", "a"
         | 
| 5 | 
            -
            end
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            class TestCommandB < Gator::Command::Base
         | 
| 8 | 
            -
              specify "command_b", "b"
         | 
| 9 | 
            -
            end
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            describe Gator::Command::Base do
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              it "has the correct attributes" do
         | 
| 14 | 
            -
                test_command_a = TestCommandA
         | 
| 15 | 
            -
                test_command_a.command_name.should == "command_a"
         | 
| 16 | 
            -
                test_command_a.command_alias.should == "a"
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            describe Gator::Command do
         | 
| 22 | 
            -
             | 
| 23 | 
            -
              before(:all) do
         | 
| 24 | 
            -
                @test_command_a = TestCommandA
         | 
| 25 | 
            -
                @test_command_b = TestCommandB
         | 
| 26 | 
            -
              end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
              after(:all) do
         | 
| 29 | 
            -
                @test_command_a = nil
         | 
| 30 | 
            -
                @test_command_b = nil
         | 
| 31 | 
            -
              end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
              it "should add a command" do
         | 
| 34 | 
            -
                Gator::Command.add(@test_command_a).should == true
         | 
| 35 | 
            -
              end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
              it "should not add the same command again" do
         | 
| 38 | 
            -
                Gator::Command.add(@test_command_a).should == false
         | 
| 39 | 
            -
              end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
              it "should add another command though" do
         | 
| 42 | 
            -
                Gator::Command.add(@test_command_b).should == true
         | 
| 43 | 
            -
              end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
              it "should have a command with name" do
         | 
| 46 | 
            -
                Gator::Command.has?(@test_command_a.command_name).should == true
         | 
| 47 | 
            -
              end
         | 
| 48 | 
            -
             | 
| 49 | 
            -
              it "should have a command with alias" do
         | 
| 50 | 
            -
                Gator::Command.has?(@test_command_a.command_alias).should == true
         | 
| 51 | 
            -
              end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
              it "should return TestCommandA by name" do
         | 
| 54 | 
            -
                Gator::Command.get(@test_command_a.command_name).should == @test_command_a
         | 
| 55 | 
            -
              end
         | 
| 56 | 
            -
             | 
| 57 | 
            -
              it "should return TestCommandA by alias" do
         | 
| 58 | 
            -
                Gator::Command.get(@test_command_a.command_alias).should == @test_command_a
         | 
| 59 | 
            -
              end
         | 
| 60 | 
            -
             | 
| 61 | 
            -
              it "should remove test_command_a" do
         | 
| 62 | 
            -
                Gator::Command.remove(@test_command_a).should == true
         | 
| 63 | 
            -
              end
         | 
| 64 | 
            -
             | 
| 65 | 
            -
            end
         | 
| @@ -1,49 +0,0 @@ | |
| 1 | 
            -
            require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require "fileutils"
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            describe Gator::Project::Base do
         | 
| 6 | 
            -
             | 
| 7 | 
            -
              it "has the correct attributes" do
         | 
| 8 | 
            -
                test_project = Gator::Project::Base.new "test_project"
         | 
| 9 | 
            -
                test_project.name.should == "test_project"
         | 
| 10 | 
            -
                test_project.layout.should == Gator::Project::Layout.default
         | 
| 11 | 
            -
              end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            end
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            describe Gator::Project do
         | 
| 16 | 
            -
             | 
| 17 | 
            -
              before(:all) do
         | 
| 18 | 
            -
                @project_dir = File.expand_path("project_spec_directory_test")
         | 
| 19 | 
            -
                FileUtils.mkdir_p File.join(@project_dir,".gator")
         | 
| 20 | 
            -
                FileUtils.mkdir_p File.join(@project_dir,"sub")
         | 
| 21 | 
            -
                File.open(File.join(@project_dir,".gator","project.rb"), 'w') {|f| f.write("-empty-") }
         | 
| 22 | 
            -
              end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
              after(:all) do
         | 
| 25 | 
            -
                FileUtils.rm_r @project_dir
         | 
| 26 | 
            -
                @project_dir = nil
         | 
| 27 | 
            -
              end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
              it "should detect being inside a project directory" do
         | 
| 30 | 
            -
                Gator::Project.is_project_directory(@project_dir).should == true
         | 
| 31 | 
            -
              end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
              it "should detect the correct project directory from within a project subdirectory" do
         | 
| 34 | 
            -
                Gator::Project.get_project_directory_of_subdirectory(File.join(@project_dir,"sub")).should == @project_dir
         | 
| 35 | 
            -
              end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
              it "should detect being inside a project subdirectory" do
         | 
| 38 | 
            -
                Gator::Project.is_project_subdirectory(File.join(@project_dir,"sub")).should == true
         | 
| 39 | 
            -
              end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
              it "should not detect being inside a project directory" do
         | 
| 42 | 
            -
                Gator::Project.is_project_directory(File.join(@project_dir,"sub")).should == false
         | 
| 43 | 
            -
              end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
              it "should not detect being inside a project subdirectory" do
         | 
| 46 | 
            -
                Gator::Project.is_project_directory(File.expand_path("~")).should == false
         | 
| 47 | 
            -
              end
         | 
| 48 | 
            -
             | 
| 49 | 
            -
            end
         |