gitomator 0.1.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.
- checksums.yaml +7 -0
 - data/.gitignore +57 -0
 - data/.ruby-gemset +1 -0
 - data/.ruby-version +1 -0
 - data/Gemfile +13 -0
 - data/LICENSE.txt +21 -0
 - data/README.md +194 -0
 - data/Rakefile +9 -0
 - data/bin/gitomator-clone-repos +21 -0
 - data/bin/gitomator-console +19 -0
 - data/bin/gitomator-disable-ci +24 -0
 - data/bin/gitomator-enable-ci +24 -0
 - data/bin/gitomator-make-access-permissions +72 -0
 - data/bin/gitomator-make-repos +45 -0
 - data/bin/gitomator-make-teams +20 -0
 - data/bin/setup +8 -0
 - data/gitomator.gemspec +28 -0
 - data/lib/gitomator/console.rb +54 -0
 - data/lib/gitomator/context.rb +132 -0
 - data/lib/gitomator/exceptions.rb +21 -0
 - data/lib/gitomator/service/ci.rb +35 -0
 - data/lib/gitomator/service/git.rb +48 -0
 - data/lib/gitomator/service/hosting.rb +204 -0
 - data/lib/gitomator/service/tagging.rb +99 -0
 - data/lib/gitomator/service.rb +64 -0
 - data/lib/gitomator/service_provider/git_shell.rb +68 -0
 - data/lib/gitomator/service_provider/hosting_local.rb +103 -0
 - data/lib/gitomator/task/base_repos_task.rb +88 -0
 - data/lib/gitomator/task/clone_repos.rb +61 -0
 - data/lib/gitomator/task/config/repos_config.rb +117 -0
 - data/lib/gitomator/task/config/team_config.rb +57 -0
 - data/lib/gitomator/task/enable_disable_ci.rb +56 -0
 - data/lib/gitomator/task/make_repos.rb +86 -0
 - data/lib/gitomator/task/setup_team.rb +63 -0
 - data/lib/gitomator/task/update_repo_access_permissions.rb +42 -0
 - data/lib/gitomator/task.rb +48 -0
 - data/lib/gitomator/util/repo/name_resolver.rb +68 -0
 - data/lib/gitomator/util/script_util.rb +69 -0
 - data/lib/gitomator/version.rb +3 -0
 - data/lib/gitomator.rb +61 -0
 - metadata +173 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 71e6ba35da4ab95a835b16f67535443c5eaaf502
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e8bfe6312b250b290b6343fc7305060e651cd96b
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: d45742b74bbfc30a3d48f3c34b9d9c20bb6c54acfc6e12b08954cc8166c592aedf1e23cc53a009b57e63f211b8140392a83229768472804823f9449ef7d3a06a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6dff541ca6ecb893860ac76b40deba5367d24e958a7b4a96d1f0383ceb367c6314fda4d0f04e9d7b15f57f79ddd63ba6c64ff4373a9209c7589368a5f4b9cb78
         
     | 
    
        data/.gitignore
    ADDED
    
    | 
         @@ -0,0 +1,57 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            # Created by https://www.gitignore.io/api/ruby
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            ### Ruby ###
         
     | 
| 
      
 5 
     | 
    
         
            +
            *.gem
         
     | 
| 
      
 6 
     | 
    
         
            +
            *.rbc
         
     | 
| 
      
 7 
     | 
    
         
            +
            /.config
         
     | 
| 
      
 8 
     | 
    
         
            +
            /coverage/
         
     | 
| 
      
 9 
     | 
    
         
            +
            /InstalledFiles
         
     | 
| 
      
 10 
     | 
    
         
            +
            /pkg/
         
     | 
| 
      
 11 
     | 
    
         
            +
            /spec/reports/
         
     | 
| 
      
 12 
     | 
    
         
            +
            /spec/examples.txt
         
     | 
| 
      
 13 
     | 
    
         
            +
            /test/tmp/
         
     | 
| 
      
 14 
     | 
    
         
            +
            /test/version_tmp/
         
     | 
