modelve 0.0.1

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: d9fdd740fb380f6dad11acaaef031e59ef3702338790512439b8b97bdba95ce3
4
+ data.tar.gz: d68aca4a8b310b829954db186c24c3c3281fac404995637e154b93bbbaa9579f
5
+ SHA512:
6
+ metadata.gz: 55c0f7a84eb79fa2946fc4b6de7d870cc086b107012e016959c1b378fd4eede6958367e19afbc8c582393794fcbb3e801329a301eb75381a970c040e57001ffe
7
+ data.tar.gz: 33ad332db86f5985c4f87cdcea0cc27a0bf0d514fd47338d826846c431fb1d7221fc7627c5d2dbae6e7abdcf21ed3c2d7c81d7c71fb9603201c8105ac3e876ed
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2021 Edouard Piron
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,39 @@
1
+ # Modelve
2
+
3
+ Inspect datamodel.
4
+
5
+ ## Usage
6
+
7
+ Run dedicated tasks:
8
+
9
+ - ...
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ group :development do
17
+ gem 'modelve'
18
+ end
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ ```bash
24
+ $ bundle
25
+ ```
26
+
27
+ Or install it yourself as:
28
+
29
+ ```bash
30
+ $ gem install modelve
31
+ ```
32
+
33
+ ## Contributing
34
+
35
+ This gem is still a work in progress. You can use GitHub issue to start a discussion.
36
+
37
+ ## License
38
+
39
+ 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,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/setup"
4
+
5
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
6
+ load "rails/tasks/engine.rake"
7
+
8
+ load "rails/tasks/statistics.rake"
9
+
10
+ require "bundler/gem_tasks"
11
+
12
+ require "rake/testtask"
13
+
14
+ Rake::TestTask.new(:test) do |t|
15
+ t.libs << "test"
16
+ t.pattern = "test/**/*_test.rb"
17
+ t.verbose = false
18
+ end
19
+
20
+ task default: :test
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Modelve
4
+ # Makes Rails aware of the tasks
5
+ class Railtie < Rails::Railtie
6
+ rake_tasks do
7
+ load "tasks/modelve/inspect.rake"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Modelve
4
+ VERSION = "0.0.1"
5
+ end
data/lib/modelve.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "modelve/version"
4
+ require "modelve/railtie" if defined?(Rails)
5
+
6
+ # Entrypoint
7
+ module Modelve
8
+ # TODO: configuration
9
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "csv"
4
+
5
+ namespace :modelve do
6
+ desc "Find unused elements"
7
+ task :unused do
8
+ targets = {
9
+ helpers: ["file_path", "line", "name", "count"],
10
+ constants: ["file_path", "line", "name", "count"],
11
+ partials: ["file_path", "count"]
12
+ }
13
+
14
+ targets.each do |target, headers|
15
+ require "modelve/unused/#{target}"
16
+
17
+ elements = "Modelve::Unused::#{target.capitalize}".constantize.new.call
18
+ elements.sort_by! { |element| element[:count] }
19
+
20
+ # create /modelve directory
21
+ FileUtils.mkdir_p(Rails.root.join("modelve")) unless File.directory?(Rails.root.join("modelve"))
22
+ # create modelve/<target>.csv and write elements data
23
+ CSV.open(Rails.root.join("modelve/#{target}.csv"), "w") do |csv|
24
+ csv << headers
25
+ elements.sort_by(&:count).each do |element|
26
+ csv << element.values
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: modelve
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Edouard Piron
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-03-23 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.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.1'
27
+ description: Collection of tasks to help find out debt.
28
+ email:
29
+ - ed.piron@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - lib/modelve.rb
38
+ - lib/modelve/railtie.rb
39
+ - lib/modelve/version.rb
40
+ - lib/tasks/modelve/unused.rake
41
+ homepage: https://github.com/perangusta/modelve
42
+ licenses:
43
+ - MIT
44
+ metadata:
45
+ homepage_uri: https://github.com/perangusta/modelve
46
+ source_code_uri: https://github.com/perangusta/modelve
47
+ changelog_uri: https://github.com/perangusta/modelve/CHANGELOG.md
48
+ rubygems_mfa_required: 'true'
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '3.0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubygems_version: 3.2.32
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Collection of tasks to help find out debt.
68
+ test_files: []