ruboty-gen 1.0.0

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: d4296ed15d7472275a2bcc990ddda81c76bf8b5a
4
+ data.tar.gz: 93b57524f0c1d30d6b61d2d1aa8c18fdf315d04e
5
+ SHA512:
6
+ metadata.gz: d199eee0c66cc90e70fc6bfdd310a287b641d8737d3cfef1216c41073cd3feb4071d0459ee2568227d0779111342f3d057f09b743f42e49b56b5bf4ae6766ad0
7
+ data.tar.gz: 0b751bd64bbdd17afff5fef9691e84b905dc66717188ce73de39651ddd2afa79a82a3d12bdbc984e964d6f9d450020d5aaaa7ae08c358ade69a2dbaba97c7310
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ruboty-gen.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 block_given?
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.md ADDED
@@ -0,0 +1,31 @@
1
+ # Ruboty::Gen
2
+
3
+ generators for creating ruboty plugin.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ruboty-gen'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install ruboty-gen
20
+
21
+ ## Usage
22
+
23
+ $ bundle exec ruboty-gen yo
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/blockgiven/ruboty-gen/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/ruboty-gen ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
4
+ require "ruboty"
5
+ require "ruboty/gen"
6
+
7
+ require "bundler"
8
+ require "bundler/friendly_errors"
9
+ Bundler.with_friendly_errors do
10
+ Ruboty::Gen::CLI.start(ARGV, debug: true)
11
+ end
data/lib/ruboty/gen.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "ruboty/gen/cli"
2
+ require "ruboty/gen/gem"
3
+ require "ruboty/gen/version"
4
+
5
+ module Ruboty
6
+ module Gen
7
+ # Your code goes here...
8
+ end
9
+ end
@@ -0,0 +1,29 @@
1
+ require 'bundler'
2
+ require 'bundler/vendored_thor'
3
+ require 'bundler/cli'
4
+ require 'bundler/cli/gem'
5
+
6
+ module Ruboty
7
+ module Gen
8
+ class CLI < Bundler::CLI
9
+ include Thor::Actions
10
+
11
+ def self.start(*)
12
+ super
13
+ rescue Exception => e
14
+ Bundler.ui = Bundler::UI::Shell.new
15
+ raise e
16
+ end
17
+
18
+ def self.source_paths
19
+ [File.expand_path('../../../templates', __dir__)]
20
+ end
21
+
22
+ desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a ruboty plugin"
23
+ def gem(name)
24
+ Bundler::CLI::Gem.new(options, "ruboty-#{name}", self).run
25
+ Ruboty::Gen::Gem.new(options, name, self).run
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,44 @@
1
+ module Ruboty
2
+ module Gen
3
+ class Gem
4
+ attr_reader :options, :ruboty_plugin_name, :thor
5
+
6
+ def initialize(options, ruboty_plugin_name, thor)
7
+ @options = options
8
+ @ruboty_plugin_name = ruboty_plugin_name.chomp("/")
9
+ @thor = thor
10
+ end
11
+
12
+ def run
13
+ ### copy from bundler :P
14
+ name = "ruboty-#{ruboty_plugin_name}" # remove trailing slash if present
15
+ ruboty_plugin_constant_name = ruboty_plugin_name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
16
+ underscored_name = name.tr('-', '_')
17
+ namespaced_path = name.tr('-', '/')
18
+ target = File.join(Dir.pwd, name)
19
+ constant_name = name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
20
+ constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
21
+ constant_array = constant_name.split('::')
22
+ git_user_name = `git config user.name`.chomp
23
+ git_user_email = `git config user.email`.chomp
24
+ opts = {
25
+ :name => name,
26
+ :ruboty_plugin_name => ruboty_plugin_name,
27
+ :ruboty_plugin_constant_name => ruboty_plugin_constant_name,
28
+ :underscored_name => underscored_name,
29
+ :namespaced_path => namespaced_path,
30
+ :makefile_path => "#{underscored_name}/#{underscored_name}",
31
+ :constant_name => constant_name,
32
+ :constant_array => constant_array,
33
+ :author => git_user_name.empty? ? "TODO: Write your name" : git_user_name,
34
+ :email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
35
+ :test => options[:test],
36
+ :ext => options[:ext]
37
+ }
38
+
39
+ thor.template(File.join('ruboty/handlers/newgem.rb.tt'), File.join(target, "lib/ruboty/handlers/#{ruboty_plugin_name}.rb"), opts)
40
+ thor.template(File.join('ruboty/newgem/actions/newgem.rb.tt'), File.join(target, "lib/ruboty/#{ruboty_plugin_name}/actions/#{ruboty_plugin_name}.rb"), opts)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module Gen
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruboty/gen/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruboty-gen"
8
+ spec.version = Ruboty::Gen::VERSION
9
+ spec.authors = ["block_given?"]
10
+ spec.email = ["block_given@outlook.com"]
11
+ spec.summary = %q{generators for creating ruboty plugin.}
12
+ spec.homepage = "https://github.com/blockgiven/ruboty-gen"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "bundler", "~> 1.7"
21
+ spec.add_runtime_dependency "ruboty"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,14 @@
1
+ require "<%=config[:namespaced_path]%>/version"
2
+ require "ruboty/handlers/<%= config[:name].gsub(/^ruboty-/, '') %>"
3
+ require "ruboty/<%= config[:name].gsub(/^ruboty-/, '') %>/actions/<%= config[:name].gsub(/^ruboty-/, '') %>"
4
+ <%- if config[:ext] -%>
5
+ require "<%=config[:namespaced_path]%>/<%=config[:underscored_name]%>"
6
+ <%- end -%>
7
+
8
+ <%- config[:constant_array].each_with_index do |c,i| -%>
9
+ <%= ' '*i %>module <%= c %>
10
+ <%- end -%>
11
+ <%= ' '*config[:constant_array].size %># Your code goes here...
12
+ <%- (config[:constant_array].size-1).downto(0) do |i| -%>
13
+ <%= ' '*i %>end
14
+ <%- end -%>
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require '<%=config[:namespaced_path]%>/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = <%=config[:name].inspect%>
8
+ spec.version = <%=config[:constant_name]%>::VERSION
9
+ spec.authors = [<%=config[:author].inspect%>]
10
+ spec.email = [<%=config[:email].inspect%>]
11
+ <% if config[:ext] -%>
12
+ spec.extensions = ["ext/<%=config[:underscored_name]%>/extconf.rb"]
13
+ <% end -%>
14
+ spec.summary = %q{TODO: Write a short summary. Required.}
15
+ spec.description = %q{TODO: Write a longer description. Optional.}
16
+ spec.homepage = ""
17
+ spec.license = "MIT"
18
+
19
+ spec.files = `git ls-files -z`.split("\x0")
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_runtime_dependency "ruboty"
25
+ spec.add_development_dependency "bundler", "~> <%= Bundler::VERSION.split(".")[0..1].join(".") %>"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ <% if config[:ext] -%>
28
+ spec.add_development_dependency "rake-compiler"
29
+ <% end -%>
30
+ <% if config[:test] -%>
31
+ spec.add_development_dependency "<%=config[:test]%>"
32
+ <% end -%>
33
+ end
@@ -0,0 +1,11 @@
1
+ module Ruboty
2
+ module Handlers
3
+ class <%= config[:ruboty_plugin_constant_name] %> < Base
4
+ on /<%= config[:ruboty_plugin_name].gsub('_', ' ') %>/, name: 'todo', description: 'TODO: write your description'
5
+
6
+ def todo(message)
7
+ Ruboty::<%= config[:ruboty_plugin_constant_name] %>::Actions::<%= config[:ruboty_plugin_constant_name] %>.new(message).call
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Ruboty
2
+ module <%= config[:ruboty_plugin_constant_name] %>
3
+ module Actions
4
+ class <%= config[:ruboty_plugin_constant_name] %> < Ruboty::Actions::Base
5
+ def call
6
+ message.reply("@#{message.from_name} TODO: write a message.")
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruboty-gen
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - block_given?
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruboty
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: '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
+ - block_given@outlook.com
58
+ executables:
59
+ - ruboty-gen
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/ruboty-gen
69
+ - lib/ruboty/gen.rb
70
+ - lib/ruboty/gen/cli.rb
71
+ - lib/ruboty/gen/gem.rb
72
+ - lib/ruboty/gen/version.rb
73
+ - ruboty-gen.gemspec
74
+ - templates/newgem/lib/newgem.rb.tt
75
+ - templates/newgem/newgem.gemspec.tt
76
+ - templates/ruboty/handlers/newgem.rb.tt
77
+ - templates/ruboty/newgem/actions/newgem.rb.tt
78
+ homepage: https://github.com/blockgiven/ruboty-gen
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.2.2
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: generators for creating ruboty plugin.
102
+ test_files: []