serverkit-homebrew 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 60265b934358fb8ff4b32f4a94c3fe634edec2ac
4
+ data.tar.gz: 32bcbdd9e9a32143a17db16d55ba881b5a97bac0
5
+ SHA512:
6
+ metadata.gz: f2d9e6a9589766f4a149fc2c29be9076ec024ad136b380a677394ce18ac0d0a091dffc13021df0556d6eee246a59332ecf99fbe01d164e760fe7376a9c5cf777
7
+ data.tar.gz: 28b69446ee64bc1a1040f247f1224e0bc3951295ca02b12a37c9a9328e42f151ef8e651d65549129e3ccefd4593e438cdf05371ea59985b9bbfc07588d806a32
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ryo Nakamura
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,59 @@
1
+ # Serverkit::Homebrew
2
+ [Serverkit](https://github.com/r7kamura/serverkit) plug-in for [Homebrew](http://brew.sh/).
3
+
4
+ ## Installation
5
+ ```rb
6
+ gem "serverkit-homebrew"
7
+ ```
8
+
9
+ ## Resource
10
+ ### homebrew_package
11
+ Make sure the specified homebrew package is installed.
12
+
13
+ #### Attributes
14
+ - name - package name (required)
15
+ - options - command-line-options for installation (e.g. `"--HEAD"`)
16
+
17
+ #### Example
18
+ ```yaml
19
+ resources:
20
+ - type: homebrew_package
21
+ name: zsh
22
+ - type: homebrew_package
23
+ name: rbenv
24
+ options: --HEAD
25
+ ```
26
+
27
+ ### homebrew_cask_package
28
+ Make sure the specified homebrew cask package is installed.
29
+
30
+ #### Attributes
31
+ - name - package name (required)
32
+ - options - command-line-options for installation
33
+
34
+ #### Example
35
+ ```yaml
36
+ resources:
37
+ - type: homebrew_cask_package
38
+ name: karabiner
39
+ - type: homebrew_cask_package
40
+ name: vagrant
41
+ ```
42
+
43
+ ### homebrew_tap
44
+ Make sure the specified GitHub repo is tapped (or untapped).
45
+
46
+ #### Attributes
47
+ - name - repository name (required)
48
+ - options - command-line-options for `brew tap` and `brew untap`
49
+ - status - pass `"untapped"` to make sure the repo is untapped
50
+
51
+ #### Example
52
+ ```yaml
53
+ resources:
54
+ - type: homebrew_tap
55
+ name: caskroom/cask
56
+ - type: homebrew_tap
57
+ name: homebrew/versions
58
+ status: untapped
59
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ require "serverkit/homebrew/version"
2
+ require "serverkit/resources/homebrew_cask_package"
3
+ require "serverkit/resources/homebrew_package"
4
+ require "serverkit/resources/homebrew_tap"
@@ -0,0 +1,5 @@
1
+ module Serverkit
2
+ module Homebrew
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,27 @@
1
+ require "serverkit/resources/base"
2
+
3
+ module Serverkit
4
+ module Resources
5
+ class HomebrewCaskPackage < Base
6
+ attribute :name, required: true, type: String
7
+ attribute :options, type: String
8
+
9
+ # @note Override
10
+ def apply
11
+ run_command("brew cask install #{options} #{name}")
12
+ end
13
+
14
+ # @note Override
15
+ def check
16
+ check_command("brew cask list -1 | grep -E '^#{name}$'")
17
+ end
18
+
19
+ private
20
+
21
+ # @note Override
22
+ def default_id
23
+ name
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ require "serverkit/resources/package"
2
+
3
+ module Serverkit
4
+ module Resources
5
+ class HomebrewPackage < Package
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,40 @@
1
+ require "serverkit/resources/base"
2
+
3
+ module Serverkit
4
+ module Resources
5
+ class HomebrewTap < Base
6
+ attribute :name, required: true, type: String
7
+ attribute :status, type: String, inclusion: { allow_nil: true, in: ["untapped"] }
8
+
9
+ # @note Override
10
+ def apply
11
+ run_command("brew #{applied_action_name} #{name}")
12
+ end
13
+
14
+ # @note Override
15
+ def check
16
+ has_untapped_status? ^ check_command("brew tap | grep -E '^#{name}$'")
17
+ end
18
+
19
+ private
20
+
21
+ # @return [String]
22
+ def applied_action_name
23
+ if has_untapped_status?
24
+ "untap"
25
+ else
26
+ "tap"
27
+ end
28
+ end
29
+
30
+ # @note Override
31
+ def default_id
32
+ name
33
+ end
34
+
35
+ def has_untapped_status?
36
+ status == "untapped"
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,20 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "serverkit/homebrew/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "serverkit-homebrew"
7
+ spec.version = Serverkit::Homebrew::VERSION
8
+ spec.authors = ["Ryo Nakamura"]
9
+ spec.email = ["r7kamura@gmail.com"]
10
+ spec.summary = "Serverkit plug-in for Homebrew."
11
+ spec.homepage = "https://github.com/r7kamura/serverkit-homebrew"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_runtime_dependency "serverkit"
18
+ spec.add_development_dependency "bundler", "~> 1.9"
19
+ spec.add_development_dependency "rake", "~> 10.0"
20
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: serverkit-homebrew
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryo Nakamura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: serverkit
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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.9'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - r7kamura@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/serverkit/homebrew.rb
69
+ - lib/serverkit/homebrew/version.rb
70
+ - lib/serverkit/resources/homebrew_cask_package.rb
71
+ - lib/serverkit/resources/homebrew_package.rb
72
+ - lib/serverkit/resources/homebrew_tap.rb
73
+ - serverkit-homebrew.gemspec
74
+ homepage: https://github.com/r7kamura/serverkit-homebrew
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.5
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Serverkit plug-in for Homebrew.
98
+ test_files: []
99
+ has_rdoc: