smart_buttons 0.1.0

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: 697ad2e2668eda9a08807387a0a98533339f6be59ed431f1372f0a4e6302a66a
4
+ data.tar.gz: ab810a26be67c346e339529686f3081693dc591b74e5e211d02febc7c95882bb
5
+ SHA512:
6
+ metadata.gz: f0bcc6c5ebf5bbf69b2b7c95d5336bc50c387954ce7342ab4d0f68166b2d5849c26491babaf864c27714b389ee0bee3c9b7c24aed4335f2f5534f05294570708
7
+ data.tar.gz: cc5386fa0cac1cfa3e61892309439830803e03f51b24a53463c36a8b9bcaa054770e5133d41c33af280760b2b15f8af03c8c3722b115c7f6af29ac242e77a50c
@@ -0,0 +1,19 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v1
10
+ - name: Set up Ruby
11
+ uses: actions/setup-ruby@v1
12
+ with:
13
+ ruby-versions: 2.6.5, 2.7.0, 2.5.7, 2.4.9
14
+ - name: Build and test with Rake
15
+ run: |
16
+ gem install bundler -v '1.17.2'
17
+ bundle install --jobs 4 --retry 3
18
+ bundle exec rspec
19
+ rubocop
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,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,29 @@
1
+ Documentation:
2
+ Enabled: false
3
+ Metrics/LineLength:
4
+ Max: 120
5
+ Metrics/BlockLength:
6
+ Enabled: false
7
+ Include:
8
+ - spec/
9
+ Metrics/AbcSize:
10
+ Max: 18
11
+ Style/ClassAndModuleChildren:
12
+ EnforcedStyle: compact
13
+ Exclude:
14
+ - config/application.rb
15
+ Layout/ArgumentAlignment:
16
+ EnforcedStyle: with_fixed_indentation
17
+ Style/MixinUsage:
18
+ Exclude:
19
+ - bin/*
20
+ AllCops:
21
+ Include:
22
+ - app/**/*.rb
23
+ - config/**/*.rb
24
+ - db/seeds.rb
25
+ - lib/**/*.rb
26
+ - spec/**/*.rb
27
+ - Gemfile
28
+ - Rakefile
29
+ TargetRubyVersion: 2.7
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ language: ruby
5
+ rvm:
6
+ - 2.7.0
7
+ - 2.6.5
8
+ - 2.5.7
9
+ - 2.4.9
10
+ script:
11
+ - bundle exec rspec
12
+ - rubocop
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,92 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ smart_buttons (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionview (6.0.2.1)
10
+ activesupport (= 6.0.2.1)
11
+ builder (~> 3.1)
12
+ erubi (~> 1.4)
13
+ rails-dom-testing (~> 2.0)
14
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
15
+ activesupport (6.0.2.1)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 0.7, < 2)
18
+ minitest (~> 5.1)
19
+ tzinfo (~> 1.1)
20
+ zeitwerk (~> 2.2)
21
+ ast (2.4.0)
22
+ builder (3.2.4)
23
+ coderay (1.1.2)
24
+ concurrent-ruby (1.1.5)
25
+ crass (1.0.6)
26
+ diff-lcs (1.3)
27
+ erubi (1.9.0)
28
+ i18n (1.8.2)
29
+ concurrent-ruby (~> 1.0)
30
+ jaro_winkler (1.5.4)
31
+ loofah (2.4.0)
32
+ crass (~> 1.0.2)
33
+ nokogiri (>= 1.5.9)
34
+ method_source (0.9.2)
35
+ mini_portile2 (2.4.0)
36
+ minitest (5.14.0)
37
+ nokogiri (1.10.7)
38
+ mini_portile2 (~> 2.4.0)
39
+ parallel (1.19.1)
40
+ parser (2.7.0.2)
41
+ ast (~> 2.4.0)
42
+ pry (0.12.2)
43
+ coderay (~> 1.1.0)
44
+ method_source (~> 0.9.0)
45
+ rails-dom-testing (2.0.3)
46
+ activesupport (>= 4.2.0)
47
+ nokogiri (>= 1.6)
48
+ rails-html-sanitizer (1.3.0)
49
+ loofah (~> 2.3)
50
+ rainbow (3.0.0)
51
+ rake (10.5.0)
52
+ rspec (3.9.0)
53
+ rspec-core (~> 3.9.0)
54
+ rspec-expectations (~> 3.9.0)
55
+ rspec-mocks (~> 3.9.0)
56
+ rspec-core (3.9.1)
57
+ rspec-support (~> 3.9.1)
58
+ rspec-expectations (3.9.0)
59
+ diff-lcs (>= 1.2.0, < 2.0)
60
+ rspec-support (~> 3.9.0)
61
+ rspec-mocks (3.9.1)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.9.0)
64
+ rspec-support (3.9.2)
65
+ rubocop (0.79.0)
66
+ jaro_winkler (~> 1.5.1)
67
+ parallel (~> 1.10)
68
+ parser (>= 2.7.0.1)
69
+ rainbow (>= 2.2.2, < 4.0)
70
+ ruby-progressbar (~> 1.7)
71
+ unicode-display_width (>= 1.4.0, < 1.7)
72
+ ruby-progressbar (1.10.1)
73
+ thread_safe (0.3.6)
74
+ tzinfo (1.2.6)
75
+ thread_safe (~> 0.1)
76
+ unicode-display_width (1.6.0)
77
+ zeitwerk (2.2.2)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ actionview
84
+ bundler (~> 1.17)
85
+ pry
86
+ rake (~> 10.0)
87
+ rspec (~> 3.0)
88
+ rubocop
89
+ smart_buttons!
90
+
91
+ BUNDLED WITH
92
+ 1.17.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Pavel Kalashnikov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # SmartButtons
2
+
3
+ Replacement of magical `link_to` method with static HTML
4
+ TODO: Delete this and the text above, and describe your gem
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'smart_buttons'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install smart_buttons
21
+
22
+ ## Usage
23
+
24
+ **Don't forget include SmartButtons to your ApplicationHelper**
25
+
26
+ *app/helpers/application_helper.rb*
27
+ ```ruby
28
+ module ApplicationHelper
29
+ include SmartButtons
30
+ end
31
+ ```
32
+
33
+ ### HTTP / DELETE
34
+
35
+ If you need button with HTTP/DELETE method, just use
36
+
37
+ ```
38
+ delete_button url, form_options: { class: :some_form_class }, button_options: { class: :some_button_class } do
39
+ here_content_which_will_be_inside_of_button
40
+ end
41
+ ```
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/smart_buttons.
46
+
47
+ ## License
48
+
49
+ 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,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/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'smart_buttons'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
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,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SmartButtons
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'smart_buttons/version'
4
+
5
+ module SmartButtons
6
+ def delete_button(url, form_options: {}, button_options: {})
7
+ form_tag url, method: :delete, **form_options do
8
+ button_tag(**button_options) do
9
+ yield if block_given?
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,29 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "smart_buttons/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "smart_buttons"
8
+ spec.version = SmartButtons::VERSION
9
+ spec.authors = ["Pavel Kalashnikov"]
10
+ spec.email = ["kalashnikovisme@gmail.com"]
11
+
12
+ spec.summary = %q{Replacement of Rails `link_to` method with static HTML}
13
+ spec.description = %q{Replacement of Rails `link_to` method with static HTML}
14
+ spec.homepage = 'https://github.com/kalashnikovisme/smart_buttons'
15
+ spec.license = 'MIT'
16
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| 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_development_dependency 'bundler', '~> 1.17'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rspec', '~> 3.0'
26
+ spec.add_development_dependency 'pry'
27
+ spec.add_development_dependency 'actionview'
28
+ spec.add_development_dependency 'rubocop'
29
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smart_buttons
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Pavel Kalashnikov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-01-25 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.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: actionview
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Replacement of Rails `link_to` method with static HTML
98
+ email:
99
+ - kalashnikovisme@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".github/workflows/ruby.yml"
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".rubocop.yml"
108
+ - ".travis.yml"
109
+ - Gemfile
110
+ - Gemfile.lock
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - lib/smart_buttons.rb
117
+ - lib/smart_buttons/version.rb
118
+ - smart_buttons.gemspec
119
+ homepage: https://github.com/kalashnikovisme/smart_buttons
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubygems_version: 3.0.3
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: Replacement of Rails `link_to` method with static HTML
142
+ test_files: []