boppers 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9c1ef7fe3d1fd71753d0742bac569898946b06d
4
- data.tar.gz: ea5913553709cf5c4f99de4528631e1f92cd6570
3
+ metadata.gz: aacbc6cbb8092024b7e7bf778f6ebfff9f6ee73a
4
+ data.tar.gz: a23afe21e2c89027fd6c0a8a49f77ef53f0f5287
5
5
  SHA512:
6
- metadata.gz: 26cc16a7fae673891da30498b58668ad2a29b25649f3b3d09bf47160e1457f57cd2871cf9b2d8c9e35767077e2dc3e427e9a504c7ac4035e4db7c7a88e78f86f
7
- data.tar.gz: d0063d9ff6f74a381b7497385676520cfdc96048d29e2c743fff8aba2c97a784562b1a88e73b0a97f4bcdc26ed964f4666acf04c7b19d5e349ac8ee6976a3254
6
+ metadata.gz: ad2567a1c3b0b54ca93d42ea1410e5dc084f6aae3e037e2cff76fe4bd0d62b3d36750e811b7ddbea4d19fbfbfbd1460462b780429c3991be22ea8dda31c24c0c
7
+ data.tar.gz: 314e0a18f6ee0817abb788e52542ad2d38b9cb558121cc4676c1927efef80977aa3abd2248748df64ebdcbbbf7213aceea39c7ac3d38a2c3708fb949ba7dec35
data/README.md CHANGED
@@ -65,7 +65,7 @@ The `Boppers.notify` method expects a event name (the recommended value is the b
65
65
  I encourage you to share your boppers. I even added a command to generate a common structure, so you don't have to think about how to organize it. Let's say you want to distribute the clock bopper above.
66
66
 
67
67
  ```
68
- $ boppers plugin clock
68
+ $ boppers plugin clock --type bopper
69
69
  create boppers-clock.gemspec
70
70
  create gems.rb
71
71
  create .gitignore
@@ -144,6 +144,10 @@ end
144
144
 
145
145
  Now this notifier will only be triggered when `Boppers.notify(:clock, *args)` is called, ignoring other boppers.
146
146
 
147
+ ### Distributing notifiers
148
+
149
+ The idea is pretty much the same as creating a bopper. Use the command `boppers plugin [NAME] --type notifier` to generate a file structure. Then configure the plugin accordingly. There's a a linter for notifiers: `Boppers::Testing::NotifierLinter`.
150
+
147
151
  ### Available notifiers
148
152
 
149
153
  By default, Boppers comes with the following notifiers.
@@ -254,10 +258,6 @@ Boppers.configure do |config|
254
258
  end
255
259
  ```
256
260
 
257
- ### Distributing notifiers
258
-
259
- The idea is pretty much the same. Create a new plugin with `boppers plugin [NAME]` and configure it accordingly. There's also a linter for notifiers: `Boppers::Testing::NotifierLinter`.
260
-
261
261
  ## Deploying to Heroku
262
262
 
263
263
  I'm assuming you installed the gem with `gem install boppers` and generated your app.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boppers (0.0.5)
4
+ boppers (0.0.6)
5
5
  aitch
6
6
  thor
7
7
 
@@ -28,14 +28,26 @@ module Boppers
28
28
  end
29
29
 
30
30
  desc "plugin NAME", "Create a new plugin for Boppers"
31
+ method_option :type,
32
+ type: :string,
33
+ desc: "The type of plugin. Can be either bopper or notifier.",
34
+ required: true
31
35
 
32
36
  def plugin(name)
33
37
  require "boppers/generator/plugin"
34
38
 
39
+ unless %w{bopper notifier}.include?(options[:type])
40
+ message = "ERROR: --type needs to be either 'bopper' or 'notifier'"
41
+ shell.error shell.set_color(message, :red)
42
+ exit 1
43
+ end
44
+
45
+ suffix = "-notifier" if options[:type] == "notifier"
35
46
  base_path = File.dirname(File.expand_path(name))
36
- base_name = "boppers-#{File.basename(name)}"
47
+ base_name = "boppers-#{File.basename(name)}#{suffix}"
37
48
 
38
49
  generator = Generator::Plugin.new
50
+ generator.plugin_type = options[:type]
39
51
  generator.destination_root = File.join(base_path, base_name)
40
52
  generator.invoke_all
41
53
  end
@@ -5,6 +5,8 @@ module Boppers
5
5
  class Plugin < Thor::Group
6
6
  include Thor::Actions
7
7
 
8
+ attr_accessor :plugin_type
9
+
8
10
  desc "Generate a new Boopers plugin structure"
9
11
 
10
12
  def self.source_root
@@ -12,7 +14,7 @@ module Boppers
12
14
  end
13
15
 
14
16
  def copy_files
15
- template "gemspec.erb", "#{plugin_name}.gemspec"
17
+ template "#{plugin_type}/gemspec.erb", "#{plugin_name}.gemspec"
16
18
  copy_file "gems.rb"
17
19
  copy_file ".gitignore"
18
20
  copy_file ".rubocop.yml"
@@ -20,20 +22,26 @@ module Boppers
20
22
  copy_file "CODE_OF_CONDUCT.md"
21
23
  copy_file "LICENSE.txt"
22
24
  copy_file "Rakefile"
23
- template "README.erb", "README.md"
25
+ template "#{plugin_type}/README.erb", "README.md"
24
26
  end
25
27
 
26
28
  def copy_lib_files
27
- template "lib/entry.erb", "lib/#{plugin_name}.rb"
28
- template "lib/main.erb", "lib/boppers/#{name}.rb"
29
- template "lib/version.erb", "lib/boppers/#{name}/version.rb"
29
+ template "#{plugin_type}/entry.erb",
30
+ "lib/#{plugin_name}.rb"
31
+
32
+ template "#{plugin_type}/main.erb",
33
+ "lib/boppers/#{plugin_dir}#{name}.rb"
34
+
35
+ template "#{plugin_type}/version.erb",
36
+ "lib/boppers/#{plugin_dir}#{name}/version.rb"
30
37
  end
31
38
 
32
39
  def copy_test_files
33
40
  template "test/test_helper.erb", "test/test_helper.rb"
34
41
 
35
42
  test_file_name = name.tr("-", "_")
36
- template "test/test_file.erb", "test/boppers/#{test_file_name}_test.rb"
43
+ template "#{plugin_type}/test_file.erb",
44
+ "test/boppers/#{plugin_dir}#{test_file_name}_test.rb"
37
45
  end
38
46
 
39
47
  def run_commands
@@ -45,12 +53,18 @@ module Boppers
45
53
 
46
54
  private
47
55
 
56
+ def bopper?
57
+ plugin_type == "bopper"
58
+ end
59
+
48
60
  def plugin_name
49
61
  File.basename(destination_root)
50
62
  end
51
63
 
52
64
  def name
53
- plugin_name.gsub(/^boppers-/, "")
65
+ plugin_name
66
+ .gsub(/^boppers-/, "")
67
+ .gsub(/-notifier$/, "")
54
68
  end
55
69
 
56
70
  def plugin_namespace
@@ -59,6 +73,10 @@ module Boppers
59
73
  .gsub(/_(.)/) { $1.upcase }
60
74
  .gsub(/^(.)/) { $1.upcase }
61
75
  end
76
+
77
+ def plugin_dir
78
+ "notifier/" unless bopper?
79
+ end
62
80
  end
63
81
  end
64
82
  end
@@ -1,5 +1,7 @@
1
1
  # Boppers::<%= plugin_namespace %>
2
2
 
3
+ A [bopper](https://github.com/fnando/boppers) to [SOME DESCRIPTION].
4
+
3
5
  [![Travis-CI](https://travis-ci.org/[USERNAME]/<%= plugin_name %>.png)](https://travis-ci.org/[USERNAME]/<%= plugin_name %>)
4
6
  [![GPA](https://codeclimate.com/github/[USERNAME]/<%= plugin_name %>/badges/gpa.svg)](https://codeclimate.com/github/[USERNAME]/<%= plugin_name %>)
5
7
  [![Test Coverage](https://codeclimate.com/github/[USERNAME]/<%= plugin_name %>/badges/coverage.svg)](https://codeclimate.com/github/[USERNAME]/<%= plugin_name %>)
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Author"]
9
9
  spec.email = ["author@example.com"]
10
10
 
11
- spec.summary = "Some description"
11
+ spec.summary = "A bopper to [SOME DESCRIPTION]"
12
12
  spec.description = spec.summary
13
13
  spec.homepage = "https://rubygems.org/gems/<%= plugin_name %>"
14
14
  spec.license = "MIT"
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+
5
+ class Boppers<%= plugin_namespace %>Test < Minitest::Test
6
+ test "lints plugin" do
7
+ bopper = Boppers::<%= plugin_namespace %>.new
8
+ Boppers::Testing::BopperLinter.call(bopper)
9
+ end
10
+ end
@@ -0,0 +1,47 @@
1
+ # Boppers::Notifier::<%= plugin_namespace %>
2
+
3
+ A [bopper](https://github.com/fnando/boppers) notifier to [SOME DESCRIPTION].
4
+
5
+ [![Travis-CI](https://travis-ci.org/[USERNAME]/<%= plugin_name %>.png)](https://travis-ci.org/[USERNAME]/<%= plugin_name %>)
6
+ [![GPA](https://codeclimate.com/github/[USERNAME]/<%= plugin_name %>/badges/gpa.svg)](https://codeclimate.com/github/[USERNAME]/<%= plugin_name %>)
7
+ [![Test Coverage](https://codeclimate.com/github/[USERNAME]/<%= plugin_name %>/badges/coverage.svg)](https://codeclimate.com/github/[USERNAME]/<%= plugin_name %>)
8
+ [![Gem](https://img.shields.io/gem/v/<%= plugin_name %>.svg)](https://rubygems.org/gems/<%= plugin_name %>)
9
+ [![Gem](https://img.shields.io/gem/dt/<%= plugin_name %>.svg)](https://rubygems.org/gems/<%= plugin_name %>)
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem "<%= plugin_name %>"
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install <%= plugin_name %>
26
+
27
+ ## Usage
28
+
29
+ TODO: Write usage instructions here
30
+
31
+ ## Development
32
+
33
+ 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.
34
+
35
+ 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).
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/<%= plugin_name %>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
44
+
45
+ ## Code of Conduct
46
+
47
+ Everyone interacting in the Boppers project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/<%= plugin_name %>/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "boppers"
4
+ require "boppers/notifier/<%= name %>"
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "./lib/boppers/notifier/<%= name %>/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "<%= plugin_name %>"
7
+ spec.version = Boppers::Notifier::<%= plugin_namespace %>::VERSION
8
+ spec.authors = ["Author"]
9
+ spec.email = ["author@example.com"]
10
+
11
+ spec.summary = "A bopper notifier to [SOME DESCRIPTION]"
12
+ spec.description = spec.summary
13
+ spec.homepage = "https://rubygems.org/gems/<%= plugin_name %>"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "boppers"
24
+
25
+ spec.add_development_dependency "bundler"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "minitest-utils"
28
+ spec.add_development_dependency "simplecov"
29
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "boppers/notifier/<%= name %>/version"
4
+
5
+ module Boppers
6
+ module Notifier
7
+ class <%= plugin_namespace %>
8
+ attr_reader :subscribe
9
+
10
+ def initialize(subscribe: nil)
11
+ @subscribe = subscribe
12
+ end
13
+
14
+ def call(title, message, options)
15
+ puts "<%= name %> notification"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+
5
+ class BoppersNotifier<%= plugin_namespace %>Test < Minitest::Test
6
+ test "lints plugin" do
7
+ bopper = Boppers::Notifier::<%= plugin_namespace %>.new
8
+ Boppers::Testing::NotifierLinter.call(bopper)
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Boppers
4
+ module Notifier
5
+ class <%= plugin_namespace %>
6
+ VERSION = "0.1.0"
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Boppers
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boppers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2017-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -191,14 +191,20 @@ files:
191
191
  - lib/boppers/generator/plugin/.travis.yml
192
192
  - lib/boppers/generator/plugin/CODE_OF_CONDUCT.md
193
193
  - lib/boppers/generator/plugin/LICENSE.txt
194
- - lib/boppers/generator/plugin/README.erb
195
194
  - lib/boppers/generator/plugin/Rakefile
195
+ - lib/boppers/generator/plugin/bopper/README.erb
196
+ - lib/boppers/generator/plugin/bopper/entry.erb
197
+ - lib/boppers/generator/plugin/bopper/gemspec.erb
198
+ - lib/boppers/generator/plugin/bopper/main.erb
199
+ - lib/boppers/generator/plugin/bopper/test_file.erb
200
+ - lib/boppers/generator/plugin/bopper/version.erb
196
201
  - lib/boppers/generator/plugin/gems.rb
197
- - lib/boppers/generator/plugin/gemspec.erb
198
- - lib/boppers/generator/plugin/lib/entry.erb
199
- - lib/boppers/generator/plugin/lib/main.erb
200
- - lib/boppers/generator/plugin/lib/version.erb
201
- - lib/boppers/generator/plugin/test/test_file.erb
202
+ - lib/boppers/generator/plugin/notifier/README.erb
203
+ - lib/boppers/generator/plugin/notifier/entry.erb
204
+ - lib/boppers/generator/plugin/notifier/gemspec.erb
205
+ - lib/boppers/generator/plugin/notifier/main.erb
206
+ - lib/boppers/generator/plugin/notifier/test_file.erb
207
+ - lib/boppers/generator/plugin/notifier/version.erb
202
208
  - lib/boppers/generator/plugin/test/test_helper.erb
203
209
  - lib/boppers/http_client.rb
204
210
  - lib/boppers/notifier/hipchat.rb
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "test_helper"
4
-
5
- class Boppers<%= plugin_namespace %>Test < Minitest::Test
6
- test "check version" do
7
- assert_equal "0.1.0", Boppers::<%= plugin_namespace %>::VERSION
8
- end
9
- end