vint 1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ ## 1.3
2
+ * Vintに改名しました
3
+ * バージョンが上手く取得出来ていない不具合を修正
4
+
5
+ ## 1.2
6
+ * helpが表示出来ない不具合を修正
7
+
8
+ ## 1.1
9
+ * Fixed typo
10
+
11
+ ## 1.0
12
+ * First release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vint.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Oame
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 o_ame
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.ja.md ADDED
@@ -0,0 +1,43 @@
1
+ [ブログ記事](http://blog.oameya.com/articles/9)も書きました。こちらもご一読くださいませ。
2
+
3
+ # Vint(also known as Vintner)
4
+
5
+ VintはBrewfileに記述されたHomebrew依存パッケージを一括でインストールするためのツールです。
6
+ Rubygemsで言うGemfileのようなものです。
7
+
8
+ ## インストール
9
+
10
+ gem install vint
11
+
12
+ ## Usage
13
+
14
+ 以下のコマンドを実行して`Brewfile`のテンプレートを作成しましょう!
15
+
16
+ $ vint init
17
+
18
+ 出来た`Brewfile`を早速編集してみましょう。
19
+
20
+ brew "mecab"
21
+ brew "cabocha", :url => "https://raw.github.com/oame/homebrew/master/Library/Formula/cabocha.rb"
22
+
23
+ `vint install`または`vint`で全ての依存パッケージをインストール出来ます!
24
+
25
+ $ vint install
26
+ Installing mecab ...
27
+ Using cabocha (0.64)
28
+ All of formula in Brewfile is installed!
29
+
30
+ たったこれだけで依存パッケージの導入は終わりです!
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create new Pull Request
39
+
40
+ ## Credits
41
+
42
+ Maintained by oame - http://oameya.com
43
+ Licensed by MIT License
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ 日本語ドキュメントは[こちら](https://github.com/oame/vint/blob/master/README.ja.md)です。
2
+
3
+ # Vint(also known as Vintner)
4
+
5
+ Winemaker for Homebrew.
6
+
7
+ ## Installation
8
+
9
+ gem install vint
10
+
11
+ ## Usage
12
+
13
+ Run following command to create sample of Brewfile!
14
+
15
+ $ vint init
16
+
17
+ then edit `Brewfile`
18
+
19
+ brew "mecab"
20
+ brew "cabocha", :url => "https://raw.github.com/oame/homebrew/master/Library/Formula/cabocha.rb"
21
+
22
+ run `vint install` or `vint` to install all of dependencies!
23
+
24
+ $ vint install
25
+ Installing mecab ...
26
+ Using cabocha (0.64)
27
+ All of formula in Brewfile is installed!
28
+
29
+ Finish!
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
38
+
39
+ ## Credits
40
+
41
+ Maintained by oame - http://oameya.com
42
+ Licensed by MIT License
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/vint ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require "vint"
5
+ require "optparse"
6
+ require "pp"
7
+
8
+ class String
9
+ def undent
10
+ gsub /^.{#{slice(/^ +/).length}}/, ''
11
+ end
12
+ end
13
+
14
+ def help
15
+ puts <<-EOD.undent
16
+ Usage: vint [OPTIONS]
17
+
18
+ options:
19
+ -h, --help\tShow help
20
+ -v, --version\tShow version
21
+
22
+ commands:
23
+ init\tCreate Vint template file
24
+ install\tInstall formula
25
+ EOD
26
+ end
27
+
28
+ def install(brewfile)
29
+ unless File.exists?(brewfile)
30
+ puts "Brewfile not found. please '$ vint init' to create Brewfile"
31
+ exit 1
32
+ end
33
+ parser = Vint::Parser.new
34
+ parser.parse(brewfile)
35
+ end
36
+
37
+ OptionParser.new do |opts|
38
+ opts.on("-h", "--help") do
39
+ help
40
+ exit
41
+ end
42
+ opts.on("-v", "--version") do
43
+ puts "Vint #{Vint::VERSION}"
44
+ exit
45
+ end
46
+ opts.parse!(ARGV)
47
+ end
48
+
49
+ command, args = ARGV
50
+ case command
51
+ when "install"
52
+ brewfile = args ? File.expand_path(args) : File.join(Dir.pwd, "Brewfile")
53
+ install(brewfile)
54
+ when "init"
55
+ File.open(File.join(Dir.pwd, "Brewfile"), "w") do |f|
56
+ f.puts <<-EOD.undent
57
+ # Brewfile is created by Vint(Winemaker)
58
+ # https://github.com/oame/vint
59
+
60
+ # brew "scala"
61
+ # brew "cabocha", :url => "http://example.com/lib/formula2.rb"
62
+ EOD
63
+ end
64
+ puts "Finish create Brewfile on current directory!"
65
+ else
66
+ brewfile = File.join(Dir.pwd, "Brewfile")
67
+ install(brewfile)
68
+ end
69
+
data/lib/vint.rb ADDED
@@ -0,0 +1,9 @@
1
+ # coding: utf-8
2
+
3
+ $LOAD_PATH.unshift(File.expand_path("../", __FILE__))
4
+ require "vint/version"
5
+ require "vint/parser"
6
+
7
+ module Vint
8
+
9
+ end
@@ -0,0 +1,49 @@
1
+ module Vint
2
+ class Parser
3
+
4
+ def initialize
5
+
6
+ end
7
+
8
+ protected
9
+ def installed?(name)
10
+ info = `brew info #{name}`.split(/\n/)
11
+ if (info =~ /Error: /) || info.reverse[1] =~ /Not installed/
12
+ return false
13
+ else
14
+ return info[0].split(": ").last
15
+ end
16
+ end
17
+
18
+ def install(name, args={})
19
+ brewable = `brew info #{name}`
20
+ if brewable =~ /^Error:/
21
+ puts "Error: No available formula for #{name}"
22
+ exit 1
23
+ end
24
+ if args[:url]
25
+ system "brew install #{args[:url]} >& /dev/null"
26
+ else
27
+ system "brew install #{name} >& /dev/null"
28
+ end
29
+ end
30
+
31
+ def brew(formula, args={})
32
+ installed_version = installed?(formula)
33
+ puts "#{installed_version ? "Using" : "Installing"} #{formula} #{installed_version ? "(#{installed_version})" : "..."}"
34
+ install(formula, args) unless installed_version
35
+ end
36
+
37
+ public
38
+ def parse(brewfile)
39
+ begin
40
+ eval(File.open(brewfile).read)
41
+ puts "All of formula in Brewfile is installed!"
42
+ rescue => e
43
+ puts e
44
+ exit 1
45
+ end
46
+ end
47
+
48
+ end
49
+ end
@@ -0,0 +1,3 @@
1
+ module Vint
2
+ VERSION = "1.3"
3
+ end
data/vint.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vint/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "vint"
8
+ gem.version = Vint::VERSION
9
+ gem.authors = ["o_ame"]
10
+ gem.email = ["oame@oameya.com"]
11
+ gem.description = %q{Winemaker for Homebrew}
12
+ gem.summary = %q{Winemaker for Homebrew}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vint
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.3'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - o_ame
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-27 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Winemaker for Homebrew
15
+ email:
16
+ - oame@oameya.com
17
+ executables:
18
+ - vint
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - CHANGELOG.md
24
+ - Gemfile
25
+ - LICENSE
26
+ - LICENSE.txt
27
+ - README.ja.md
28
+ - README.md
29
+ - Rakefile
30
+ - bin/vint
31
+ - lib/vint.rb
32
+ - lib/vint/parser.rb
33
+ - lib/vint/version.rb
34
+ - vint.gemspec
35
+ homepage: ''
36
+ licenses: []
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 1.8.24
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: Winemaker for Homebrew
59
+ test_files: []