tap 0.12.2 → 0.12.3
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/History +7 -0
- data/README +1 -1
- data/cmd/console.rb +9 -6
- data/cmd/destroy.rb +11 -0
- data/cmd/generate.rb +11 -0
- data/cmd/manifest.rb +2 -3
- data/cmd/run.rb +1 -1
- data/lib/tap/constants.rb +1 -1
- data/lib/tap/env.rb +9 -7
- data/lib/tap/generator/generators/root/root_generator.rb +22 -17
- data/lib/tap/generator/generators/root/templates/MIT-LICENSE +22 -0
- data/lib/tap/generator/generators/root/templates/README +14 -0
- data/lib/tap/generator/generators/root/templates/Rakefile +4 -6
- data/lib/tap/generator/generators/root/templates/gemspec +3 -3
- data/lib/tap/task.rb +8 -6
- metadata +4 -3
    
        data/History
    CHANGED
    
    
    
        data/README
    CHANGED
    
    | @@ -110,5 +110,5 @@ Tap requires an updated version of RubyGems[http://docs.rubygems.org/] | |
| 110 110 | 
             
            Copyright (c) 2006-2009, Regents of the University of Colorado.
         | 
| 111 111 | 
             
            Developer:: {Simon Chiang}[http://bahuvrihi.wordpress.com], {Biomolecular Structure Program}[http://biomol.uchsc.edu/], {Hansen Lab}[http://hsc-proteomics.uchsc.edu/hansenlab/] 
         | 
| 112 112 | 
             
            Support:: CU Denver School of Medicine Deans Academic Enrichment Fund
         | 
| 113 | 
            -
             | 
| 113 | 
            +
            License:: {MIT-Style}[link:files/MIT-LICENSE.html]
         | 
| 114 114 |  | 
    
        data/cmd/console.rb
    CHANGED
    
    | @@ -1,11 +1,14 @@ | |
| 1 | 
            -
            # tap console [options]
         | 
| 1 | 
            +
            # usage: tap console [options]
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Opens up an IRB session with Tap initialized  | 
| 3 | 
            +
            # Opens up an IRB session with the Tap environment initialized as specified
         | 
| 4 4 | 
             
            # in tap.yml. Access the Tap::App.instance through 'app', and
         | 
| 5 | 
            -
            # Tap::Env.instance through 'env'.
         | 
| 6 | 
            -
             | 
| 5 | 
            +
            # Tap::Env.instance through 'env'.  For example:
         | 
| 7 6 | 
             
            #
         | 
| 8 | 
            -
            #  | 
| 7 | 
            +
            #   % tap console
         | 
| 8 | 
            +
            #   >> env.tasks.search('tap:dump').constantize=> Tap::Tasks::Dump
         | 
| 9 | 
            +
            #   >> app.info
         | 
| 10 | 
            +
            #   => "state: 0 (READY) queue: 0 results: 0"
         | 
| 11 | 
            +
            #   >> 
         | 
| 9 12 | 
             
            #
         | 
| 10 13 |  | 
| 11 14 | 
             
            ConfigParser.new do |opts|
         | 
| @@ -40,4 +43,4 @@ module CleanExit # :nodoc: | |
| 40 43 | 
             
                __exit__(ret)
         | 
| 41 44 | 
             
              end
         | 
| 42 45 | 
             
            end
         | 
| 43 | 
            -
            IRB.CurrentContext.extend CleanExit
         | 
| 46 | 
            +
            IRB.CurrentContext.extend CleanExit
         | 
    
        data/cmd/destroy.rb
    CHANGED
    
    | @@ -1,9 +1,20 @@ | |
| 1 | 
            +
            # usage: tap destroy GENERATOR ...
         | 
| 2 | 
            +
            #
         | 
| 3 | 
            +
            # Runs a generator in reverse.  Each generator works a little differently; the
         | 
| 4 | 
            +
            # best way to figure out what a generator does is to use --help. For example:
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            #   % tap generate root --help
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
             | 
| 1 9 | 
             
            require 'tap/generator/base'
         | 
| 2 10 | 
             
            require 'tap/generator/destroy'
         | 
| 3 11 |  | 
| 4 12 | 
             
            env = Tap::Env.instance
         | 
| 5 13 |  | 
| 6 14 | 
             
            if ARGV.empty? || ARGV == ['--help']
         | 
| 15 | 
            +
              puts Lazydoc.usage(__FILE__)
         | 
| 16 | 
            +
              puts
         | 
| 17 | 
            +
              puts "generators:"
         | 
| 7 18 | 
             
              puts env.summarize(:generators)
         | 
| 8 19 | 
             
              exit
         | 
| 9 20 | 
             
            end
         | 
    
        data/cmd/generate.rb
    CHANGED
    
    | @@ -1,9 +1,20 @@ | |
| 1 | 
            +
            # usage: tap generate GENERATOR ...
         | 
| 2 | 
            +
            #
         | 
| 3 | 
            +
            # Runs a generator.  Each generator works a little differently; the best way to
         | 
| 4 | 
            +
            # figure out what a generator does is to use --help. For example:
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            #   % tap generate root --help
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
             | 
| 1 9 | 
             
            require 'tap/generator/base'
         | 
| 2 10 | 
             
            require 'tap/generator/generate'
         | 
| 3 11 |  | 
| 4 12 | 
             
            env = Tap::Env.instance
         | 
| 5 13 |  | 
| 6 14 | 
             
            if ARGV.empty? || ARGV == ['--help']
         | 
| 15 | 
            +
              puts Lazydoc.usage(__FILE__)
         | 
| 16 | 
            +
              puts
         | 
| 17 | 
            +
              puts "generators:"
         | 
| 7 18 | 
             
              puts env.summarize(:generators)
         | 
| 8 19 | 
             
              exit
         | 
| 9 20 | 
             
            end
         | 
    
        data/cmd/manifest.rb
    CHANGED
    
    
    
        data/cmd/run.rb
    CHANGED
    
    
    
        data/lib/tap/constants.rb
    CHANGED
    
    
    
        data/lib/tap/env.rb
    CHANGED
    
    | @@ -103,13 +103,7 @@ module Tap | |
| 103 103 | 
             
                attr_reader :envs
         | 
| 104 104 |  | 
| 105 105 | 
             
                # The Root directory structure for self.
         | 
| 106 | 
            -
                nest(:root, Tap::Root | 
| 107 | 
            -
                  case config
         | 
| 108 | 
            -
                  when Root then config
         | 
| 109 | 
            -
                  when String then Root.new(config)
         | 
| 110 | 
            -
                  else Root.new.reconfigure(config)
         | 
| 111 | 
            -
                  end
         | 
| 112 | 
            -
                end
         | 
| 106 | 
            +
                nest(:root, Tap::Root, :initializer => false)
         | 
| 113 107 |  | 
| 114 108 | 
             
                # Specify gems to load as nested Envs.  Gems may be specified 
         | 
| 115 109 | 
             
                # by name and/or version, like 'gemname >= 1.2'; by default the 
         | 
| @@ -482,6 +476,14 @@ module Tap | |
| 482 476 | 
             
                # A hash of the manifests for self.
         | 
| 483 477 | 
             
                attr_reader :manifests
         | 
| 484 478 |  | 
| 479 | 
            +
                def initialize_root(config)
         | 
| 480 | 
            +
                  case config
         | 
| 481 | 
            +
                  when Root then config
         | 
| 482 | 
            +
                  when String then Root.new(config)
         | 
| 483 | 
            +
                  else Root.new.reconfigure(config)
         | 
| 484 | 
            +
                  end
         | 
| 485 | 
            +
                end
         | 
| 486 | 
            +
                
         | 
| 485 487 | 
             
                def minikey(env)
         | 
| 486 488 | 
             
                  env.root.root
         | 
| 487 489 | 
             
                end
         | 
| @@ -4,24 +4,24 @@ module Tap::Generator::Generators | |
| 4 4 |  | 
| 5 5 | 
             
              # :startdoc: Tap::Generator::Generators::RootGenerator::generator a basic tap directory structure
         | 
| 6 6 | 
             
              #
         | 
| 7 | 
            -
              # Generates a tap root directory structure.  Use the switches to 
         | 
| 8 | 
            -
              #  | 
| 7 | 
            +
              # Generates a tap root directory structure.  Use the switches to turn on or
         | 
| 8 | 
            +
              # off the creation of various files:
         | 
| 9 9 | 
             
              #
         | 
| 10 | 
            -
              #    | 
| 10 | 
            +
              #   project
         | 
| 11 | 
            +
              #   |- MIT-LICENSE
         | 
| 12 | 
            +
              #   |- README
         | 
| 11 13 | 
             
              #   |- Rakefile
         | 
| 12 14 | 
             
              #   |- lib
         | 
| 13 | 
            -
              #   |-  | 
| 15 | 
            +
              #   |- project.gemspec
         | 
| 14 16 | 
             
              #   |- tap.yml
         | 
| 15 | 
            -
              #   |- Tapfile
         | 
| 16 17 | 
             
              #   `- test
         | 
| 17 | 
            -
              #        | 
| 18 | 
            -
              #       |- tap_test_suite.rb
         | 
| 19 | 
            -
              #       `- tapfile_test.rb
         | 
| 18 | 
            +
              #       `- tap_test_helper.rb
         | 
| 20 19 | 
             
              #
         | 
| 21 20 | 
             
              class RootGenerator < Tap::Generator::Base
         | 
| 22 21 |  | 
| 23 | 
            -
                config :config_file, true, &c.switch   #  | 
| 24 | 
            -
                config : | 
| 22 | 
            +
                config :config_file, true, &c.switch   # Create a tap.yml file
         | 
| 23 | 
            +
                config :license, true, &c.switch       # Create an MIT-LICENSE
         | 
| 24 | 
            +
                config :rapfile, false, &c.switch      # Create a Rapfile
         | 
| 25 25 |  | 
| 26 26 | 
             
                # ::args ROOT, PROJECT_NAME=basename(ROOT)
         | 
| 27 27 | 
             
                def manifest(m, root, project_name=nil)
         | 
| @@ -38,18 +38,20 @@ module Tap::Generator::Generators | |
| 38 38 | 
             
                      m.directory r[target]
         | 
| 39 39 | 
             
                      next
         | 
| 40 40 | 
             
                    when source =~ /gemspec$/
         | 
| 41 | 
            -
                      m.template r[project_name + '.gemspec'], source, :project_name => project_name, :config_file => config_file
         | 
| 41 | 
            +
                      m.template r[project_name + '.gemspec'], source, :project_name => project_name, :config_file => config_file, :license => license
         | 
| 42 42 | 
             
                      next
         | 
| 43 43 | 
             
                    when source =~ /Rapfile$/
         | 
| 44 44 | 
             
                      next unless rapfile
         | 
| 45 | 
            +
                    when source =~ /MIT-LICENSE$/
         | 
| 46 | 
            +
                      next unless license
         | 
| 45 47 | 
             
                    end
         | 
| 46 48 |  | 
| 47 | 
            -
                    m.template r[target], source, :project_name => project_name
         | 
| 49 | 
            +
                    m.template r[target], source, :project_name => project_name, :license => license
         | 
| 48 50 | 
             
                  end
         | 
| 49 51 |  | 
| 50 52 | 
             
                  m.file(r['tap.yml']) do |file|
         | 
| 51 | 
            -
                    Configurable::Utils.dump(Tap:: | 
| 52 | 
            -
                      default = delegate.default
         | 
| 53 | 
            +
                    Configurable::Utils.dump(Tap::Env.configurations, file) do |key, delegate|
         | 
| 54 | 
            +
                      default = delegate.default(false)
         | 
| 53 55 |  | 
| 54 56 | 
             
                      # get the description
         | 
| 55 57 | 
             
                      desc = delegate.attributes[:desc]
         | 
| @@ -57,13 +59,16 @@ module Tap::Generator::Generators | |
| 57 59 | 
             
                      doc = desc.comment if doc.empty?
         | 
| 58 60 |  | 
| 59 61 | 
             
                      # wrap as lines
         | 
| 60 | 
            -
                      lines = Lazydoc::Utils.wrap(doc,  | 
| 62 | 
            +
                      lines = Lazydoc::Utils.wrap(doc, 78).collect {|line| "# #{line}"}
         | 
| 61 63 | 
             
                      lines << "" unless lines.empty?
         | 
| 62 64 |  | 
| 65 | 
            +
                      # note: this causes order to be lost...
         | 
| 66 | 
            +
                      default = default.to_hash if delegate.is_nest?
         | 
| 67 | 
            +
             | 
| 63 68 | 
             
                      # setup formatting
         | 
| 64 69 | 
             
                      leader = key == 'root' || default == nil ? '# ' : ''
         | 
| 65 | 
            -
                      config = YAML.dump({key => default})[5..-1]
         | 
| 66 | 
            -
                      "#{lines.join("\n")}#{leader}#{config | 
| 70 | 
            +
                      config = YAML.dump({key => default})[5..-1].strip.gsub(/\n+/, "\n#{leader}")
         | 
| 71 | 
            +
                      "#{lines.join("\n")}#{leader}#{config}\n\n"
         | 
| 67 72 | 
             
                    end
         | 
| 68 73 | 
             
                  end if config_file
         | 
| 69 74 | 
             
                end
         | 
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            Copyright (c) <%= Time.now.year %>, <copyright holders>
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Permission is hereby granted, free of charge, to any person
         | 
| 4 | 
            +
            obtaining a copy of this software and associated documentation
         | 
| 5 | 
            +
            files (the "Software"), to deal in the Software without
         | 
| 6 | 
            +
            restriction, including without limitation the rights to use,
         | 
| 7 | 
            +
            copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 8 | 
            +
            copies of the Software, and to permit persons to whom the
         | 
| 9 | 
            +
            Software is furnished to do so, subject to the following
         | 
| 10 | 
            +
            conditions:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            The above copyright notice and this permission notice shall be
         | 
| 13 | 
            +
            included in all copies or substantial portions of the Software.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 16 | 
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
         | 
| 17 | 
            +
            OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 18 | 
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
         | 
| 19 | 
            +
            HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
         | 
| 20 | 
            +
            WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
         | 
| 21 | 
            +
            FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
         | 
| 22 | 
            +
            OTHER DEALINGS IN THE SOFTWARE.
         | 
| @@ -3,8 +3,6 @@ require 'rake/testtask' | |
| 3 3 | 
             
            require 'rake/rdoctask'
         | 
| 4 4 | 
             
            require 'rake/gempackagetask'
         | 
| 5 5 |  | 
| 6 | 
            -
            require 'tap/constants'
         | 
| 7 | 
            -
             | 
| 8 6 | 
             
            #
         | 
| 9 7 | 
             
            # Gem specification
         | 
| 10 8 | 
             
            #
         | 
| @@ -56,11 +54,11 @@ Rake::RDocTask.new(:rdoc) do |rdoc| | |
| 56 54 | 
             
              spec = gemspec
         | 
| 57 55 |  | 
| 58 56 | 
             
              rdoc.rdoc_dir = 'rdoc'
         | 
| 59 | 
            -
              rdoc. | 
| 60 | 
            -
              rdoc.main     = 'README'
         | 
| 61 | 
            -
              rdoc.options << '--line-numbers' << '--inline-source'
         | 
| 57 | 
            +
              rdoc.options.concat(spec.rdoc_options)
         | 
| 62 58 | 
             
              rdoc.rdoc_files.include( spec.extra_rdoc_files )
         | 
| 63 | 
            -
               | 
| 59 | 
            +
              
         | 
| 60 | 
            +
              files = spec.files.select {|file| file =~ /^lib.*\.rb$/}
         | 
| 61 | 
            +
              rdoc.rdoc_files.include( files )
         | 
| 64 62 |  | 
| 65 63 | 
             
              # Using CDoc to template your RDoc will result in configurations being
         | 
| 66 64 | 
             
              # listed with documentation in a subsection following attributes.  Not
         | 
| @@ -7,20 +7,20 @@ Gem::Specification.new do |s| | |
| 7 7 | 
             
              s.platform = Gem::Platform::RUBY
         | 
| 8 8 | 
             
              s.summary = "<%= project_name %>"
         | 
| 9 9 | 
             
              s.require_path = "lib"
         | 
| 10 | 
            -
              s.test_file = "test/tap_test_suite.rb"
         | 
| 11 10 | 
             
              #s.rubyforge_project = "<%= project_name %>"
         | 
| 12 | 
            -
              #s.has_rdoc = true
         | 
| 13 11 | 
             
              s.add_dependency("tap", "= <%= Tap::VERSION %>")
         | 
| 12 | 
            +
              s.has_rdoc = true
         | 
| 13 | 
            +
              s.rdoc_options.concat %W{--main README -S -N --title <%= project_name.capitalize %>}
         | 
| 14 14 |  | 
| 15 15 | 
             
              # list extra rdoc files here.
         | 
| 16 16 | 
             
              s.extra_rdoc_files = %W{
         | 
| 17 17 | 
             
                README
         | 
| 18 | 
            +
            <%= license ? "    MIT-LICENSE\n" : '' %>
         | 
| 18 19 | 
             
              }
         | 
| 19 20 |  | 
| 20 21 | 
             
              # list the files you want to include here. you can
         | 
| 21 22 | 
             
              # check this manifest using 'rake :print_manifest'
         | 
| 22 23 | 
             
              s.files = %W{
         | 
| 23 24 | 
             
            <%= config_file ? "    tap.yml\n" : '' %>
         | 
| 24 | 
            -
                test/tap_test_helper.rb
         | 
| 25 25 | 
             
              }
         | 
| 26 26 | 
             
            end
         | 
    
        data/lib/tap/task.rb
    CHANGED
    
    | @@ -168,10 +168,13 @@ module Tap | |
| 168 168 | 
             
                  # Same as parse, but removes switches destructively.
         | 
| 169 169 | 
             
                  def parse!(argv=ARGV, app=Tap::App.instance)
         | 
| 170 170 | 
             
                    opts = ConfigParser.new
         | 
| 171 | 
            -
                    opts.separator "configurations:"
         | 
| 172 | 
            -
                    opts.add(configurations)
         | 
| 173 171 |  | 
| 174 | 
            -
                     | 
| 172 | 
            +
                    unless configurations.empty?
         | 
| 173 | 
            +
                      opts.separator "configurations:"
         | 
| 174 | 
            +
                      opts.add(configurations)
         | 
| 175 | 
            +
                      opts.separator ""
         | 
| 176 | 
            +
                    end
         | 
| 177 | 
            +
                    
         | 
| 175 178 | 
             
                    opts.separator "options:"
         | 
| 176 179 |  | 
| 177 180 | 
             
                    # add option to print help
         | 
| @@ -390,8 +393,7 @@ module Tap | |
| 390 393 | 
             
                  #
         | 
| 391 394 | 
             
                  def define(name, baseclass=Tap::Task, configs={}, options={}, &block)
         | 
| 392 395 | 
             
                    # define the subclass
         | 
| 393 | 
            -
                     | 
| 394 | 
            -
                    subclass = const_set(const_name, Class.new(baseclass))
         | 
| 396 | 
            +
                    subclass = Class.new(baseclass)
         | 
| 395 397 | 
             
                    subclass.default_name = name.to_s
         | 
| 396 398 |  | 
| 397 399 | 
             
                    configs.each_pair do |key, value|
         | 
| @@ -409,7 +411,7 @@ module Tap | |
| 409 411 | 
             
                    options[:desc] ||= Lazydoc.register_caller(Lazydoc::Trailer, 1)
         | 
| 410 412 |  | 
| 411 413 | 
             
                    # add the configuration
         | 
| 412 | 
            -
                    nest(name, subclass,  | 
| 414 | 
            +
                    nest(name, subclass, {:const_name => name.to_s.camelize}.merge!(options))
         | 
| 413 415 | 
             
                  end
         | 
| 414 416 | 
             
                end
         | 
| 415 417 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: tap
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0.12. | 
| 4 | 
            +
              version: 0.12.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Simon Chiang
         | 
| @@ -9,7 +9,7 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2009- | 
| 12 | 
            +
            date: 2009-03-05 00:00:00 -07:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -20,7 +20,7 @@ dependencies: | |
| 20 20 | 
             
                requirements: 
         | 
| 21 21 | 
             
                - - ">="
         | 
| 22 22 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 23 | 
            -
                    version: 0. | 
| 23 | 
            +
                    version: 0.4.0
         | 
| 24 24 | 
             
                version: 
         | 
| 25 25 | 
             
            description: 
         | 
| 26 26 | 
             
            email: simon.a.chiang@gmail.com
         | 
| @@ -60,6 +60,7 @@ files: | |
| 60 60 | 
             
            - lib/tap/generator/generators/generator/templates/task.erb
         | 
| 61 61 | 
             
            - lib/tap/generator/generators/generator/templates/test.erb
         | 
| 62 62 | 
             
            - lib/tap/generator/generators/root/root_generator.rb
         | 
| 63 | 
            +
            - lib/tap/generator/generators/root/templates/MIT-LICENSE
         | 
| 63 64 | 
             
            - lib/tap/generator/generators/root/templates/README
         | 
| 64 65 | 
             
            - lib/tap/generator/generators/root/templates/Rakefile
         | 
| 65 66 | 
             
            - lib/tap/generator/generators/root/templates/Rapfile
         |