chloe 0.0.1
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/bin/chloe +6 -0
- data/lib/chloe/cli.rb +10 -0
- data/lib/chloe/executable.rb +17 -0
- data/lib/chloe/task.rb +23 -0
- data/lib/chloe/tasks/initialize.rb +26 -0
- data/lib/chloe/tasks.rb +5 -0
- data/lib/chloe/templates/example.rb +18 -0
- data/lib/chloe/templates/executable +6 -0
- data/lib/chloe/version.rb +3 -0
- data/lib/chloe.rb +42 -0
- data/lib/core_ext/string.rb +12 -0
- metadata +107 -0
    
        data/bin/chloe
    ADDED
    
    
    
        data/lib/chloe/cli.rb
    ADDED
    
    
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            module Chloe
         | 
| 2 | 
            +
              class Executable < Thor
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                def self.start
         | 
| 5 | 
            +
                  @registry.each do |klass, subcommand, usage|
         | 
| 6 | 
            +
                    self.register(klass, subcommand, usage, klass.summary)
         | 
| 7 | 
            +
                  end
         | 
| 8 | 
            +
                  super
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def self.tag_for_registry(klass, subcommand_name, usage)
         | 
| 12 | 
            +
                  args = [klass, subcommand_name, usage]
         | 
| 13 | 
            +
                  (@registry ||= []) << args
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
    
        data/lib/chloe/task.rb
    ADDED
    
    | @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            module Chloe
         | 
| 2 | 
            +
              class Task < Thor
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                def self.inherited(subclass)
         | 
| 5 | 
            +
                  parts      = subclass.to_s.split('::')
         | 
| 6 | 
            +
                  basename   = parts.last
         | 
| 7 | 
            +
                  namespace  = parts[0..-2]
         | 
| 8 | 
            +
                  snakename  = Thor::Util.snake_case(basename)
         | 
| 9 | 
            +
                  executable = (namespace << 'Executable').join('::').constantize
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  executable.tag_for_registry subclass, snakename.to_sym, "#{snakename} <command>"
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                def self.summary(summary = nil)
         | 
| 15 | 
            +
                  if summary
         | 
| 16 | 
            +
                    @summary = summary
         | 
| 17 | 
            +
                  else
         | 
| 18 | 
            +
                    @summary || self.to_s.split('::').last
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            module Chloe
         | 
| 2 | 
            +
              module Tasks
         | 
| 3 | 
            +
                class Initialize < ::Thor::Group
         | 
| 4 | 
            +
                  include ::Thor::Actions
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  argument :name
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  def self.source_root
         | 
| 9 | 
            +
                    File.dirname(File.expand_path(File.join(__FILE__, '..')))
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  def create_executable
         | 
| 13 | 
            +
                    template('templates/executable', name)
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  def chmod_executable
         | 
| 17 | 
            +
                    chmod(name, 0755)
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  def create_example
         | 
| 21 | 
            +
                    template('templates/example.rb', '.chloe/example.rb')
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
            end
         | 
    
        data/lib/chloe/tasks.rb
    ADDED
    
    
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            module <%= Thor::Util.camel_case(name) %>
         | 
| 2 | 
            +
              module CLI
         | 
| 3 | 
            +
                class Example < Chloe::Task
         | 
| 4 | 
            +
                  summary "This is an example task group, delete this task group an make your own"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  desc 'print "[text]"', 'Prints the text that is passed as an argument'
         | 
| 7 | 
            +
                  def print(text)
         | 
| 8 | 
            +
                    puts text
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  desc 'output "[text]"', 'Prints "OUTPUT:" and then the text passed as an argument'
         | 
| 12 | 
            +
                  def output(text)
         | 
| 13 | 
            +
                    puts "OUTPUT: #{text}"
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
    
        data/lib/chloe.rb
    ADDED
    
    | @@ -0,0 +1,42 @@ | |
| 1 | 
            +
            require 'thor'
         | 
| 2 | 
            +
            require 'thor/group'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            require 'core_ext/string'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            require 'chloe/cli'
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            module Chloe
         | 
| 9 | 
            +
              autoload :CLI,        'chloe/cli'
         | 
| 10 | 
            +
              autoload :Executable, 'chloe/executable'
         | 
| 11 | 
            +
              autoload :Task,       'chloe/task'
         | 
| 12 | 
            +
              autoload :Tasks,      'chloe/tasks'
         | 
| 13 | 
            +
              autoload :Version,    'chloe/version'
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              class << self
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def bootstrap(name)
         | 
| 18 | 
            +
                  executable = define_executable(name)
         | 
| 19 | 
            +
                  require_tasks
         | 
| 20 | 
            +
                  executable.start
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def define_executable(name)
         | 
| 24 | 
            +
                  module_eval <<-EVAL
         | 
| 25 | 
            +
                    module ::#{name}
         | 
| 26 | 
            +
                      module CLI
         | 
| 27 | 
            +
                        class Executable < Chloe::Executable
         | 
| 28 | 
            +
                        end
         | 
| 29 | 
            +
                      end
         | 
| 30 | 
            +
                    end
         | 
| 31 | 
            +
                  EVAL
         | 
| 32 | 
            +
                  "#{name}::CLI::Executable".constantize
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                def require_tasks
         | 
| 36 | 
            +
                  Dir.glob('.chloe/**/*.rb') do |file|
         | 
| 37 | 
            +
                    require file
         | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              end
         | 
| 42 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            class String
         | 
| 2 | 
            +
              def constantize
         | 
| 3 | 
            +
                names = self.split('::')
         | 
