local_git_repo

in spec/support/git_helpers.rb [11:56]


      def local_git_repo(name, options = {})
        path = git_scratch
        Dir.chdir(path) do
          
          File.open("configure", "w") { |f| f.write('echo "Done!"') }

          git %{init .}
          git %{add .}
          git %{commit -am "Initial commit for #{name}..."}
          git %{remote add origin "#{options[:remote]}"} if options[:remote]
          git %{push origin master}

          if options[:annotated_tags]
            options[:annotated_tags].each do |tag|
              File.open("tag", "w") { |f| f.write(tag) }
              git %{add tag}
              git %{commit -am "Create tag #{tag}"}
              git %{tag "#{tag}" -m "#{tag}"}
              git %{push origin "#{tag}"} if options[:remote]
            end
          end

          if options[:tags]
            options[:tags].each do |tag|
              File.open("tag", "w") { |f| f.write(tag) }
              git %{add tag}
              git %{commit -am "Create tag #{tag}"}
              git %{tag "#{tag}"}
              git %{push origin "#{tag}"} if options[:remote]
            end
          end

          if options[:branches]
            options[:branches].each do |branch|
              git %{checkout -b 
              File.open("branch", "w") { |f| f.write(branch) }
              git %{add branch}
              git %{commit -am "Create branch #{branch}"}
              git %{push origin "#{branch}"} if options[:remote]
              git %{checkout master}
            end
          end
        end
        path
      end