rails_view_component 0.0.2 → 0.0.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa29f991d3bacd5e0360e5d915e386db1eae7a71
|
4
|
+
data.tar.gz: a37ecdb501734e7e73353ef82f995a5b9e4b7d34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9aeee402c1608b1d03b3a87e59e88a5445ef5b41cd436f4c35e05c00d0d32db70f2e23bd3e728b03233b4ed7c65521be916aa1886750bb06adcf7dd687f39ef
|
7
|
+
data.tar.gz: e7263fc15c1fb1e4bf178c871a4c64d2fd69cdb0c9bd91b791c845fa6f78b1a871cd4c93a998cc12b48d3212a029341563e6732cb30a063bd8664867d7481ef1
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module RailsViewComponent
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
def copy
|
7
|
+
%w( view_component/view_component_builder.rb
|
8
|
+
view_component/view_component_helper.rb
|
9
|
+
view_component/view_component_model.rb
|
10
|
+
view_component/haxe/ViewComponent.hx
|
11
|
+
).each{|file|
|
12
|
+
copy_file file, "lib/#{file}"
|
13
|
+
}
|
14
|
+
copy_file "haxe_compile.hxml", "hax_compile.hxml"
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,43 +1,35 @@
|
|
1
|
-
class RailsViewComponentGenerator < Rails::Generators::NamedBase
|
2
|
-
source_root File.expand_path('../templates', __FILE__)
|
3
1
|
|
4
|
-
|
2
|
+
module RailsViewComponent
|
3
|
+
module Generators
|
4
|
+
class RailsViewComponentGenerator < Rails::Generators::NamedBase
|
5
|
+
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
else
|
19
|
-
copy_and_compile = ->(from, to){
|
20
|
-
root = File.expand_path("../", __FILE__)
|
21
|
-
erb = ERB.new(open("#{root}/erb/#{from}").read)
|
22
|
-
@class_name = class_name
|
23
|
-
@file_name = file_name
|
24
|
-
@args = args
|
25
|
-
create_file "app/rails_view_components/#{file_name}/#{to}",
|
26
|
-
erb.result(binding)
|
27
|
-
}
|
8
|
+
desc "This generator creates RailsViewComponent files."
|
9
|
+
|
10
|
+
def create_rails_view_component_file
|
11
|
+
copy_and_compile = ->(from, to){
|
12
|
+
root = File.expand_path("../", __FILE__)
|
13
|
+
erb = ERB.new(open("#{root}/erb/#{from}").read)
|
14
|
+
@class_name = class_name
|
15
|
+
@file_name = file_name
|
16
|
+
@args = args
|
17
|
+
create_file "app/rails_view_components/#{file_name}/#{to}",
|
18
|
+
erb.result(binding)
|
19
|
+
}
|
28
20
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
21
|
+
copy_and_compile.call("controller.rb.erb", "#{file_name}_controller.rb")
|
22
|
+
copy_and_compile.call("model.rb.erb", "#{file_name}_model.rb")
|
23
|
+
copy_and_compile.call("routes.rb.erb", "routes.rb")
|
24
|
+
copy_and_compile.call("views/rails_view_component.html.erb.erb",
|
33
25
|
"views/#{file_name}_view_component.html.erb")
|
34
|
-
|
26
|
+
copy_and_compile.call("haxe/RailsViewComponent.hx.erb",
|
35
27
|
"haxe/#{class_name}ViewComponent.hx")
|
36
28
|
|
37
|
-
|
29
|
+
route "#{class_name}::Routes.routings"
|
38
30
|
|
39
|
-
|
40
|
-
|
31
|
+
inject_into_file "haxe_compile.hxml",
|
32
|
+
after: "## RailsViewComponent JavaScripts\n" do <<RUBY
|
41
33
|
--next
|
42
34
|
# #{@class_name}
|
43
35
|
-lib JQueryExtern
|
@@ -47,7 +39,8 @@ class RailsViewComponentGenerator < Rails::Generators::NamedBase
|
|
47
39
|
-js public/javascripts/#{@file_name}_view_component.js
|
48
40
|
|
49
41
|
RUBY
|
50
|
-
|
42
|
+
end
|
43
|
+
end
|
51
44
|
end
|
52
|
-
end
|
45
|
+
end
|
53
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_view_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi Kojima
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- lib/generators/rails_view_component/erb/model.rb.erb
|
41
41
|
- lib/generators/rails_view_component/erb/routes.rb.erb
|
42
42
|
- lib/generators/rails_view_component/erb/views/rails_view_component.html.erb.erb
|
43
|
+
- lib/generators/rails_view_component/install_generator.rb
|
43
44
|
- lib/generators/rails_view_component/rails_view_component_generator.rb
|
44
45
|
- lib/generators/rails_view_component/templates/haxe_compile.hxml
|
45
46
|
- lib/generators/rails_view_component/templates/view_component/haxe/ViewComponent.hx
|