madx-sergeant 0.0.0
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/README.textile +25 -0
 - data/Rakefile +12 -0
 - data/bin/sgt +32 -0
 - data/lib/sergeant.rb +31 -0
 - data/lib/sergeant/configuration.rb +5 -0
 - data/lib/sergeant/repository.rb +5 -0
 - metadata +59 -0
 
    
        data/README.textile
    ADDED
    
    | 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            h1. Sergeant
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Sergeant is a small tool that helps you managing the repositories you're 
         
     | 
| 
      
 4 
     | 
    
         
            +
            tracking. It's useful to run custom commands on a repo (updating, building gems,
         
     | 
| 
      
 5 
     | 
    
         
            +
            running (M|R)akefiles).
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Sergeant is SCM-agnostic so you can use it with Git, Mercurial or Subversion
         
     | 
| 
      
 8 
     | 
    
         
            +
            repositories without any worries. Actually, Sergeant is a generic tool so you
         
     | 
| 
      
 9 
     | 
    
         
            +
            can also use it to perform various tasks. 
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            h2. Install
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            <pre><code>
         
     | 
| 
      
 14 
     | 
    
         
            +
            $ sudo gem install madx-sergeant --source=http://gems.github.com/
         
     | 
| 
      
 15 
     | 
    
         
            +
            </code></pre>
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            or
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            <pre><code>
         
     | 
| 
      
 20 
     | 
    
         
            +
            $ cd your/repos/folder/
         
     | 
| 
      
 21 
     | 
    
         
            +
            $ git clone git://github.com/madx/sergeant.git
         
     | 
| 
      
 22 
     | 
    
         
            +
            $ cd sergeant; rake
         
     | 
| 
      
 23 
     | 
    
         
            +
            </code></pre>
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            And a fresh gem will be placed in the @pkg/@ folder.
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rake'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'rake/gempackagetask'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            SERGEANT_GEMSPEC = eval(File.read('ruacce.gemspec'))
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Rake::GemPackageTask.new(SERGEANT_GEMSPEC) do |pkg|
         
     | 
| 
      
 8 
     | 
    
         
            +
              pkg.need_tar_bz2 = true
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
            task :default => "pkg/#{SERGEANT_GEMSPEC.name}-#{SERGEANT_GEMSPEC.version}.gem" do
         
     | 
| 
      
 11 
     | 
    
         
            +
              puts "generated latest version"
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
    
        data/bin/sgt
    ADDED
    
    | 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../lib/sergeant'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            usage = <<-EOS
         
     | 
| 
      
 6 
     | 
    
         
            +
            Usage: sgt [options]
         
     | 
| 
      
 7 
     | 
    
         
            +
              See the README for some examples.
         
     | 
| 
      
 8 
     | 
    
         
            +
            EOS
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            opts = Trollop.options do
         
     | 
| 
      
 11 
     | 
    
         
            +
              banner usage
         
     | 
| 
      
 12 
     | 
    
         
            +
              text "\nRepositories: "
         
     | 
| 
      
 13 
     | 
    
         
            +
              opt :select,    "Select repositories (* acts as wildcard)", :type => String
         
     | 
| 
      
 14 
     | 
    
         
            +
              opt :add_repo,  "Add a repository to Sergeant config file", :type => String
         
     | 
| 
      
 15 
     | 
    
         
            +
              opt :list,      "List all handled repositories and their rules (must be used alone)"
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
      
 17 
     | 
    
         
            +
              text "\nRules:"
         
     | 
| 
      
 18 
     | 
    
         
            +
              opt :rule,      "Select the rule to apply",           :type => String
         
     | 
| 
      
 19 
     | 
    
         
            +
              opt :add_rule,  "Add a rule with the specified name", :type => String, :short => 'R'
         
     | 
| 
      
 20 
     | 
    
         
            +
              
         
     | 
| 
      
 21 
     | 
    
         
            +
              text "\nGrouping:"
         
     | 
