myopic 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +12 -17
- data/lib/myopic/version.rb +1 -1
- data/lib/patch_rails_form_template.bash +27 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 709d0c3ad85d8b901017370f6ac41681d1469748c32484e20795807f6797dc70
|
4
|
+
data.tar.gz: 44b08b471ccaf0356df7c8c18ab15d404bd9c21806ded8022a0d2076b9aa66c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd7910b594136cb14745ce6f3a8a1740a2ff909abd340f3381352749335bb8fbcb24b7f53a8f61682b24cbe5e8d455119b5d9be59231f62b7d0e4aace4f9ec8c
|
7
|
+
data.tar.gz: 293461dc751261d0454607b539bdad618ec6a9f92561b2557a41cced0d3914e094d29e12575c3905920faccce4785c0dfe550cdbaf99394ea7a6a4bde99e3bf4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,30 +1,28 @@
|
|
1
1
|
# Myopic
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
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/myopic`. To experiment with that code, run `bin/console` for an interactive prompt.
|
3
|
+
Myopic is a Rails utility library to get you to your first prototype quickly.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
-
|
11
7
|
Install the gem and add to the application's Gemfile by executing:
|
12
8
|
|
13
|
-
$ bundle add
|
14
|
-
|
15
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
|
-
|
17
|
-
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
9
|
+
$ bundle add myopic
|
18
10
|
|
19
11
|
## Usage
|
20
12
|
|
21
|
-
|
13
|
+
To include Simple CSS tags, add this to your view layout file:
|
14
|
+
<%= Myopic::simple_css %>
|
22
15
|
|
23
|
-
|
16
|
+
To get links to all of the resource-routes (we find them by filtering on anything starting with "new_"), add this:
|
17
|
+
<nav>
|
18
|
+
<% Myopic::rails_resources.each do |resource| %>
|
19
|
+
<%= Myopic::link_to_resource resource %> |
|
20
|
+
<% end %>
|
21
|
+
</nav>
|
24
22
|
|
25
|
-
|
23
|
+
## Development
|
26
24
|
|
27
|
-
|
25
|
+
This section coming soon.
|
28
26
|
|
29
27
|
## Contributing
|
30
28
|
|
@@ -34,6 +32,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
|
|
34
32
|
|
35
33
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
36
34
|
|
37
|
-
## Code of Conduct
|
38
|
-
|
39
|
-
Everyone interacting in the Myopic project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/myopic/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/myopic/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
#patch_rails_form_template
|
4
|
+
|
5
|
+
tpl_form_file=$(find $(gem env home)/gems -name 'railties-[0-9\.]*' | sort -r | head -1)/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt
|
6
|
+
#tpl_form_file=$(find $(gem env home)/gems -name 'railties-[0-9].[0-9].[0-9].[0-9]' | sort -r | head -1)/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt
|
7
|
+
|
8
|
+
check_extract=$(sed '27q;d' $tpl_form_file)
|
9
|
+
|
10
|
+
if [ "$check_extract" == '<% else -%>' ]; then # zsh needs a single equals
|
11
|
+
echo 'matches expected format'
|
12
|
+
else
|
13
|
+
echo 'unexpected file structure'
|
14
|
+
exit
|
15
|
+
fi
|
16
|
+
|
17
|
+
cat <<EOF > tpl_form_file.patch
|
18
|
+
26a27,29
|
19
|
+
> <% elsif attribute.reference? -%>
|
20
|
+
> <%%= form.label :<%= attribute.column_name %>, style: "display: block" %>
|
21
|
+
> <%%= form.collection_select :<%= attribute.column_name %>, <%= attribute.name.camelize %>.all, :id, :name, prompt: true %>
|
22
|
+
EOF
|
23
|
+
|
24
|
+
#cp $tpl_form_file .
|
25
|
+
#patch _form.html.erb.tt tpl_form_file.patch
|
26
|
+
|
27
|
+
patch $tpl_form_file tpl_form_file.patch
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myopic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katkam Nitin Reddy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- Rakefile
|
27
27
|
- lib/myopic.rb
|
28
28
|
- lib/myopic/version.rb
|
29
|
+
- lib/patch_rails_form_template.bash
|
29
30
|
- sig/myopic.rbs
|
30
31
|
homepage:
|
31
32
|
licenses:
|