bluehelmet-utils 0.1.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: d4ceae1651750b25345e02017b033ff8a8d767cf78771bbebbf265b1fbc0c24b
4
+ data.tar.gz: 90cc15bf84473bdffbdf1556e631278fa8f289ad95151998fa0d4352f7558c4a
5
+ SHA512:
6
+ metadata.gz: '059977ca6d6c9a019cf5053962496d63977727df4a2753eff136fa6658a8aa1bf01c314df8675ebe99056b1918a1d0cbdf7653bc93c2abe08ba209442f820545'
7
+ data.tar.gz: 1168bb1ec9523b315d3039dd9df3b76c334ad619807538fe17f8b5630077fa8982f2194d9d01cc998bd2396e4aad169ec6574b4a3325f6df914a13e7728c317e
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .idea/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in bluehelmet-utils.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,74 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bluehelmet-utils (0.1.0)
5
+ actionview
6
+ activesupport
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionview (5.2.1)
12
+ activesupport (= 5.2.1)
13
+ builder (~> 3.1)
14
+ erubi (~> 1.4)
15
+ rails-dom-testing (~> 2.0)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
17
+ activesupport (5.2.1)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ i18n (>= 0.7, < 2)
20
+ minitest (~> 5.1)
21
+ tzinfo (~> 1.1)
22
+ builder (3.2.3)
23
+ concurrent-ruby (1.0.5)
24
+ crass (1.0.4)
25
+ diff-lcs (1.3)
26
+ erubi (1.7.1)
27
+ i18n (1.1.1)
28
+ concurrent-ruby (~> 1.0)
29
+ loofah (2.2.2)
30
+ crass (~> 1.0.2)
31
+ nokogiri (>= 1.5.9)
32
+ mini_portile2 (2.3.0)
33
+ minitest (5.11.3)
34
+ nokogiri (1.8.5)
35
+ mini_portile2 (~> 2.3.0)
36
+ rails-dom-testing (2.0.3)
37
+ activesupport (>= 4.2.0)
38
+ nokogiri (>= 1.6)
39
+ rails-html-sanitizer (1.0.4)
40
+ loofah (~> 2.2, >= 2.2.2)
41
+ rake (10.4.2)
42
+ rspec (3.8.0)
43
+ rspec-core (~> 3.8.0)
44
+ rspec-expectations (~> 3.8.0)
45
+ rspec-mocks (~> 3.8.0)
46
+ rspec-core (3.8.0)
47
+ rspec-support (~> 3.8.0)
48
+ rspec-expectations (3.8.2)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.8.0)
51
+ rspec-mocks (3.8.0)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.8.0)
54
+ rspec-nc (0.3.0)
55
+ rspec (>= 3)
56
+ terminal-notifier (>= 1.4)
57
+ rspec-support (3.8.0)
58
+ terminal-notifier (2.0.0)
59
+ thread_safe (0.3.6)
60
+ tzinfo (1.2.5)
61
+ thread_safe (~> 0.1)
62
+
63
+ PLATFORMS
64
+ ruby
65
+
66
+ DEPENDENCIES
67
+ bluehelmet-utils!
68
+ bundler (~> 1.16)
69
+ rake (~> 10.0)
70
+ rspec (~> 3.2)
71
+ rspec-nc
72
+
73
+ BUNDLED WITH
74
+ 1.16.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 vaskaloidis
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,43 @@
1
+ # Bluehelmet::Utils
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bluehelmet/utils`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'bluehelmet-utils'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install bluehelmet-utils
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bluehelmet-utils. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Bluehelmet::Utils project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bluehelmet-utils/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bluehelmet/utils"
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/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
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "bluehelmet/utils/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bluehelmet-utils"
8
+ spec.version = Bluehelmet::Utils::VERSION
9
+ spec.authors = ["vaskaloidis"]
10
+ spec.email = ["vas.kaloidis@gmail.com"]
11
+
12
+ spec.summary = %q{Utils and helpers for Blue Helmet Projects}
13
+ spec.description = %q{HTML Tag View Helpers, and String Core-Extensions.}
14
+ spec.homepage = "http://www.bluehelmet.software"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = "http://www.github.com/vaskaloidis/bluehelmet-utils"
22
+ else
23
+ raise "RubyGems 2.0 or newer is required to protect against " \
24
+ "public gem pushes."
25
+ end
26
+
27
+ # Specify which files should be added to the gem when it is released.
28
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
29
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
30
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ spec.add_development_dependency "rspec", "~> 3.2"
37
+ spec.add_development_dependency "bundler", "~> 1.16"
38
+ spec.add_development_dependency "rake", "~> 10.0"
39
+ spec.add_development_dependency "rspec-nc"
40
+ spec.add_dependency "activesupport"
41
+ spec.add_dependency "actionview"
42
+
43
+ end
@@ -0,0 +1,37 @@
1
+ # Useful String methods for Jeweler: .true?, .to_b and .money
2
+ class String
3
+ # Returns true if the string is equal to 'true'
4
+ def true?
5
+ to_s == 'true'
6
+ end
7
+
8
+ # Returns true if String is explicitly equal to 'true'
9
+ # Returns false if String is explicitly equal to 'false'
10
+ # raise ArgumentError if any other String is evaluated
11
+ def to_b
12
+ if to_s == 'true'
13
+ true
14
+ elsif to_s == 'false'
15
+ false
16
+ else
17
+ # raise SyntaxError
18
+ raise ArgumentError 'String being evaluated by to_b can only be equal to True or False'
19
+ end
20
+ end
21
+
22
+ # Parses a number by converting it to a Double, formatting
23
+ # it as money, and then converting it back to String
24
+ # Example: $32.50 (String)
25
+ def money
26
+ to_d.money.to_s
27
+ end
28
+
29
+ # Undoes a titleize by addinig underscores and making lowercase
30
+ # returns String. ActionSupport alternative is `.parameterize`
31
+ # Example Nice Title -> nice_title (String)
32
+ def uglify
33
+ self.gsub(' ', '_').downcase
34
+ end
35
+
36
+
37
+ end
@@ -0,0 +1,5 @@
1
+ module Bluehelmet
2
+ module Utils
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,63 @@
1
+ require 'action_view'
2
+
3
+ module Bluehelmet
4
+ module ViewHelper
5
+ include ActionView::Helpers::TagHelper
6
+ include ActionView::Context
7
+
8
+ def div(element_name, &block)
9
+ tag.div class: element_name, id: element_name, &block
10
+ end
11
+
12
+ def row(&block)
13
+ tag.div class: 'row', &block
14
+ # tag.send(:div,class: 'row', &block)
15
+ end
16
+
17
+ def panel(&block)
18
+ tag.div class: 'panel panel-default', &block
19
+ end
20
+
21
+ def panel_heading(&block)
22
+ tag.div class: 'panel-heading', &block
23
+ end
24
+
25
+ def panel_body(&block)
26
+ tag.div class: 'panel-body', &block
27
+ end
28
+
29
+ def column2(&block)
30
+ tag.div class: 'col-xs-12 col-sm-2', &block
31
+ end
32
+
33
+ def column3(&block)
34
+ tag.div class: 'col-xs-12 col-sm-3', &block
35
+ end
36
+
37
+ def column4(&block)
38
+ tag.div class: 'col-xs-12 col-sm-4', &block
39
+ end
40
+
41
+ def column_half(&block)
42
+ tag.div class: 'col-xs-12 col-sm-6', &block
43
+ end
44
+
45
+ def column8(&block)
46
+ tag.div class: 'col-xs-12 col-sm-8', &block
47
+ end
48
+
49
+ def column10(&block)
50
+ tag.div class: 'col-xs-12 col-sm-10', &block
51
+ end
52
+
53
+ def column(&block)
54
+ tag.div class: 'col-xs-12', &block
55
+ end
56
+
57
+ def contact_support(msg = '')
58
+ Rails.logger.error(msg)
59
+ "#{msg} Contact Jeweler Support if the problem persists."
60
+ end
61
+
62
+ end
63
+ end
@@ -0,0 +1,9 @@
1
+ require "bluehelmet/utils/version"
2
+
3
+ require 'bluehelmet/utils/core_ext/String'
4
+ require 'bluehelmet/utils/view_helper'
5
+
6
+
7
+ module Bluehelmet
8
+ # Your code goes here...
9
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bluehelmet-utils
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - vaskaloidis
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-10-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
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
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-nc
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: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
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: actionview
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: HTML Tag View Helpers, and String Core-Extensions.
98
+ email:
99
+ - vas.kaloidis@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - bluehelmet-utils.gemspec
114
+ - lib/bluehelmet/utils.rb
115
+ - lib/bluehelmet/utils/core_ext/String.rb
116
+ - lib/bluehelmet/utils/version.rb
117
+ - lib/bluehelmet/utils/view_helper.rb
118
+ homepage: http://www.bluehelmet.software
119
+ licenses:
120
+ - MIT
121
+ metadata:
122
+ homepage_uri: http://www.bluehelmet.software
123
+ source_code_uri: http://www.github.com/vaskaloidis/bluehelmet-utils
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.7.6
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Utils and helpers for Blue Helmet Projects
144
+ test_files: []