stimulant 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +13 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +154 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/stimulant.rb +16 -0
- data/lib/stimulant/action.rb +32 -0
- data/lib/stimulant/controller.rb +14 -0
- data/lib/stimulant/data.rb +9 -0
- data/lib/stimulant/helper.rb +11 -0
- data/lib/stimulant/list.rb +22 -0
- data/lib/stimulant/railtie.rb +11 -0
- data/lib/stimulant/scope.rb +33 -0
- data/lib/stimulant/target.rb +16 -0
- data/lib/stimulant/version.rb +3 -0
- data/stimulant.gemspec +27 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 11c20750708a193a5311b75687287e8ee16fc750b2909f193dae5a7d882fae11
|
4
|
+
data.tar.gz: ebb56b60eccf6b1f695576d2b23face08f23cfa39543ed2c5daa2ef3e7d4a10f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b4d0a16064f5df113ce16fb2c07c04f8c6621345670bc2a48d718bcd9d8502ad6fd5ade4824103f022279e7fd336687f4fdf0ea2239ecb443d144408b23ca924
|
7
|
+
data.tar.gz: a5c115f160fba2f1ad992c81002a87cfe63b217ffcc7a3263a70d0dffcf9015139152663ffc9a2fc7790229d1529dbaa14c45c6cd646e4d1e15e1b71f89cb58c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at en30.git@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in stimulant.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem "onkcop", "~> 0.53", require: false
|
7
|
+
gem "rails"
|
8
|
+
gem "rake", ">= 11.0"
|
9
|
+
gem "rubocop", "~> 0.66", require: false
|
10
|
+
|
11
|
+
group :test do
|
12
|
+
gem "minitest", "~> 5.0"
|
13
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
stimulant (0.1.0)
|
5
|
+
activesupport (>= 5.1)
|
6
|
+
railties (>= 5.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.2.3)
|
12
|
+
actionpack (= 5.2.3)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailer (5.2.3)
|
16
|
+
actionpack (= 5.2.3)
|
17
|
+
actionview (= 5.2.3)
|
18
|
+
activejob (= 5.2.3)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.2.3)
|
22
|
+
actionview (= 5.2.3)
|
23
|
+
activesupport (= 5.2.3)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (>= 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.2.3)
|
29
|
+
activesupport (= 5.2.3)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.2.3)
|
35
|
+
activesupport (= 5.2.3)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.2.3)
|
38
|
+
activesupport (= 5.2.3)
|
39
|
+
activerecord (5.2.3)
|
40
|
+
activemodel (= 5.2.3)
|
41
|
+
activesupport (= 5.2.3)
|
42
|
+
arel (>= 9.0)
|
43
|
+
activestorage (5.2.3)
|
44
|
+
actionpack (= 5.2.3)
|
45
|
+
activerecord (= 5.2.3)
|
46
|
+
marcel (~> 0.3.1)
|
47
|
+
activesupport (5.2.3)
|
48
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
|
+
i18n (>= 0.7, < 2)
|
50
|
+
minitest (~> 5.1)
|
51
|
+
tzinfo (~> 1.1)
|
52
|
+
arel (9.0.0)
|
53
|
+
ast (2.4.0)
|
54
|
+
builder (3.2.3)
|
55
|
+
concurrent-ruby (1.1.5)
|
56
|
+
crass (1.0.4)
|
57
|
+
erubi (1.8.0)
|
58
|
+
globalid (0.4.2)
|
59
|
+
activesupport (>= 4.2.0)
|
60
|
+
i18n (1.6.0)
|
61
|
+
concurrent-ruby (~> 1.0)
|
62
|
+
jaro_winkler (1.5.2)
|
63
|
+
loofah (2.2.3)
|
64
|
+
crass (~> 1.0.2)
|
65
|
+
nokogiri (>= 1.5.9)
|
66
|
+
mail (2.7.1)
|
67
|
+
mini_mime (>= 0.1.1)
|
68
|
+
marcel (0.3.3)
|
69
|
+
mimemagic (~> 0.3.2)
|
70
|
+
method_source (0.9.2)
|
71
|
+
mimemagic (0.3.3)
|
72
|
+
mini_mime (1.0.1)
|
73
|
+
mini_portile2 (2.4.0)
|
74
|
+
minitest (5.11.3)
|
75
|
+
nio4r (2.3.1)
|
76
|
+
nokogiri (1.10.2)
|
77
|
+
mini_portile2 (~> 2.4.0)
|
78
|
+
onkcop (0.53.0.3)
|
79
|
+
rubocop (>= 0.53.0)
|
80
|
+
rubocop-rspec (>= 1.24.0)
|
81
|
+
parallel (1.16.2)
|
82
|
+
parser (2.6.2.0)
|
83
|
+
ast (~> 2.4.0)
|
84
|
+
psych (3.1.0)
|
85
|
+
rack (2.0.6)
|
86
|
+
rack-test (1.1.0)
|
87
|
+
rack (>= 1.0, < 3)
|
88
|
+
rails (5.2.3)
|
89
|
+
actioncable (= 5.2.3)
|
90
|
+
actionmailer (= 5.2.3)
|
91
|
+
actionpack (= 5.2.3)
|
92
|
+
actionview (= 5.2.3)
|
93
|
+
activejob (= 5.2.3)
|
94
|
+
activemodel (= 5.2.3)
|
95
|
+
activerecord (= 5.2.3)
|
96
|
+
activestorage (= 5.2.3)
|
97
|
+
activesupport (= 5.2.3)
|
98
|
+
bundler (>= 1.3.0)
|
99
|
+
railties (= 5.2.3)
|
100
|
+
sprockets-rails (>= 2.0.0)
|
101
|
+
rails-dom-testing (2.0.3)
|
102
|
+
activesupport (>= 4.2.0)
|
103
|
+
nokogiri (>= 1.6)
|
104
|
+
rails-html-sanitizer (1.0.4)
|
105
|
+
loofah (~> 2.2, >= 2.2.2)
|
106
|
+
railties (5.2.3)
|
107
|
+
actionpack (= 5.2.3)
|
108
|
+
activesupport (= 5.2.3)
|
109
|
+
method_source
|
110
|
+
rake (>= 0.8.7)
|
111
|
+
thor (>= 0.19.0, < 2.0)
|
112
|
+
rainbow (3.0.0)
|
113
|
+
rake (12.3.2)
|
114
|
+
rubocop (0.66.0)
|
115
|
+
jaro_winkler (~> 1.5.1)
|
116
|
+
parallel (~> 1.10)
|
117
|
+
parser (>= 2.5, != 2.5.1.1)
|
118
|
+
psych (>= 3.1.0)
|
119
|
+
rainbow (>= 2.2.2, < 4.0)
|
120
|
+
ruby-progressbar (~> 1.7)
|
121
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
122
|
+
rubocop-rspec (1.32.0)
|
123
|
+
rubocop (>= 0.60.0)
|
124
|
+
ruby-progressbar (1.10.0)
|
125
|
+
sprockets (3.7.2)
|
126
|
+
concurrent-ruby (~> 1.0)
|
127
|
+
rack (> 1, < 3)
|
128
|
+
sprockets-rails (3.2.1)
|
129
|
+
actionpack (>= 4.0)
|
130
|
+
activesupport (>= 4.0)
|
131
|
+
sprockets (>= 3.0.0)
|
132
|
+
thor (0.20.3)
|
133
|
+
thread_safe (0.3.6)
|
134
|
+
tzinfo (1.2.5)
|
135
|
+
thread_safe (~> 0.1)
|
136
|
+
unicode-display_width (1.5.0)
|
137
|
+
websocket-driver (0.7.0)
|
138
|
+
websocket-extensions (>= 0.1.0)
|
139
|
+
websocket-extensions (0.1.3)
|
140
|
+
|
141
|
+
PLATFORMS
|
142
|
+
ruby
|
143
|
+
|
144
|
+
DEPENDENCIES
|
145
|
+
bundler (~> 2.0)
|
146
|
+
minitest (~> 5.0)
|
147
|
+
onkcop (~> 0.53)
|
148
|
+
rails
|
149
|
+
rake (>= 11.0)
|
150
|
+
rubocop (~> 0.66)
|
151
|
+
stimulant!
|
152
|
+
|
153
|
+
BUNDLED WITH
|
154
|
+
2.0.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 en30
|
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,61 @@
|
|
1
|
+
# Stimulant
|
2
|
+
|
3
|
+
Helper to integrate Stimulus into Rails application.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'stimulant'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install stimulant
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
stimulant adds a helper method `stimulus_scope`.
|
23
|
+
|
24
|
+
```erbruby
|
25
|
+
<%= stimulus_scope :slideshow do |s| %>
|
26
|
+
<div data-controller="<%= s.controller %>" data-action="<%= s.action(:next, on: "slideshow:next", at: "window)>
|
27
|
+
<div data-target="<%= s.target(:slide) %>">
|
28
|
+
<button data-action="<%= s.action(:next) + s.action(:hoge) %>">next</button>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
```
|
33
|
+
|
34
|
+
becomes
|
35
|
+
|
36
|
+
```html
|
37
|
+
<div data-controller="slidedhow" data-action="slidedhow:next@window->slideshow#next">
|
38
|
+
<div data-target="slideshow.slide">
|
39
|
+
<button data-action="slidedhow#next slideshow#hoge">next</button>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
```
|
43
|
+
|
44
|
+
|
45
|
+
## Development
|
46
|
+
|
47
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
48
|
+
|
49
|
+
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).
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/en30/stimulant. 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.
|
54
|
+
|
55
|
+
## License
|
56
|
+
|
57
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
58
|
+
|
59
|
+
## Code of Conduct
|
60
|
+
|
61
|
+
Everyone interacting in the Stimulant project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/stimulant/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "stimulant"
|
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
data/lib/stimulant.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "stimulant/version"
|
2
|
+
|
3
|
+
module Stimulant
|
4
|
+
class UnusedScopeError < StandardError; end
|
5
|
+
# Your code goes here...
|
6
|
+
end
|
7
|
+
|
8
|
+
require "stimulant/data"
|
9
|
+
require "stimulant/scope"
|
10
|
+
require "stimulant/helper"
|
11
|
+
require "stimulant/list"
|
12
|
+
require "stimulant/controller"
|
13
|
+
require "stimulant/action"
|
14
|
+
require "stimulant/target"
|
15
|
+
|
16
|
+
require "stimulant/railtie" if defined?(Rails)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Stimulant
|
2
|
+
class Action
|
3
|
+
attr_reader :controller, :name, :event, :source
|
4
|
+
private :controller
|
5
|
+
private :name
|
6
|
+
private :event
|
7
|
+
private :source
|
8
|
+
|
9
|
+
def initialize(controller, name, event: nil, source: nil)
|
10
|
+
@controller = controller
|
11
|
+
@event = event
|
12
|
+
@source = source
|
13
|
+
@name = name.to_s.underscore.camelize(:lower)
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
s = "#{controller}##{name}"
|
18
|
+
s = "#{trigger}->#{s}" unless trigger.nil?
|
19
|
+
s
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def trigger
|
25
|
+
return nil if event.nil?
|
26
|
+
|
27
|
+
res = event.to_s
|
28
|
+
res += "@#{source}" unless source.nil?
|
29
|
+
res
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Stimulant
|
2
|
+
class Controller
|
3
|
+
attr_reader :name, :data
|
4
|
+
|
5
|
+
def initialize(name, data: {})
|
6
|
+
@name = name.to_s.underscore.tr("_", "-")
|
7
|
+
@data = data.transform_keys {|k| :"#{name}-#{k.to_s.underscore.tr("_", "-")}" }
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Stimulant
|
2
|
+
class List
|
3
|
+
attr_reader :items
|
4
|
+
protected :items
|
5
|
+
|
6
|
+
def initialize(*items)
|
7
|
+
@items = items
|
8
|
+
end
|
9
|
+
|
10
|
+
def +(other)
|
11
|
+
List.new(*(@items + other.items))
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
items.join(" ")
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_json(_opts = nil)
|
19
|
+
items.map(&:to_s).join(" ")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Stimulant
|
2
|
+
class Scope
|
3
|
+
def initialize(controller, data: {})
|
4
|
+
@controller = Controller.new(controller, data: data)
|
5
|
+
@controller_used = false
|
6
|
+
end
|
7
|
+
|
8
|
+
def controller
|
9
|
+
@controller_used = true
|
10
|
+
List.new(@controller)
|
11
|
+
end
|
12
|
+
|
13
|
+
def root_data
|
14
|
+
Data[[[:controller, controller]] + data.entries]
|
15
|
+
end
|
16
|
+
|
17
|
+
def data
|
18
|
+
Data[@controller.data.entries]
|
19
|
+
end
|
20
|
+
|
21
|
+
def target(name)
|
22
|
+
List.new(Target.new(@controller, name))
|
23
|
+
end
|
24
|
+
|
25
|
+
def action(name, on: nil, at: nil)
|
26
|
+
List.new(Action.new(@controller, name, event: on, source: at))
|
27
|
+
end
|
28
|
+
|
29
|
+
def controller_used?
|
30
|
+
@controller_used
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Stimulant
|
2
|
+
class Target
|
3
|
+
attr_reader :controller, :name
|
4
|
+
private :controller
|
5
|
+
private :name
|
6
|
+
|
7
|
+
def initialize(controller, name)
|
8
|
+
@controller = controller
|
9
|
+
@name = name.to_s.underscore.camelize(:lower)
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
"#{controller}.#{name}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/stimulant.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "stimulant/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "stimulant"
|
7
|
+
spec.version = Stimulant::VERSION
|
8
|
+
spec.authors = ["en30"]
|
9
|
+
spec.email = ["en30.git@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Helper to integrate Stimulus into Rails application"
|
12
|
+
spec.homepage = "https://github.com/en30/stimulant"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "activesupport", ">= 5.1"
|
25
|
+
spec.add_dependency "railties", ">= 5.1"
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stimulant
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- en30
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: railties
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- en30.git@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".travis.yml"
|
66
|
+
- CODE_OF_CONDUCT.md
|
67
|
+
- Gemfile
|
68
|
+
- Gemfile.lock
|
69
|
+
- LICENSE.txt
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- bin/console
|
73
|
+
- bin/setup
|
74
|
+
- lib/stimulant.rb
|
75
|
+
- lib/stimulant/action.rb
|
76
|
+
- lib/stimulant/controller.rb
|
77
|
+
- lib/stimulant/data.rb
|
78
|
+
- lib/stimulant/helper.rb
|
79
|
+
- lib/stimulant/list.rb
|
80
|
+
- lib/stimulant/railtie.rb
|
81
|
+
- lib/stimulant/scope.rb
|
82
|
+
- lib/stimulant/target.rb
|
83
|
+
- lib/stimulant/version.rb
|
84
|
+
- stimulant.gemspec
|
85
|
+
homepage: https://github.com/en30/stimulant
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubygems_version: 3.0.3
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Helper to integrate Stimulus into Rails application
|
108
|
+
test_files: []
|