| 
      
 22 
     | 
    
         
            +
              opt :group,     "Select a group of repos", :type => String
         
     | 
| 
      
 23 
     | 
    
         
            +
              opt :add_group, "Add a group of repos",    :type => String, :short => 'G'
         
     | 
| 
      
 24 
     | 
    
         
            +
              
         
     | 
| 
      
 25 
     | 
    
         
            +
              text "\nCommon options:"
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            if opts[:rule] != nil && (opts[:select].nil? || opts[:group].nil?) 
         
     | 
| 
      
 29 
     | 
    
         
            +
              Trollop.die :rule, "need at least a repo or a group to be selected"
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            p opts
         
     | 
    
        data/lib/sergeant.rb
    ADDED
    
    | 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            dir = File.dirname(__FILE__)
         
     | 
| 
      
 5 
     | 
    
         
            +
            $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require 'trollop'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'sergeant/configuration'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'sergeant/repository'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            module Sergeant
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              RULES_FILE = ".sgtrc"
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              module Formats
         
     | 
| 
      
 16 
     | 
    
         
            +
                def self.included(parent)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  { :o => "33", :p => "35", :g => "32", :r => "1;31", :w => "1;37"}.
         
     | 
| 
      
 18 
     | 
    
         
            +
                  each do |meth, color|
         
     | 
| 
      
 19 
     | 
    
         
            +
                    parent.class_eval { define_method(meth) { "\e[#{color}m#{self}\e[00m" } }
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                  parent.class_eval do 
         
     | 
| 
      
 22 
     | 
    
         
            +
                    define_method(:i) do 
         
     | 
| 
      
 23 
     | 
    
         
            +
                      self.ljust(78).split("\n").collect{|l| "  #{l}"}.join("\n")
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              String.send(:include, Formats)
         
     | 
| 
      
 30 
     | 
    
         
            +
              
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: madx-sergeant
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 7 
     | 
    
         
            +
            - "Fran\xC3\xA7ois Vaux"
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2008-07-08 00:00:00 -07:00
         
     | 
| 
      
 13 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 14 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            description: Sergeant is a small tool that helps you managing the repositories you're  tracking. It's useful to run custom commands on a repo (updating, building gems, running (M|R)akefiles).
         
     | 
| 
      
 17 
     | 
    
         
            +
            email: root+sergeant@yapok.org
         
     | 
| 
      
 18 
     | 
    
         
            +
            executables: 
         
     | 
| 
      
 19 
     | 
    
         
            +
            - sgt
         
     | 
| 
      
 20 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 25 
     | 
    
         
            +
            - lib/sergeant.rb
         
     | 
| 
      
 26 
     | 
    
         
            +
            - lib/sergeant/configuration.rb
         
     | 
| 
      
 27 
     | 
    
         
            +
            - lib/sergeant/repository.rb
         
     | 
| 
      
 28 
     | 
    
         
            +
            - bin/sergeant
         
     | 
| 
      
 29 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 30 
     | 
    
         
            +
            - README.textile
         
     | 
| 
      
 31 
     | 
    
         
            +
            - VERSION
         
     | 
| 
      
 32 
     | 
    
         
            +
            has_rdoc: false
         
     | 
| 
      
 33 
     | 
    
         
            +
            homepage: http://yapok.org/
         
     | 
| 
      
 34 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 35 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 38 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 39 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 40 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 41 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 42 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 43 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 44 
     | 
    
         
            +
              version: 
         
     | 
| 
      
 45 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 46 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 47 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 48 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 49 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 50 
     | 
    
         
            +
              version: 
         
     | 
| 
      
 51 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 54 
     | 
    
         
            +
            rubygems_version: 1.2.0
         
     | 
| 
      
 55 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 56 
     | 
    
         
            +
            specification_version: 2
         
     | 
| 
      
 57 
     | 
    
         
            +
            summary: A small tool to help you manage your repositories
         
     | 
| 
      
 58 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     |