zug_zug 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,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cd14f64e44515d5823dfdd0814ba7f4a97c5712646e13b754fb5d096212e5e84
4
+ data.tar.gz: 64a64142ede0ce60c643550aa32820c4175b271c1e53175124482db1e92872ed
5
+ SHA512:
6
+ metadata.gz: edd31dee0cb4fc59afd5aa9d76b87a52143ee09213be8807d2efeecff67ec4f4c07e1402fb268c820186bbef7760691185fdd4c40d8fbab604e682f568fcd929
7
+ data.tar.gz: b98edcb08a65ecff5007651c98af447d0d9347d57b64b91ccfa8c27f3739452083e622343eefb20e4cf7d5b0258cc750b118c5f304af84a1c9325c6b666d53c1
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 2.0.2
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## 0.1.0
8
+
9
+ ### Added
10
+
11
+ * A basic soundboard that can play two sounds (`:zug_zug` and `:work_complete`), from two
12
+ different sets (one for the Horde, one for the Alliance).
13
+ * A basic dispatcher (`QuarterMaster`) that uses the soundboard when triggered.
14
+ * A CLI that generates git hook scripts ; these scripts make use of the dispatcher.
15
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in zug_zug.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,33 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ zug_zug (0.1.0)
5
+ thor (~> 0.20)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ansi (1.5.0)
11
+ builder (3.2.3)
12
+ minitest (5.12.2)
13
+ minitest-reporters (1.3.8)
14
+ ansi
15
+ builder
16
+ minitest (>= 5.0)
17
+ ruby-progressbar
18
+ rake (13.0.0)
19
+ ruby-progressbar (1.10.1)
20
+ thor (0.20.3)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ bundler (~> 2.0)
27
+ minitest (~> 5.0)
28
+ minitest-reporters (~> 1.3)
29
+ rake (~> 13.0)
30
+ zug_zug!
31
+
32
+ BUNDLED WITH
33
+ 2.0.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Ronan Limon Duparcmeur
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,40 @@
1
+ # ZugZug
2
+
3
+ [![Build Status](https://travis-ci.org/r3trofitted/zug_zug.svg?branch=master)](https://travis-ci.org/r3trofitted/zug_zug)
4
+
5
+ Hook Warcraft sounds to your Git commands
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'zug_zug'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install zug_zug
22
+
23
+ ## Usage
24
+
25
+ cd /your/repo
26
+ zug_zug join <alliance|horde>
27
+
28
+ ## Development
29
+
30
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31
+
32
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/r3trofitted/zug_zug.
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "zug_zug"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/zug_zug ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "zug_zug/cli"
4
+ ZugZug::CLI.start
data/lib/zug_zug.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "zug_zug/version"
2
+
3
+ module ZugZug
4
+ HORDE = :horde
5
+ ALLIANCE = :alliance
6
+
7
+ Error = Class.new(StandardError)
8
+ end
@@ -0,0 +1,19 @@
1
+ require "thor"
2
+
3
+ module ZugZug
4
+ class CLI < Thor
5
+ include Thor::Actions
6
+
7
+ desc "join FACTION", "install the FACTION git hooks"
8
+ def join(faction)
9
+ FileUtils.chmod 0751, template("post_checkout", ".git/hooks/post-checkout", faction: faction)
10
+ FileUtils.chmod 0751, template("post_merge", ".git/hooks/post-merge", faction: faction)
11
+
12
+ puts "You are now part of the #{faction}!"
13
+ end
14
+
15
+ def self.source_root
16
+ File.join __dir__, "templates"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ require "zug_zug/soundboard"
2
+
3
+ module ZugZug
4
+ class QuarterMaster
5
+ def initialize(faction = HORDE)
6
+ @soundboard = Soundboard.new(faction)
7
+ end
8
+
9
+ def checked_out!(argv)
10
+ previous_head, new_head, branch_flag = argv
11
+
12
+ if branch_flag == "1" && new_head == previous_head
13
+ @soundboard.work_starts
14
+ end
15
+ end
16
+
17
+ def merged!(argv)
18
+ @soundboard.work_is_over
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,58 @@
1
+ require "zug_zug"
2
+
3
+ module ZugZug
4
+ class Soundboard
5
+ HORDE_SOUNDS = {
6
+ zug_zug: "zug_zug.wav",
7
+ work_complete: "work_complete.wav"
8
+ }
9
+
10
+ ALLIANCE_SOUNDS = {
11
+ zug_zug: "alright.wav",
12
+ work_complete: "jobs_done.wav"
13
+ }
14
+
15
+ def self.board_for(faction)
16
+ case faction
17
+ when HORDE
18
+ HORDE_SOUNDS
19
+ when ALLIANCE
20
+ ALLIANCE_SOUNDS
21
+ else
22
+ fail ArgumentError, "#{faction} is not a valid faction (valid factions are #{HORDE} and #{ALLIANCE})"
23
+ end
24
+ end
25
+
26
+ def initialize(faction, plugin: default_plugin)
27
+ @_board = Soundboard.board_for faction
28
+ @_plugin = plugin
29
+ end
30
+
31
+ def work_starts
32
+ play sound_file(:zug_zug)
33
+ end
34
+
35
+ def work_is_over
36
+ play sound_file(:work_complete)
37
+ end
38
+
39
+ def play(file)
40
+ @_plugin.call(file)
41
+ end
42
+
43
+ def sound_file(sound)
44
+ file_name = @_board.fetch sound
45
+ File.join __dir__, "sounds", file_name
46
+ end
47
+
48
+ private
49
+
50
+ def default_plugin
51
+ if RUBY_PLATFORM.include? "x86_64-darwin"
52
+ ->(file) { system "afplay", file }
53
+ else
54
+ ->(file) { true }
55
+ end
56
+ end
57
+ end
58
+ end
Binary file
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "zug_zug/quarter_master"
4
+
5
+ ZugZug::QuarterMaster.new(:<%= config[:faction] %>).checked_out! ARGV
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "zug_zug/quarter_master"
4
+
5
+ ZugZug::QuarterMaster.new(:<%= config[:faction] %>).merged! ARGV
@@ -0,0 +1,3 @@
1
+ module ZugZug
2
+ VERSION = "0.1.0"
3
+ end
data/zug_zug.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "zug_zug/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "zug_zug"
7
+ spec.version = ZugZug::VERSION
8
+ spec.authors = ["Ronan Limon Duparcmeur"]
9
+ spec.email = ["ronan@2-45.pm"]
10
+
11
+ spec.summary = "Hook Warcraft sounds to your Git commands"
12
+ spec.homepage = "https://github.com/r3trofitted/zug_zug"
13
+ spec.license = "MIT"
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = "https://github.com/r3trofitted/zug_zug"
17
+ spec.metadata["changelog_uri"] = "https://github.com/r3trofitted/zug_zug/CHANGELOG.md"
18
+
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency "thor", "~> 0.20"
27
+
28
+ spec.add_development_dependency "bundler", "~> 2.0"
29
+ spec.add_development_dependency "rake", "~> 13.0"
30
+ spec.add_development_dependency "minitest", "~> 5.0"
31
+ spec.add_development_dependency "minitest-reporters", "~> 1.3"
32
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zug_zug
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ronan Limon Duparcmeur
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-10-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.20'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.20'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.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: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-reporters
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ description:
84
+ email:
85
+ - ronan@2-45.pm
86
+ executables:
87
+ - zug_zug
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".travis.yml"
93
+ - CHANGELOG.md
94
+ - Gemfile
95
+ - Gemfile.lock
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - bin/console
100
+ - bin/setup
101
+ - exe/zug_zug
102
+ - lib/zug_zug.rb
103
+ - lib/zug_zug/cli.rb
104
+ - lib/zug_zug/quarter_master.rb
105
+ - lib/zug_zug/soundboard.rb
106
+ - lib/zug_zug/sounds/alright.wav
107
+ - lib/zug_zug/sounds/jobs_done.wav
108
+ - lib/zug_zug/sounds/work_complete.wav
109
+ - lib/zug_zug/sounds/zug_zug.wav
110
+ - lib/zug_zug/templates/post_checkout.tt
111
+ - lib/zug_zug/templates/post_merge.tt
112
+ - lib/zug_zug/version.rb
113
+ - zug_zug.gemspec
114
+ homepage: https://github.com/r3trofitted/zug_zug
115
+ licenses:
116
+ - MIT
117
+ metadata:
118
+ homepage_uri: https://github.com/r3trofitted/zug_zug
119
+ source_code_uri: https://github.com/r3trofitted/zug_zug
120
+ changelog_uri: https://github.com/r3trofitted/zug_zug/CHANGELOG.md
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubygems_version: 3.0.3
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Hook Warcraft sounds to your Git commands
140
+ test_files: []