| 
      
 15 
     | 
    
         
            +
            /tmp/
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            # Used by dotenv library to load environment variables.
         
     | 
| 
      
 18 
     | 
    
         
            +
            # .env
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ## Specific to RubyMotion:
         
     | 
| 
      
 21 
     | 
    
         
            +
            .dat*
         
     | 
| 
      
 22 
     | 
    
         
            +
            .repl_history
         
     | 
| 
      
 23 
     | 
    
         
            +
            build/
         
     | 
| 
      
 24 
     | 
    
         
            +
            *.bridgesupport
         
     | 
| 
      
 25 
     | 
    
         
            +
            build-iPhoneOS/
         
     | 
| 
      
 26 
     | 
    
         
            +
            build-iPhoneSimulator/
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            ## Specific to RubyMotion (use of CocoaPods):
         
     | 
| 
      
 29 
     | 
    
         
            +
            #
         
     | 
| 
      
 30 
     | 
    
         
            +
            # We recommend against adding the Pods directory to your .gitignore. However
         
     | 
| 
      
 31 
     | 
    
         
            +
            # you should judge for yourself, the pros and cons are mentioned at:
         
     | 
| 
      
 32 
     | 
    
         
            +
            # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
         
     | 
| 
      
 33 
     | 
    
         
            +
            #
         
     | 
| 
      
 34 
     | 
    
         
            +
            # vendor/Pods/
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            ## Documentation cache and generated files:
         
     | 
| 
      
 37 
     | 
    
         
            +
            /.yardoc/
         
     | 
| 
      
 38 
     | 
    
         
            +
            /_yardoc/
         
     | 
| 
      
 39 
     | 
    
         
            +
            /doc/
         
     | 
| 
      
 40 
     | 
    
         
            +
            /rdoc/
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            ## Environment normalization:
         
     | 
| 
      
 43 
     | 
    
         
            +
            /.bundle/
         
     | 
| 
      
 44 
     | 
    
         
            +
            /vendor/bundle
         
     | 
| 
      
 45 
     | 
    
         
            +
            /lib/bundler/man/
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            # for a library or gem, you might want to ignore these files since the code is
         
     | 
| 
      
 48 
     | 
    
         
            +
            # intended to run in multiple environments; otherwise, check them in:
         
     | 
| 
      
 49 
     | 
    
         
            +
            Gemfile.lock
         
     | 
| 
      
 50 
     | 
    
         
            +
            .ruby-version
         
     | 
| 
      
 51 
     | 
    
         
            +
            .ruby-gemset
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
         
     | 
| 
      
 54 
     | 
    
         
            +
            .rvmrc
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            # End of https://www.gitignore.io/api/ruby
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
    
        data/.ruby-gemset
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            gitomator
         
     | 
    
        data/.ruby-version
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ruby-2.2.2
         
     | 
    
        data/Gemfile
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            source 'https://rubygems.org'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Specify your gem's dependencies in gitomator.gemspec
         
     | 
| 
      
 4 
     | 
    
         
            +
            gemspec
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            #
         
     | 
| 
      
 7 
     | 
    
         
            +
            # FIXME: The whole point is to be able to plug-in different providers (where the
         
     | 
| 
      
 8 
     | 
    
         
            +
            #    core project is light, and doesn't know/care/depends on any specific provider).
         
     | 
| 
      
 9 
     | 
    
         
            +
            #    I still don't know of a clean way to do that in Ruby, so for now let's add
         
     | 
| 
      
 10 
     | 
    
         
            +
            #    gitomator-github and gitomator-travis as dependencies...
         
     | 
| 
      
 11 
     | 
    
         
            +
            #
         
     | 
| 
      
 12 
     | 
    
         
            +
            gem 'gitomator-github', :git => 'git@github.com:Gitomator/gitomator-github.git'
         
     | 
| 
      
 13 
     | 
    
         
            +
            gem 'gitomator-travis', :git => 'git@github.com:Gitomator/gitomator-travis.git'
         
     | 
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2016 Joey Freund
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 13 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 21 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,194 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Gitomator
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            _Gitomator_ is a set of command-line tools for batch operations on hosted Git repositories.      
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            It was built to help software educators use tools like [GitHub](https://github.com) or [Travis CI](http://travis-ci.com) in their classroom, and here are some of the tasks it can help you with:
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
             * Create, clone and update repos
         
     | 
| 
      
 8 
     | 
    
         
            +
             * Create teams and update team memberships
         
     | 
| 
      
 9 
     | 
    
         
            +
             * Set access permissions
         
     | 
| 
      
 10 
     | 
    
         
            +
             * Enable/disable CI
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            Think of Gitomator as a _Swiss army knife for your GitHub organization_.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ## Dependencies
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             * [Ruby](https://www.ruby-lang.org/en/downloads/) (Gitomator is developed and tested on version 2.2)
         
     | 
| 
      
 18 
     | 
    
         
            +
             * [Ruby Gems](https://rubygems.org/pages/download)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 24 
     | 
    
         
            +
            gem install gitomator
         
     | 
| 
      
 25 
     | 
    
         
            +
            ```
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            ## Configure Credentials
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            Create the `.gitomator` configuration file *in your home directory* with your credential information:
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 33 
     | 
    
         
            +
            hosting:
         
     | 
| 
      
 34 
     | 
    
         
            +
              provider: github
         
     | 
| 
      
 35 
     | 
    
         
            +
              access_token: YOUR-GITHUB-ACCESS-TOKEN
         
     | 
| 
      
 36 
     | 
    
         
            +
              organization: YOUR-GITHUB-ORGANIZATION
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            ci:
         
     | 
| 
      
 39 
     | 
    
         
            +
              provider: travis_pro
         
     | 
| 
      
 40 
     | 
    
         
            +
              access_token: YOUR-TRAVIS-CI-ACCESS-TOKEN
         
     | 
| 
      
 41 
     | 
    
         
            +
              github_organization: YOUR-GITHUB-ORGANIZATION
         
     | 
| 
      
 42 
     | 
    
         
            +
            ```
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
             >  * You can read more about how to [create an access token on GitHub](https://github.com/blog/1509-personal-api-tokens).
         
     | 
| 
      
 45 
     | 
    
         
            +
             >  * If you don't use Travis CI, feel free to omit the `ci` configuration
         
     | 
| 
      
 46 
     | 
    
         
            +
             >  * You can specify a different path (other than `~/.gitomator`) for you configuration file, by setting the `GITOMATOR_CONTEXT` environment variable.
         
     | 
| 
      
 47 
     | 
    
         
            +
             >  * **Important:** Keep your credentials safe!      
         
     | 
| 
      
 48 
     | 
    
         
            +
                  The `.gitomator` file is local to your machine, and should *not* be committed to version control.
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            ## Examples
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            Let's see a few basic usage examples.
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            ### Create repos
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            You can create a bunch of empty repos in your organization, by creating the following [YAML](https://en.wikipedia.org/wiki/YAML) file:
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 59 
     | 
    
         
            +
            repos:
         
     | 
| 
      
 60 
     | 
    
         
            +
             - repo_01
         
     | 
| 
      
 61 
     | 
    
         
            +
             - repo_02
         
     | 
| 
      
 62 
     | 
    
         
            +
             - repo_03
         
     | 
| 
      
 63 
     | 
    
         
            +
            ```
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            And running the following command:
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 68 
     | 
    
         
            +
            gitomator-make-repos PATH-TO-YAML-FILE
         
     | 
| 
      
 69 
     | 
    
         
            +
            ```
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
             > You can change the YAML file and re-run the `gitomator-make-repos`, Gitomator will create repos that are missing.
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            If you want the repos to be created with initial starter code, you could add the `source_repo` field to the YAML file:
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 77 
     | 
    
         
            +
            source_repo: name_of_some_repo_in_your_organization
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            repos:
         
     | 
| 
      
 80 
     | 
    
         
            +
             - repo_01
         
     | 
| 
      
 81 
     | 
    
         
            +
             - repo_02
         
     | 
| 
      
 82 
     | 
    
         
            +
             - repo_03
         
     | 
| 
      
 83 
     | 
    
         
            +
            ```
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
             > * When Gitomator creates the repositories, it will push all the commits from the specified repo.
         
     | 
| 
      
 86 
     | 
    
         
            +
             > * If you are new to GitHub you may want to read about [the difference between forking and cloning-then-pushing](https://education.github.com/guide/repository_setup).
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            You can also specify various properties of created repositories, by adding the `repo_properties` field to the YAML file:
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 92 
     | 
    
         
            +
            source_repo: name_of_some_repo_in_your_organization
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            repo_properties:
         
     | 
| 
      
 95 
     | 
    
         
            +
              description: "A short description"
         
     | 
| 
      
 96 
     | 
    
         
            +
              homepage: "http://example.com"
         
     | 
| 
      
 97 
     | 
    
         
            +
              private: true
         
     | 
| 
      
 98 
     | 
    
         
            +
              has_issues: true
         
     | 
| 
      
 99 
     | 
    
         
            +
              has_wiki: false
         
     | 
| 
      
 100 
     | 
    
         
            +
              has_downloads: false
         
     | 
| 
      
 101 
     | 
    
         
            +
              default_branch: master
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
            repos:
         
     | 
| 
      
 104 
     | 
    
         
            +
             - repo_01
         
     | 
| 
      
 105 
     | 
    
         
            +
             - repo_02
         
     | 
| 
      
 106 
     | 
    
         
            +
             - repo_03
         
     | 
| 
      
 107 
     | 
    
         
            +
            ```
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
            ### Update repos
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            You can update repos by updating the source repo (i.e. the repo that contains the starter code) and then run `gitomator-make-repos` with the `-u` option:
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 114 
     | 
    
         
            +
            gitomator-make-repos -u PATH-TO-YAML-FILE
         
     | 
| 
      
 115 
     | 
    
         
            +
            ```
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
             > * Such a batch update is only possible when all repos have the same commit history.
         
     | 
| 
      
 118 
     | 
    
         
            +
             > * You can run `gitomator-make-repos` with `--help` for more information.
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
            ### Manage Access Permissions
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
            You can specify who gets which permission to which repo in (the `repos` section
         
     | 
| 
      
 124 
     | 
    
         
            +
            of) the same YAML file we've been using:
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 127 
     | 
    
         
            +
            repos:
         
     | 
| 
      
 128 
     | 
    
         
            +
             - repo_01 : user_01
         
     | 
| 
      
 129 
     | 
    
         
            +
             - repo_02 : user_02
         
     | 
| 
      
 130 
     | 
    
         
            +
             - repo_03 : [user_03, user_04]
         
     | 
| 
      
 131 
     | 
    
         
            +
            ```
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            And run:
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 136 
     | 
    
         
            +
            gitomator-make-access-permissions PATH-TO-YAML-FILE
         
     | 
| 
      
 137 
     | 
    
         
            +
            ```
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
            #### Users vs. Teams
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
            You can use the `-p` option to specify whether the names in the YAML files refer
         
     | 
| 
      
 142 
     | 
    
         
            +
            to users or teams. The following values are accepted:
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
             * `user`  - Names in the YAML file refer to users (this is the default)
         
     | 
| 
      
 145 
     | 
    
         
            +
             * `team`  - Names in the YAML file refer to teams
         
     | 
| 
      
 146 
     | 
    
         
            +
             * `mixed` - Let Gitomator figure out which name refers to a team and which refers to a user.
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
            #### Read vs. Write
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
            By default, Gitomator gives the specified users/teams read permission,
         
     | 
| 
      
 152 
     | 
    
         
            +
            but you can specify otherwise in the YAML file:
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 155 
     | 
    
         
            +
            repos:
         
     | 
| 
      
 156 
     | 
    
         
            +
             - repo_01 : {user_01: write}
         
     | 
| 
      
 157 
     | 
    
         
            +
             - repo_02 : [{user_02: write}, user_07]
         
     | 
| 
      
 158 
     | 
    
         
            +
             - repo_03 : [team_01, {admin_01: write}]
         
     | 
| 
      
 159 
     | 
    
         
            +
            ```
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
            ### Clone repos
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
            You can clone repos to your local machine using the `gitomator-clone-repos` command:
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 167 
     | 
    
         
            +
            gitomator-clone-repos PATH-TO-YAML-FILE LOCAL-DIR
         
     | 
| 
      
 168 
     | 
    
         
            +
            ```
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
             > The YAML file has the same format as expected by the `gitomator-clone-repos` command.
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
            ### Manage teams
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
            You can create teams and update team memberships with the `gitomator-make-teams` command,
         
     | 
| 
      
 176 
     | 
    
         
            +
            which takes a YAML of the following format:
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 179 
     | 
    
         
            +
            team_01:
         
     | 
| 
      
 180 
     | 
    
         
            +
             - user_01
         
     | 
| 
      
 181 
     | 
    
         
            +
             - user_02
         
     | 
| 
      
 182 
     | 
    
         
            +
             - user_03
         
     | 
| 
      
 183 
     | 
    
         
            +
             
     | 
| 
      
 184 
     | 
    
         
            +
            team_02:
         
     | 
| 
      
 185 
     | 
    
         
            +
             - user_01
         
     | 
| 
      
 186 
     | 
    
         
            +
             - user_07
         
     | 
| 
      
 187 
     | 
    
         
            +
            ```
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
            When you run `gitomator-make-teams`, Gitomator will:
         
     | 
| 
      
 190 
     | 
    
         
            +
             * Create all missing teams (in your GitHub organization)
         
     | 
| 
      
 191 
     | 
    
         
            +
             * Add all missing team memberships
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
             > Users who are not yet members of your GitHub organization, will automatically
         
     | 
| 
      
 194 
     | 
    
         
            +
               get an email invite to join.
         
     | 
    
        data/Rakefile
    ADDED
    
    
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'gitomator/util/script_util'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'gitomator/context'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'gitomator/task/clone_repos'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'gitomator/task/config/repos_config'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            usage_message  = "Usage: #{File.basename($0)} REPOS-CONFING LOCAL-DIR"
         
     | 
| 
      
 10 
     | 
    
         
            +
            opts = Gitomator::ScriptUtil::DefaultOptionParser.new(usage_message).parse(ARGV)
         
     | 
| 
      
 11 
     | 
    
         
            +
            abort usage_message if ARGV.length != 2
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            context     = Gitomator::Context.from_file(opts[:context])
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            config_hash = Gitomator::Util.load_config(ARGV[0])
         
     | 
| 
      
 16 
     | 
    
         
            +
            task_config = Gitomator::Task::Config::ReposConfig.new(config_hash)
         
     | 
| 
      
 17 
     | 
    
         
            +
            local_dir   = ARGV[1]
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            Gitomator::ScriptUtil::run_task(
         
     | 
| 
      
 20 
     | 
    
         
            +
              Gitomator::Task::CloneRepos.new(context, task_config.repos, local_dir)
         
     | 
| 
      
 21 
     | 
    
         
            +
            )
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'gitomator/util/script_util'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'gitomator/console'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'gitomator/context'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'irb'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            usage_message  = "Usage: #{File.basename($0)}"
         
     | 
| 
      
 10 
     | 
    
         
            +
            opts = Gitomator::ScriptUtil::DefaultOptionParser.new(usage_message).parse(ARGV)
         
     | 
| 
      
 11 
     | 
    
         
            +
            abort usage_message if ARGV.length != 0
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            Gitomator::Console::context = Gitomator::Context.from_file(opts[:context])
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            include Gitomator::Console
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            IRB.start
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'gitomator/util/script_util'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'gitomator/context'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'gitomator/task/enable_disable_ci'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'gitomator/task/config/repos_config'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            usage_message  = "Usage: #{File.basename($0)} REPOS-CONFING"
         
     | 
| 
      
 10 
     | 
    
         
            +
            parser = Gitomator::ScriptUtil::DefaultOptionParser.new(usage_message)
         
     | 
| 
      
 11 
     | 
    
         
            +
            parser.opt(:sync, "Synchronize the CI service.")
         
     | 
| 
      
 12 
     | 
    
         
            +
            opts = parser.parse(ARGV)
         
     | 
| 
      
 13 
     | 
    
         
            +
            abort usage_message if ARGV.length != 1
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            context = Gitomator::Context.from_file(opts[:context])
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            config_hash  = Gitomator::Util.load_config(ARGV[0])
         
     | 
| 
      
 18 
     | 
    
         
            +
            repos_config = Gitomator::Task::Config::ReposConfig.new(config_hash)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            task_opts = { :sync => opts[:sync] }
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            Gitomator::ScriptUtil::run_task(
         
     | 
| 
      
 23 
     | 
    
         
            +
              Gitomator::Task::DisableCI.new(context, repos_config.repos, task_opts)
         
     | 
| 
      
 24 
     | 
    
         
            +
            )
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'gitomator/util/script_util'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'gitomator/context'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'gitomator/task/enable_disable_ci'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'gitomator/task/config/repos_config'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            usage_message  = "Usage: #{File.basename($0)} REPOS-CONFING"
         
     | 
| 
      
 10 
     | 
    
         
            +
            parser = Gitomator::ScriptUtil::DefaultOptionParser.new(usage_message)
         
     | 
| 
      
 11 
     | 
    
         
            +
            parser.opt(:sync, "Synchronize the CI service.")
         
     | 
| 
      
 12 
     | 
    
         
            +
            opts = parser.parse(ARGV)
         
     | 
| 
      
 13 
     | 
    
         
            +
            abort usage_message if ARGV.length != 1
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            context = Gitomator::Context.from_file(opts[:context])
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            config_hash  = Gitomator::Util.load_config(ARGV[0])
         
     | 
| 
      
 18 
     | 
    
         
            +
            repos_config = Gitomator::Task::Config::ReposConfig.new(config_hash)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            task_opts = { :sync => opts[:sync] }
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            Gitomator::ScriptUtil::run_task(
         
     | 
| 
      
 23 
     | 
    
         
            +
              Gitomator::Task::EnableCI.new(context, repos_config.repos, task_opts)
         
     | 
| 
      
 24 
     | 
    
         
            +
            )
         
     | 
| 
         @@ -0,0 +1,72 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'gitomator/util/script_util'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'gitomator/context'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'gitomator/task/update_repo_access_permissions'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'gitomator/task/config/repos_config'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            usage_message  = "Usage: #{File.basename($0)} REPOS-CONFING"
         
     | 
| 
      
 10 
     | 
    
         
            +
            banner = <<-EOS
         
     | 
| 
      
 11 
     | 
    
         
            +
            Command-line tool to update access permissions (who gets what access-permission to which repos).
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              #{usage_message}
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            EOS
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            parser = Gitomator::ScriptUtil::DefaultOptionParser.new(banner)
         
     | 
| 
      
 18 
     | 
    
         
            +
            parser.opt :permission_type,
         
     | 
| 
      
 19 
     | 
    
         
            +
              "One of 'user', 'team' or 'mixed'.\nIndicates whether the names in the " +
         
     | 
| 
      
 20 
     | 
    
         
            +
              "configuration files are usernames, team names, or a mix of both " +
         
     | 
| 
      
 21 
     | 
    
         
            +
              "(in which case the script will first look for team with the specified name).",
         
     | 
| 
      
 22 
     | 
    
         
            +
              :default => 'user'
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            opts = parser.parse(ARGV)
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            parser.die :type, "Type must be one of 'user', 'team' or 'mixed'" unless ['user','team','mixed'].include? opts[:permission_type]
         
     | 
| 
      
 27 
     | 
    
         
            +
            abort usage_message if ARGV.length != 1
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            context     = Gitomator::Context.from_file(opts[:context])
         
     | 
| 
      
 32 
     | 
    
         
            +
            config_hash = Gitomator::Util.load_config(ARGV[0])
         
     | 
| 
      
 33 
     | 
    
         
            +
            task_config = Gitomator::Task::Config::ReposConfig.new(config_hash)
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            #-------------------------------------------------------------------------------
         
     | 
| 
      
 36 
     | 
    
         
            +
            # Actual script ...
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            tasks = []
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            # If the permission is mixed, we should cache all team names
         
     | 
| 
      
 41 
     | 
    
         
            +
            # For every name we encounter, we will check if it's a team's name.
         
     | 
| 
      
 42 
     | 
    
         
            +
            team_names = nil
         
     | 
| 
      
 43 
     | 
    
         
            +
            if opts[:permission_type] == 'mixed'
         
     | 
| 
      
 44 
     | 
    
         
            +
              team_names = context.hosting.search_teams('').map {|t| t.name}
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            task_config.repos.each do |repo|
         
     | 
| 
      
 49 
     | 
    
         
            +
              user2permission = {}
         
     | 
| 
      
 50 
     | 
    
         
            +
              team2permission = {}
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
              # The names in the assignment config might be usernames, team names, or a mix of both.
         
     | 
| 
      
 53 
     | 
    
         
            +
              case opts[:permission_type]
         
     | 
| 
      
 54 
     | 
    
         
            +
              when 'user'
         
     | 
| 
      
 55 
     | 
    
         
            +
                user2permission = task_config.permissions(repo)
         
     | 
| 
      
 56 
     | 
    
         
            +
              when 'team'
         
     | 
| 
      
 57 
     | 
    
         
            +
                team2permission = task_config.permissions(repo)
         
     | 
| 
      
 58 
     | 
    
         
            +
              when 'mixed'
         
     | 
| 
      
 59 
     | 
    
         
            +
                task_config.permissions(repo).each do |name, permission|
         
     | 
| 
      
 60 
     | 
    
         
            +
                  if team_names.include? name
         
     | 
| 
      
 61 
     | 
    
         
            +
                    team2permission[name] = permission
         
     | 
| 
      
 62 
     | 
    
         
            +
                  else
         
     | 
| 
      
 63 
     | 
    
         
            +
                    user2permission[name] = permission
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
              tasks.push Gitomator::Task::UpdateRepoAccessPermissions.new(
         
     | 
| 
      
 69 
     | 
    
         
            +
                                          context, repo, user2permission, team2permission)
         
     | 
| 
      
 70 
     | 
    
         
            +
            end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            Gitomator::ScriptUtil::run_tasks(tasks)
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'gitomator/util/script_util'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'gitomator/context'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'gitomator/task/make_repos'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'gitomator/task/config/repos_config'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            usage_message  = "Usage: #{File.basename($0)} REPOS-CONFING"
         
     | 
| 
      
 10 
     | 
    
         
            +
            banner = <<-EOS
         
     | 
| 
      
 11 
     | 
    
         
            +
            Command-line tool to create repos based on a configuration file.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              #{usage_message}
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Repos can be created empty, or based on an existing source_repo (specified in the configuration file).
         
     | 
| 
      
 16 
     | 
    
         
            +
            EOS
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            parser = Gitomator::ScriptUtil::DefaultOptionParser.new(banner)
         
     | 
| 
      
 19 
     | 
    
         
            +
            parser.opt :update_existing,
         
     | 
| 
      
 20 
     | 
    
         
            +
                "Update existing repos by pushing recent changes from the source_repo",
         
     | 
| 
      
 21 
     | 
    
         
            +
                :default => false
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            opts = parser.parse(ARGV)
         
     | 
| 
      
 24 
     | 
    
         
            +
            abort usage_message if ARGV.length != 1
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            context     = Gitomator::Context.from_file(opts[:context])
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            config_hash = Gitomator::Util.load_config(ARGV[0])
         
     | 
| 
      
 29 
     | 
    
         
            +
            task_config = Gitomator::Task::Config::ReposConfig.new(config_hash)
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            task_opts = {}
         
     | 
| 
      
 32 
     | 
    
         
            +
            if task_config.source_repo
         
     | 
| 
      
 33 
     | 
    
         
            +
              task_opts[:source_repo] = task_config.source_repo
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
      
 35 
     | 
    
         
            +
            if task_config.repo_properties
         
     | 
| 
      
 36 
     | 
    
         
            +
              task_opts[:repo_properties] = task_config.repo_properties.map {|k,v| [k.to_sym,v]} .to_h
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
| 
      
 38 
     | 
    
         
            +
            if opts[:update_existing]
         
     | 
| 
      
 39 
     | 
    
         
            +
              task_opts[:update_existing] = true
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            Gitomator::ScriptUtil::run_task(
         
     | 
| 
      
 44 
     | 
    
         
            +
              Gitomator::Task::MakeRepos.new(context, task_config.repos, task_opts)
         
     | 
| 
      
 45 
     | 
    
         
            +
            )
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'gitomator/util/script_util'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'gitomator/context'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'gitomator/task/setup_team'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'gitomator/task/config/team_config'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            usage_message  = "Usage: #{File.basename($0)} TEAMS-CONFING"
         
     | 
| 
      
 10 
     | 
    
         
            +
            opts = Gitomator::ScriptUtil::DefaultOptionParser.new(usage_message).parse(ARGV)
         
     | 
| 
      
 11 
     | 
    
         
            +
            abort usage_message if ARGV.length != 1
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            context     = Gitomator::Context.from_file(opts[:context])
         
     | 
| 
      
 14 
     | 
    
         
            +
            config_hash = Gitomator::Util.load_config(ARGV[0])
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            Gitomator::Task::Config::TeamConfig::from_hash(config_hash).each do |team|
         
     | 
| 
      
 17 
     | 
    
         
            +
              Gitomator::ScriptUtil::run_task(
         
     | 
| 
      
 18 
     | 
    
         
            +
                Gitomator::Task::SetupTeam.new(context, team.name, team.members)
         
     | 
| 
      
 19 
     | 
    
         
            +
              )
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
    
        data/bin/setup
    ADDED
    
    
    
        data/gitomator.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'gitomator/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "gitomator"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = Gitomator::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["Joey Freund"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["joeyfreund@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = "Automation tools for Git repo  organizations."
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.homepage      = "https://github.com/gitomator/gitomator"
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.bindir        = "bin"
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.11"
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency "rspec"
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_runtime_dependency 'trollop', '~> 2.1', '>= 2.1.2'
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_runtime_dependency 'logger', '~> 1.2', '>= 1.2.8'
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "gitomator/version"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Gitomator
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Console
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def self.context=(context)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @context = context
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def self.context()
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @context
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                # ====================== Convenience Console Functions =====================
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                def gitomator_version
         
     | 
| 
      
 18 
     | 
    
         
            +
                  Gitomator::VERSION
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                def gitomator_context
         
     | 
| 
      
 22 
     | 
    
         
            +
                  Gitomator::Console::context
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                # --------------------------------------------------------------------------
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                def search_repos(query)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  gitomator_context.hosting.search_repos(query).map {|r| r.full_name}
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                def delete_repo(repo_name)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  gitomator_context.hosting.delete_repo(repo_name)
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                def search_teams(query)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  gitomator_context.hosting.search_teams(query).map {|t| t.name}
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                def delete_team(team_name)
         
     | 
| 
      
 43 
     | 
    
         
            +
                  gitomator_context.hosting.delete_team(team_name)
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                def list_team_members(team_name)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  gitomator_context.hosting
         
     | 
| 
      
 49 
     | 
    
         
            +
                    .search_users('', { team_name: team_name }).map {|u| u.username}
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     |