| 4 | 
            +
                names.shift if names.empty? || names.first.empty?
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                constant = Object
         | 
| 7 | 
            +
                names.each do |name|
         | 
| 8 | 
            +
                  constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
                constant
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,107 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 | 
            +
            name: chloe
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 29
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 0
         | 
| 8 | 
            +
              - 0
         | 
| 9 | 
            +
              - 1
         | 
| 10 | 
            +
              version: 0.0.1
         | 
| 11 | 
            +
            platform: ruby
         | 
| 12 | 
            +
            authors: 
         | 
| 13 | 
            +
            - Ryan Moran
         | 
| 14 | 
            +
            autorequire: 
         | 
| 15 | 
            +
            bindir: bin
         | 
| 16 | 
            +
            cert_chain: []
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            date: 2012-07-24 00:00:00 Z
         | 
| 19 | 
            +
            dependencies: 
         | 
| 20 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 21 | 
            +
              name: thor
         | 
| 22 | 
            +
              prerelease: false
         | 
| 23 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 24 | 
            +
                none: false
         | 
| 25 | 
            +
                requirements: 
         | 
| 26 | 
            +
                - - ~>
         | 
| 27 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 28 | 
            +
                    hash: 35
         | 
| 29 | 
            +
                    segments: 
         | 
| 30 | 
            +
                    - 0
         | 
| 31 | 
            +
                    - 15
         | 
| 32 | 
            +
                    - 0
         | 
| 33 | 
            +
                    version: 0.15.0
         | 
| 34 | 
            +
              type: :runtime
         | 
| 35 | 
            +
              version_requirements: *id001
         | 
| 36 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 37 | 
            +
              name: rspec
         | 
| 38 | 
            +
              prerelease: false
         | 
| 39 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 40 | 
            +
                none: false
         | 
| 41 | 
            +
                requirements: 
         | 
| 42 | 
            +
                - - ~>
         | 
| 43 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 44 | 
            +
                    hash: 35
         | 
| 45 | 
            +
                    segments: 
         | 
| 46 | 
            +
                    - 2
         | 
| 47 | 
            +
                    - 11
         | 
| 48 | 
            +
                    - 0
         | 
| 49 | 
            +
                    version: 2.11.0
         | 
| 50 | 
            +
              type: :development
         | 
| 51 | 
            +
              version_requirements: *id002
         | 
| 52 | 
            +
            description: "    Chloe is a tool used to manage an application's development environment.\n    We all have projects that use a multitude of tools to bootstrap, run, and\n    test our applications while they are in development. We have to learn\n    bundler, rake, rails, vagrant, librarian, and many other tools so that we\n    can just get something up to hack on it. Chloe tries to solve this by\n    acting as a simple CLI for your application in development. It enables\n    you to wrap up common tasks into a singular interface, keeping tests,\n    vms, and dependency management all under one roof.\n"
         | 
| 53 | 
            +
            email: 
         | 
| 54 | 
            +
            - ryan.moran@gmail.com
         | 
| 55 | 
            +
            executables: 
         | 
| 56 | 
            +
            - chloe
         | 
| 57 | 
            +
            extensions: []
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            extra_rdoc_files: []
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            files: 
         | 
| 62 | 
            +
            - bin/chloe
         | 
| 63 | 
            +
            - lib/chloe.rb
         | 
| 64 | 
            +
            - lib/chloe/cli.rb
         | 
| 65 | 
            +
            - lib/chloe/executable.rb
         | 
| 66 | 
            +
            - lib/chloe/task.rb
         | 
| 67 | 
            +
            - lib/chloe/tasks.rb
         | 
| 68 | 
            +
            - lib/chloe/tasks/initialize.rb
         | 
| 69 | 
            +
            - lib/chloe/templates/example.rb
         | 
| 70 | 
            +
            - lib/chloe/templates/executable
         | 
| 71 | 
            +
            - lib/chloe/version.rb
         | 
| 72 | 
            +
            - lib/core_ext/string.rb
         | 
| 73 | 
            +
            homepage: https://github.com/ryanmoran/chloe
         | 
| 74 | 
            +
            licenses: []
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            post_install_message: 
         | 
| 77 | 
            +
            rdoc_options: []
         | 
| 78 | 
            +
             | 
| 79 | 
            +
            require_paths: 
         | 
| 80 | 
            +
            - lib
         | 
| 81 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 82 | 
            +
              none: false
         | 
| 83 | 
            +
              requirements: 
         | 
| 84 | 
            +
              - - ">="
         | 
| 85 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 86 | 
            +
                  hash: 3
         | 
| 87 | 
            +
                  segments: 
         | 
| 88 | 
            +
                  - 0
         | 
| 89 | 
            +
                  version: "0"
         | 
| 90 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 91 | 
            +
              none: false
         | 
| 92 | 
            +
              requirements: 
         | 
| 93 | 
            +
              - - ">="
         | 
| 94 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 95 | 
            +
                  hash: 3
         | 
| 96 | 
            +
                  segments: 
         | 
| 97 | 
            +
                  - 0
         | 
| 98 | 
            +
                  version: "0"
         | 
| 99 | 
            +
            requirements: []
         | 
| 100 | 
            +
             | 
| 101 | 
            +
            rubyforge_project: 
         | 
| 102 | 
            +
            rubygems_version: 1.8.24
         | 
| 103 | 
            +
            signing_key: 
         | 
| 104 | 
            +
            specification_version: 3
         | 
| 105 | 
            +
            summary: Chloe helps keep your application development environment under control.
         | 
| 106 | 
            +
            test_files: []
         | 
| 107 | 
            +
             |