interage-helpers 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +4 -0
  4. data/.rubocop.yml +22 -0
  5. data/.travis.yml +7 -0
  6. data/Gemfile +22 -0
  7. data/Gemfile.lock +80 -0
  8. data/README.md +216 -0
  9. data/Rakefile +8 -0
  10. data/bin/brakeman +29 -0
  11. data/bin/bundle +105 -0
  12. data/bin/ci +12 -0
  13. data/bin/console +14 -0
  14. data/bin/rspec +29 -0
  15. data/bin/rubocop +29 -0
  16. data/bin/setup +8 -0
  17. data/interage-helpers.gemspec +43 -0
  18. data/lib/generators/interage/helper/install/USAGE +8 -0
  19. data/lib/generators/interage/helper/install/install_generator.rb +26 -0
  20. data/lib/generators/interage/helper/install/templates/application_helper.rb +5 -0
  21. data/lib/generators/interage/helper/install/templates/application_helper.yml +124 -0
  22. data/lib/interage/application_helper.rb +64 -0
  23. data/lib/interage/application_icon_helper.rb +28 -0
  24. data/lib/interage/bootstrap_helper.rb +68 -0
  25. data/lib/interage/cep_helper.rb +11 -0
  26. data/lib/interage/cnpj_helper.rb +11 -0
  27. data/lib/interage/cocoon_helper.rb +26 -0
  28. data/lib/interage/controller_active_helper.rb +23 -0
  29. data/lib/interage/cpf_helper.rb +11 -0
  30. data/lib/interage/date_time_helper.rb +27 -0
  31. data/lib/interage/favicon_helper.rb +31 -0
  32. data/lib/interage/flash_message_helper.rb +21 -0
  33. data/lib/interage/font_awesome_helper.rb +30 -0
  34. data/lib/interage/gravatar_helper.rb +13 -0
  35. data/lib/interage/helpers/version.rb +7 -0
  36. data/lib/interage/helpers.rb +33 -0
  37. data/lib/interage/link_to_helper.rb +65 -0
  38. data/lib/interage/material_design_icons_helper.rb +25 -0
  39. data/lib/interage/number_helper.rb +13 -0
  40. data/lib/interage/pagination_helper.rb +11 -0
  41. data/lib/interage/parsers/parser_cep.rb +29 -0
  42. data/lib/interage/parsers/parser_cnpj.rb +37 -0
  43. data/lib/interage/parsers/parser_cpf.rb +37 -0
  44. data/lib/interage/parsers/parser_phone.rb +49 -0
  45. data/lib/interage/phone_helper.rb +11 -0
  46. data/lib/interage/text_helper.rb +13 -0
  47. data/lib/interage/translation_helper.rb +127 -0
  48. data/lib/interage/version_helper.rb +21 -0
  49. metadata +136 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 27b972d490cd2db68dc116b22cdaa81c78553722ed5247d83de4057161fbb832
