pattern_bibz 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
+ SHA256:
3
+ metadata.gz: 7fe8d6514ef5de5b312c58f18a744eb8eaef8fbd0647f3fb3109816d4a30396e
4
+ data.tar.gz: 021efc4f47bc1b8134c668c261092661abbecd38b44e2c9c0900691a0efb9b86
5
+ SHA512:
6
+ metadata.gz: ad8fc41cbd8aeab76cf96740fd80b620aca8aa5dc7ed9882b519581015b7e4757677b54aefa358f67334739970d3bc614e6763b8ac9b332f936b90da87ab1264
7
+ data.tar.gz: 6a4c5ed8ef6869723bd944418e946dc97df9e5134cda9a4762b3e5f54c039919ec77a37c7dcfe0109f9efd2152eb6857463014cae42734ffd462f29de3da2798
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Thomas HUMMEL
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # PatternBibz
2
+ Rails Ruby Pattern Generator.
3
+ This gem allows to generate your design pattern through the ralis generator.
4
+
5
+ ## Usage
6
+ ```bash
7
+ rails generate pattern PATTERN_NAME
8
+ ```
9
+
10
+ ## Example
11
+ ```bash
12
+ rails generate pattern MyCustomDecorator
13
+ ```
14
+
15
+ This will create:
16
+ app/decorators/application_decorator.rb
17
+ app/decorators/my_custom_decorator.rb
18
+ test/decorators/application_decoratior_test.rb
19
+ test/decorators/my_custom_decorator_test.rb
20
+
21
+ ## Installation
22
+ Add this line to your application's Gemfile:
23
+
24
+ ```ruby
25
+ gem 'pattern_bibz'
26
+ ```
27
+
28
+ And then execute:
29
+ ```bash
30
+ $ bundle
31
+ ```
32
+
33
+ Or install it yourself as:
34
+ ```bash
35
+ $ gem install pattern_bibz
36
+ ```
37
+
38
+ ## Contributing
39
+ Contribution directions go here.
40
+
41
+ ## License
42
+ 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,27 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'PatternBibz'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'test'
23
+ t.pattern = 'test/**/*_test.rb'
24
+ t.verbose = false
25
+ end
26
+
27
+ task default: :test
@@ -0,0 +1,11 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate pattern MyCustomDecorator
6
+
7
+ This will create:
8
+ app/decorators/application_decorator.rb
9
+ app/decorators/my_custom_decorator.rb
10
+ test/decorators/application_decoratior_test.rb
11
+ test/decorators/my_custom_decorator_test.rb
@@ -0,0 +1,45 @@
1
+ # Generate template files and tests with a patten name
2
+ class PatternGenerator < Rails::Generators::NamedBase
3
+ source_root File.expand_path('templates', __dir__)
4
+
5
+ def create_application_pattern_file
6
+ @pattern_name = file_name.split('_').last
7
+ application_file_name = "app/#{@pattern_name.pluralize}/application_#{@pattern_name}.rb"
8
+
9
+ return if File.exist?(application_file_name)
10
+
11
+ create_file application_file_name, <<~FILE
12
+ class Application#{@pattern_name.titleize}
13
+ end
14
+ FILE
15
+ end
16
+
17
+ def create_app_pattern_file
18
+ create_file "app/#{@pattern_name.pluralize}/#{file_name}.rb", <<~FILE
19
+ class #{class_name} < Application#{@pattern_name.titleize}
20
+ end
21
+ FILE
22
+ end
23
+
24
+ def create_test_application_pattern_file
25
+ application_file_name = "test/#{@pattern_name.pluralize}/application_#{@pattern_name}_test.rb"
26
+
27
+ return if File.exist?(application_file_name)
28
+
29
+ create_file application_file_name, <<~FILE
30
+ require 'test_helper'
31
+
32
+ class Application#{@pattern_name.titleize}Test < ActiveSupport::TestCase
33
+ end
34
+ FILE
35
+ end
36
+
37
+ def create_test_pattern_file
38
+ create_file "test/#{@pattern_name.pluralize}/#{file_name}_test.rb", <<~FILE
39
+ require 'test_helper'
40
+
41
+ class #{class_name}Test < ActiveSupport::TestCase
42
+ end
43
+ FILE
44
+ end
45
+ end
@@ -0,0 +1,4 @@
1
+ module PatternBibz
2
+ class Railtie < ::Rails::Railtie
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module PatternBibz
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1,5 @@
1
+ require "pattern_bibz/railtie"
2
+
3
+ module PatternBibz
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :pattern_bibz do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pattern_bibz
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Thomas HUMMEL
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 6.0.2
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 6.0.2.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 6.0.2
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 6.0.2.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: sqlite3
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: overcommit
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rubocop
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ description: 'Generate your pattern files through this generator: Eq. rails g pattern
76
+ MyCustomDecorator'
77
+ email:
78
+ - thomas@hummel.link
79
+ executables: []
80
+ extensions: []
81
+ extra_rdoc_files: []
82
+ files:
83
+ - MIT-LICENSE
84
+ - README.md
85
+ - Rakefile
86
+ - lib/generators/pattern/USAGE
87
+ - lib/generators/pattern/pattern_generator.rb
88
+ - lib/pattern_bibz.rb
89
+ - lib/pattern_bibz/railtie.rb
90
+ - lib/pattern_bibz/version.rb
91
+ - lib/tasks/pattern_bibz_tasks.rake
92
+ homepage: http://thooams.github.io/pattern_bibz
93
+ licenses:
94
+ - MIT
95
+ metadata:
96
+ allowed_push_host: https://rubygems.org
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubygems_version: 3.1.2
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Rails Pattern generator
116
+ test_files: []