mantis 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTNkMmU1MmE2NWQzMDkxNjQ0ODQ2NDJiYzBmNjFjOTY2M2ZmNzJhOQ==
5
+ data.tar.gz: !binary |-
6
+ YWQ3ODQzNzAzNDZiMTZiZWQ0NTA2MGJiZmI4ZTU3ZDk0ODE5OGM0Mw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ Y2M2ZmE2NjY0MjQ5M2MxMjc2NTBiNTU4MmUyMzQxNjgwMzk3NTYyMDdiZjEz
10
+ N2YxN2MxN2YyMDZkMGIxMDZjMDVmZWRmYjlmOGE2MDlhOTVkMDBhODJmOWE4
11
+ OWEyODcxYTQ0MzU2MGY5ODI2MTVjYTc2OTU2YmIzZTdlYzE5Yzg=
12
+ data.tar.gz: !binary |-
13
+ YTY5YjhkYmZlZTU3ZDBmM2RkZWIyMDFhYWEyZmU4ODZkNjJmNzAxYWU5YzAy
14
+ YWM5ZWMzNGQ2YWUyYmEyNjBjNzVmZmVkZGYxODg3OTEyYTc0NzQxZDExNGFj
15
+ YjI1YjY2YzExYjEwZGFlZmI4OTMxYmNiNDdkNTg2Njc2ZTUwYmE=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ .*
2
+ *~
3
+ *.gem
4
+ Gemfile.lock
5
+ InstalledFiles
6
+ _yardoc
7
+ coverage
8
+ doc/
9
+ lib/bundler/man
10
+ pkg
11
+ rdoc
12
+ spec/reports
13
+ test/tmp
14
+ test/version_tmp
15
+ tmp
16
+ !.empty_directory
17
+ !.git*
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ ruby "1.9.3"
2
+ source "https://rubygems.org"
3
+
4
+ # Specify your gem's dependencies in mantis.gemspec
5
+ gemspec
data/LICENSE-MIT ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 franklin
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.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # mantis
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/mantis.png)](http://badge.fury.io/rb/mantis)
4
+
5
+ > Mantis is a quick and dirts git submodule management alternative.
6
+ >
7
+ > It reads out a `Matisfile` and clones repositories into to the given path with the given tag/branch.
8
+
9
+ ## Installation
10
+
11
+ ```
12
+ $ gem install mantis
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```
18
+ $ mantis help
19
+ Commands:
20
+ mantis help [COMMAND] # Describe available commands or one specific command
21
+ mantis install # Install the current environment to the system
22
+
23
+ Options:
24
+ -V, [--verbose=Enable verbose output mode], [--no-verbose]
25
+ ```
26
+
27
+ ## Contributing
28
+ In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.
29
+
30
+ 1. Fork it
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create new Pull Request
35
+
36
+ ## License
37
+ Copyright (c) We Are Interactive under the MIT license.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/mantis ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+
4
+ require 'mantis'
5
+
6
+ require 'mantis/cli'
7
+ Mantis::CLI.start(ARGV, :debug => true)
@@ -0,0 +1,15 @@
1
+ module Mantis
2
+ class CLI::Install
3
+ attr_reader :options
4
+
5
+ def initialize(options)
6
+ @options = options.dup
7
+ end
8
+
9
+ def run
10
+ Installer.install(options)
11
+ puts "Your bundle is complete!"
12
+ end
13
+
14
+ end
15
+ end
data/lib/mantis/cli.rb ADDED
@@ -0,0 +1,23 @@
1
+ require "git"
2
+ require "thor"
3
+
4
+ module Mantis
5
+ class CLI < Thor
6
+ include Thor::Actions
7
+
8
+ default_task :install
9
+ class_option "verbose", :type => :boolean, :banner => "Enable verbose output mode", :aliases => "-v"
10
+
11
+ desc "install", "Install the current environment to the system"
12
+ long_desc <<-D
13
+ Install will install all of the git repositories in the current bundle, making them
14
+ available for use. In a freshly checked out repository, this command will give you the same
15
+ git repository versions as the last person who updated the Mantisfile and ran `mantis update`.
16
+ D
17
+ def install
18
+ require 'mantis/cli/install'
19
+ Install.new(options.dup).run
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,47 @@
1
+ require "git"
2
+
3
+ module Mantis
4
+ class Installer
5
+
6
+ # Begins the installation process for Bundler.
7
+ # For more information see the #run method on this class.
8
+ def self.install(options = {})
9
+ installer = new()
10
+ installer.run(options)
11
+ installer
12
+ end
13
+
14
+ def run(options)
15
+ config = "Mantisfile"
16
+
17
+ unless File.exists?(config)
18
+ puts "No Mantisfile file found!"
19
+ next
20
+ end
21
+
22
+ text = File.open(config).read
23
+ text.gsub!(/\r\n?/, "\n")
24
+ text.each_line do |line|
25
+
26
+ next if line.strip! == ""
27
+
28
+ uri, tag, name = line.split(',')
29
+
30
+ if Dir.exists?(name.strip)
31
+ puts "Fetching #{uri.strip} in #{name.strip}"
32
+ g = Git.open(name.strip)
33
+ g.fetch
34
+ else
35
+ puts "Cloning #{uri.strip} to #{name.strip}..."
36
+ g = Git.clone(uri.strip, name.strip)
37
+ end
38
+
39
+ g.chdir do
40
+ g.checkout(tag.strip)
41
+ puts "Checking out #{tag.strip}"
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,3 @@
1
+ module Mantis
2
+ VERSION = "0.1.0"
3
+ end
data/lib/mantis.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "mantis/version"
2
+
3
+ module Mantis
4
+ autoload :Installer, 'mantis/installer'
5
+ end
data/mantis.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mantis/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mantis"
8
+ spec.version = Mantis::VERSION
9
+ spec.authors = ["franklin"]
10
+ spec.email = ["franklin@weareinteractive.com"]
11
+ spec.description = %q{Gem with some useful command line tools.}
12
+ spec.summary = %q{Command line snippets.}
13
+ spec.homepage = "https://github.com/franklinkim/gem-mantis"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "git"
22
+ spec.add_runtime_dependency "thor"
23
+
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "bundler"
26
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mantis
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - franklin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: git
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Gem with some useful command line tools.
70
+ email:
71
+ - franklin@weareinteractive.com
72
+ executables:
73
+ - mantis
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE-MIT
80
+ - README.md
81
+ - Rakefile
82
+ - bin/mantis
83
+ - lib/mantis.rb
84
+ - lib/mantis/cli.rb
85
+ - lib/mantis/cli/install.rb
86
+ - lib/mantis/installer.rb
87
+ - lib/mantis/version.rb
88
+ - mantis.gemspec
89
+ homepage: https://github.com/franklinkim/gem-mantis
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.2.2
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Command line snippets.
113
+ test_files: []