4
+ data.tar.gz: 47caf7f7dd96d6cb2e12461eb6f261d336b343167fc37aae460545953f177beb
5
+ SHA512:
6
+ metadata.gz: da669f0b9ef5f770feea456e440fde1500434a08fe2e5f83ae2c66ac0daa1c130cbec490028a09bff74863e028bf1ef0a895cbe3d80241eada8345b92ee46acc
7
+ data.tar.gz: 943f27c894e0343717296a67205ba6caacc1145368018b1adf4ac4efd7578f266836f19dbe8e77d9291002e71973abbc152a75f894c8c77be2361d55c385c9b1
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --force-color
4
+ --order rand
data/.rubocop.yml ADDED
@@ -0,0 +1,22 @@
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-performance
4
+
5
+ Documentation:
6
+ Enabled: false
7
+
8
+ Style/EmptyMethod:
9
+ Enabled: false
10
+
11
+ Style/SymbolArray:
12
+ Enabled: false
13
+
14
+ Style/WordArray:
15
+ Enabled: false
16
+
17
+ AllCops:
18
+ TargetRubyVersion: 2.6
19
+ Exclude:
20
+ - bin/**/*
21
+ - vendor/**/*
22
+ - lib/generators/interage/helpers/*/templates/**/*.rb
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.2
7
+ before_install: gem install bundler -v 2.0.1
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ group :development, :test do
8
+ # https://github.com/rubocop-hq/rubocop#quickstart
9
+ gem 'rubocop', '~> 0.67.2'
10
+ # https://github.com/backus/rubocop-rspec
11
+ gem 'rubocop-rspec', '~> 1.32'
12
+ # https://github.com/rubocop-hq/rubocop-performance/#usage
13
+ gem 'rubocop-performance', '~> 1.1'
14
+ # https://github.com/rspec/rspec#install
15
+ gem 'rspec', '~> 3.8'
16
+ # https://github.com/pry/pry#installation
17
+ gem 'pry', '~> 0.12.2'
18
+ # https://github.com/presidentbeef/brakeman
19
+ gem 'brakeman', '~> 4.3', '>= 4.3.1', require: false
20
+ # https://github.com/rails/rails/tree/master/activesupport#download-and-installation
21
+ gem 'activesupport', '~> 5.2', '>= 5.2.3'
22
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,80 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ interage-helpers (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (5.2.4.2)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 0.7, < 2)
12
+ minitest (~> 5.1)
13
+ tzinfo (~> 1.1)
14
+ ast (2.4.0)
15
+ brakeman (4.8.1)
16
+ coderay (1.1.2)
17
+ concurrent-ruby (1.1.6)
18
+ diff-lcs (1.3)
19
+ i18n (1.8.2)
20
+ concurrent-ruby (~> 1.0)
21
+ jaro_winkler (1.5.4)
22
+ method_source (0.9.2)
23
+ minitest (5.14.0)
24
+ parallel (1.19.1)
25
+ parser (2.7.1.0)
26
+ ast (~> 2.4.0)
27
+ pry (0.12.2)
28
+ coderay (~> 1.1.0)
29
+ method_source (~> 0.9.0)
30
+ psych (3.1.0)
31
+ rainbow (3.0.0)
32
+ rake (10.5.0)
33
+ rspec (3.9.0)
34
+ rspec-core (~> 3.9.0)
35
+ rspec-expectations (~> 3.9.0)
36
+ rspec-mocks (~> 3.9.0)
37
+ rspec-core (3.9.1)
38
+ rspec-support (~> 3.9.1)
39
+ rspec-expectations (3.9.1)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.9.0)
42
+ rspec-mocks (3.9.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.9.0)
45
+ rspec-support (3.9.2)
46
+ rubocop (0.67.2)
47
+ jaro_winkler (~> 1.5.1)
48
+ parallel (~> 1.10)
49
+ parser (>= 2.5, != 2.5.1.1)
50
+ psych (>= 3.1.0)
51
+ rainbow (>= 2.2.2, < 4.0)
52
+ ruby-progressbar (~> 1.7)
53
+ unicode-display_width (>= 1.4.0, < 1.6)
54
+ rubocop-performance (1.1.0)
55
+ rubocop (>= 0.67.0)
56
+ rubocop-rspec (1.35.0)
57
+ rubocop (>= 0.60.0)
58
+ ruby-progressbar (1.10.1)
59
+ thread_safe (0.3.6)
60
+ tzinfo (1.2.7)
61
+ thread_safe (~> 0.1)
62
+ unicode-display_width (1.5.0)
63
+
64
+ PLATFORMS
65
+ ruby
66
+
67
+ DEPENDENCIES
68
+ activesupport (~> 5.2, >= 5.2.3)
69
+ brakeman (~> 4.3, >= 4.3.1)
70
+ bundler (~> 2.0)
71
+ interage-helpers!
72
+ pry (~> 0.12.2)
73
+ rake (~> 10.0)
74
+ rspec (~> 3.8)
75
+ rubocop (~> 0.67.2)
76
+ rubocop-performance (~> 1.1)
77
+ rubocop-rspec (~> 1.32)
78
+
79
+ BUNDLED WITH
80
+ 2.1.4
data/README.md ADDED
@@ -0,0 +1,216 @@
1
+
2
+ # Interage::Helper
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'interage-helpers', '~> 0.1.4'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ ```bash
15
+ bundle install
16
+ ```
17
+
18
+ Or install it yourself as:
19
+
20
+ ```bash
21
+ gem install interage-helpers
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ You can use a Rails generator to create `ApplicationHelper` and add locales file:
27
+
28
+ ```bash
29
+ rails g interage:helpers:install
30
+ ```
31
+
32
+ If you want to overwrite some variables:
33
+
34
+ ```env
35
+ ### APPLICATION HELPER
36
+ ## Interage::ApplicationHelpers
37
+ #
38
+ APP_NAME='Nome da Aplicação'
39
+ ENV_NAME='development'
40
+ PREFIX_ADMIN_PAGE_TITLE='Administração :: '
41
+ PREFIX_DEVISE_PAGE_TITLE='Autenticação :: '
42
+
43
+ ## Interage::ApplicationIconHelper
44
+ #
45
+ # Use 'fa' or 'md'
46
+ DEFAULT_FONT_ICON='fa'
47
+
48
+ ## Interage::CocoonHelper
49
+ #
50
+ DEFAULT_BTN_TYPE_CLASS='btn btn-sm btn-outline-'
51
+
52
+ ## Interage::ControllerActiveHelper
53
+ #
54
+ CONTROLLER_SHOW_CLASS='show'
55
+ CONTROLLER_ACTIVE_CLASS='active'
56
+
57
+ ## Interage::FaviconHelper
58
+ #
59
+ FAVICON_EXTENTION='png'
60
+ FAVICON_FILE_NAME='icons/apple-touch-icon'
61
+ ```
62
+
63
+ ## Finally ... Some examples:
64
+
65
+ #### Interage::LinkToHelper
66
+
67
+ ```erb
68
+ <%= link_to_edit edit_user_path(user) %>
69
+ <%= link_to_back :back %>
70
+ <%= link_to_show user_path(user) %>
71
+ <%= link_to_destroy user_path(user) %>
72
+ <%= link_to_new User, users_path %>
73
+ ```
74
+
75
+ #### Interage::ApplicationIconHelper
76
+
77
+ ```erb
78
+ <%= app_icon('user', class: 'text-muted') %>
79
+ <%= app_icon_text('users', 'Usuários', class: 'text-muted') %>
80
+ ```
81
+
82
+ #### Interage::FontAwesomeHelper
83
+
84
+ ```erb
85
+ <%= fa_icon('user', class: 'text-muted') %>
86
+ <%= fa_icon_text('users', 'Usuários', class: 'text-muted') %>
87
+ ```
88
+
89
+ #### Interage::MaterialDesignIconsHelper
90
+
91
+ ```erb
92
+ <%= md_icon('user', class: 'text-muted') %>
93
+ <%= md_icon_text('users', 'Usuários', class: 'text-muted') %>
94
+ ```
95
+
96
+ #### Interage::VersionHelper
97
+
98
+ ```erb
99
+ <%= app_version %>
100
+ <%= app_text_version %>
101
+ ```
102
+
103
+ #### Interage::TranslationHelper
104
+
105
+ ```erb
106
+ <%= tm(User) %>
107
+ <%= tmp(User) %>
108
+ <%= ta(User, :name) %>
109
+ <%= tb(false) %>
110
+ <%= tb(true) %>
111
+ <%= tbi(false) %>
112
+ <%= tbi(true) %>
113
+ <%= tbci(false) %>
114
+ <%= tbci(true) %>
115
+ ```
116
+
117
+ #### Interage::TextHelper
118
+
119
+ ```erb
120
+ <%= nl2br("Hello\nWorld") %>
121
+ ```
122
+
123
+ #### Interage::PhoneHelper
124
+
125
+ ```erb
126
+ <%= format_phone('+5581987654321') %>
127
+ <%= format_phone('5581987654321') %>
128
+ <%= format_phone('081987654321') %>
129
+ <%= format_phone('81987654321') %>
130
+ <%= format_phone('8187654321') %>
131
+ <%= format_phone('987654321') %>
132
+ <%= format_phone('98765432') %>
133
+ ```
134
+
135
+ #### Interage::PaginationHelper
136
+
137
+ ```erb
138
+ <%= pagination_links(@users) %>
139
+ ```
140
+
141
+ #### Interage::NumberHelper
142
+
143
+ ```erb
144
+ <%= default_currency_format(10.57) %>
145
+ <%= default_currency_format(100.17) %>
146
+ <%= default_currency_format(1_000) %>
147
+ <%= default_currency_format(10_000) %>
148
+ <%= default_currency_format(1_000_000) %>
149
+ ```
150
+
151
+ #### Interage::GravatarHelper
152
+
153
+ ```erb
154
+ <%= gravatar_image_tag(user.email) %>
155
+ ```
156
+
157
+ #### Interage::ControllerActiveHelper
158
+
159
+ ```erb
160
+ <%= current_controller?('home') %>
161
+ <%= current_controller?('docs') %>
162
+ <%= menu_class_show('docs') %>
163
+ <%= menu_active('docs') %>
164
+ <%= current_controller?('home', 'docs') %>
165
+ <%= menu_class_show('home', 'docs') %>
166
+ <%= menu_active('home', 'docs') %>
167
+ ```
168
+
169
+ #### Interage::CEPHelper
170
+
171
+ ```erb
172
+ <%= format_cep('54754-195') %>
173
+ <%= format_cep('54754195') %>
174
+ ```
175
+
176
+ #### Interage::CNPJHelper
177
+
178
+ ```erb
179
+ <%= format_cnpj('08.475.876/0001-04') %>
180
+ <%= format_cnpj('08475876000104') %>
181
+ ```
182
+
183
+ #### Interage::CPFHelper
184
+
185
+ ```erb
186
+ <%= format_cpf('320.871.430-05') %>
187
+ <%= format_cpf('32087143005') %>
188
+ ```
189
+
190
+ #### Interage::ApplicationHelper
191
+
192
+ ```erb
193
+ <%= format_seconds(20) %>
194
+ <%= admin_page_title %>
195
+ <%= devise_page_title %>
196
+ <%= page_title %>
197
+ <%= app_name %>
198
+ <%= env_name_upcase %>
199
+ ```
200
+
201
+ #### Interage::BootstrapHelper
202
+
203
+ ```erb
204
+ <%= bootstrap_alert_info('Info message') %>
205
+ <%= bootstrap_alert_warning('Warning message') %>
206
+ <%= bootstrap_alert_success('Success message') %>
207
+ <%= bootstrap_alert_danger('Danger message') %>
208
+ <%= bootstrap_alert_not_found_male(User) %>
209
+ <%= bootstrap_alert_not_found_female(User) %>
210
+ <%= text_not_found_male(User) %>
211
+ <%= text_not_found_female(User) %>
212
+ ```
213
+
214
+ ## Contributing
215
+
216
+ Bug reports and merge requests are welcome on GitLab at https://gitlab.com/[USERNAME]/interage-helper.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/brakeman ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'brakeman' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("brakeman", "brakeman")
data/bin/bundle ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1 || ">= 0.a"
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||= begin
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version || "#{Gem::Requirement.default}.a"
67
+ end
68
+ end
69
+
70
+ def load_bundler!
71
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
72
+
73
+ # must dup string for RG < 1.8 compatibility
74
+ activate_bundler(bundler_version.dup)
75
+ end
76
+
77
+ def activate_bundler(bundler_version)
78
+ if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
79
+ bundler_version = "< 2"
80
+ end
81
+ gem_error = activation_error_handling do
82
+ gem "bundler", bundler_version
83
+ end
84
+ return if gem_error.nil?
85
+ require_error = activation_error_handling do
86
+ require "bundler/version"
87
+ end
88
+ return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
89
+ warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
90
+ exit 42
91
+ end
92
+
93
+ def activation_error_handling
94
+ yield
95
+ nil
96
+ rescue StandardError, LoadError => e
97
+ e
98
+ end
99
+ end
100
+
101
+ m.load_bundler!
102
+
103
+ if m.invoked_as_script?
104
+ load Gem.bin_path("bundler", "bundle")
105
+ end
data/bin/ci ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo -e "\e[1;36m$ bin/brakeman --force-scan \e[0m"
6
+ bin/brakeman --force-scan
7
+
8
+ echo -e "\e[1;36m$ bin/rubocop \e[0m"
9
+ bin/rubocop
10
+
11
+ echo -e "\e[1;36m$ bin/rspec \e[0m"
12
+ bin/rspec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "interage/helpers"
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/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
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
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'interage/helpers/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ CODE_URL = 'https://gitlab.com/interage/patterns/helpers'
9
+
10
+ spec.name = 'interage-helpers'
11
+ spec.version = Interage::Helper::VERSION
12
+ spec.authors = ['Walmir Neto']
13
+ spec.email = ['owalmirneto@gmail.com']
14
+
15
+ spec.summary = 'Application Helper for Interage'
16
+ spec.description = 'Classes to encapsulate helpers'
17
+ spec.homepage = CODE_URL
18
+ spec.licenses = ['MIT']
19
+
20
+ if spec.respond_to?(:metadata)
21
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
22
+
23
+ spec.metadata['homepage_uri'] = spec.homepage
24
+ spec.metadata['source_code_uri'] = CODE_URL
25
+ spec.metadata['changelog_uri'] = CODE_URL
26
+ else
27
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
28
+ 'public gem pushes.'
29
+ end
30
+
31
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
32
+ `git ls-files -z`.split("\x0").reject do |file|
33
+ file.match(%r{^(test|spec|features)/})
34
+ end
35
+ end
36
+ spec.bindir = 'exe'
37
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
+ spec.require_paths = ['lib']
39
+
40
+ spec.add_development_dependency 'bundler', '~> 2.0'
41
+ spec.add_development_dependency 'rake', '~> 10.0'
42
+ spec.add_development_dependency 'rspec', '~> 3.0'
43
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails g interage:helpers:install
6
+
7
+ This will create:
8
+ /app/helpers/application_helper.rb