alopolymer2 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/alopolymer2.rb +5 -0
- data/lib/generators/alo/component/component_generator.rb +31 -0
- data/lib/generators/alo/component/templates/component.css.erb +3 -0
- data/lib/generators/alo/component/templates/component.html.erb +15 -0
- data/lib/generators/alo/component/templates/component.js.erb +15 -0
- data/lib/generators/alo/download/download_generator.rb +17 -0
- data/lib/generators/alo/install/install_generator.rb +43 -0
- data/lib/generators/alo/install/templates/bower.json +3 -0
- data/lib/generators/alo/install/templates/init.rb +5 -0
- metadata +52 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f09d7bf71eb2cc8824fb7877c4d8159f7d361e59
|
4
|
+
data.tar.gz: ddc2261fd5a71d09673ee9a5555f2f355717d97e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b50d40877143c90c53ec4b9a94f397995fa3b76eb1935395ab56746aa1a0cdddc084a74fb25d834ff82db11208aa94f24c83e4cccbd02e3bd24c90f95f90e022
|
7
|
+
data.tar.gz: c90319441ea0c6f07f0fef24cc8df68f7a171848830e29184d0ded41ea067a98d8013d55144ab89e849d46dd774bcf1da9c082539438b04cb76257db58855198
|
data/lib/alopolymer2.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Alo
|
2
|
+
module Generators
|
3
|
+
class ComponentGenerator < ::Rails::Generators::NamedBase
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def create_component_dir
|
7
|
+
empty_directory "app/assets/bower_components/#{component_name}"
|
8
|
+
end
|
9
|
+
|
10
|
+
def copy_component_template
|
11
|
+
template "component.html.erb", "app/assets/bower_components/#{component_name}/#{component_base_name}.html"
|
12
|
+
template "component.js.erb", "app/assets/bower_components/#{component_name}/#{component_base_name}.js"
|
13
|
+
template "component.css.erb", "app/assets/bower_components/#{component_name}/#{component_base_name}.css"
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def component_name
|
19
|
+
name.gsub('_', '-').downcase
|
20
|
+
end
|
21
|
+
|
22
|
+
def class_name
|
23
|
+
name.gsub('_', '').gsub('-','').camelize
|
24
|
+
end
|
25
|
+
|
26
|
+
def component_base_name
|
27
|
+
component_name.split('/')[-1]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!--
|
2
|
+
Generated using AloPolymer2 Gem
|
3
|
+
Author: Author Name
|
4
|
+
Email: Author Email
|
5
|
+
Component Name: <%= component_base_name %>
|
6
|
+
-->
|
7
|
+
<dom-module id="<%= component_base_name %>">
|
8
|
+
<link rel="stylesheet" href="<%= component_base_name %>.css" />
|
9
|
+
<template>
|
10
|
+
|
11
|
+
<h2><%= file_name.capitalize.gsub('_', ' ') %></h2>
|
12
|
+
</template>
|
13
|
+
|
14
|
+
<script src="<%= component_base_name %>.js"></script>
|
15
|
+
</dom-module>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
Generated using AloPolymer2 Gem
|
3
|
+
Author: Author Name
|
4
|
+
Email: Author Email
|
5
|
+
Component Name: <%= component_base_name %>
|
6
|
+
|
7
|
+
To Create Custom Component, Please read documentation at:
|
8
|
+
https://www.polymer-project.org/2.0/docs/devguide/custom-elements
|
9
|
+
*/
|
10
|
+
|
11
|
+
class <%= class_name %> extends Polymer.Element {
|
12
|
+
static get is() { return '<%= component_name %>'; }
|
13
|
+
}
|
14
|
+
|
15
|
+
window.customElements.define(<%= class_name %>.is, <%= class_name %>)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Alo
|
2
|
+
module Generators
|
3
|
+
class DownloadGenerator < ::Rails::Generators::NamedBase
|
4
|
+
|
5
|
+
def download
|
6
|
+
puts "Downloading component #{component_name} ..."
|
7
|
+
puts %x(bower install --save #{component_name})
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def component_name
|
13
|
+
name.gsub('_', '-').downcase
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Alo
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < ::Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def copy_bowerrc
|
7
|
+
template "bower.json", ".bowerrc"
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_component_dir
|
11
|
+
empty_directory "app/assets/bower_components/"
|
12
|
+
empty_directory "vendor/assets/bower_components/"
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy_initializer
|
16
|
+
template "init.rb", "config/initializers/alopolymer2.rb"
|
17
|
+
end
|
18
|
+
|
19
|
+
def install_polymer2
|
20
|
+
puts "Installing Polymer 2.0.0 ..."
|
21
|
+
puts %x(bower install Polymer/polymer#^2.0.0)
|
22
|
+
if File.exist?('vendor/assets/bower_components/polymer/polymer-element.html')
|
23
|
+
puts "Install Polymer 2.0.0 succeed!"
|
24
|
+
else
|
25
|
+
puts "Install Polymer 2.0.0 failed!"
|
26
|
+
end
|
27
|
+
puts "\n\n"
|
28
|
+
puts "Please add this to your view :"
|
29
|
+
puts "============================================================================"
|
30
|
+
puts '<script src="<%= asset_path(\'webcomponentsjs/webcomponents-lite.js\') %>"></script>'
|
31
|
+
puts '<link rel="import" href="<%= asset_path(\'polymer/polymer-element.html\') %>">'
|
32
|
+
puts "============================================================================"
|
33
|
+
puts "\n"
|
34
|
+
puts "Another Generator :"
|
35
|
+
puts "============================================================================"
|
36
|
+
puts "rails generate alo:component component_name # To Create Custom Component"
|
37
|
+
puts "rails generate alo:download component_name # To Download Component using Bower"
|
38
|
+
puts "============================================================================"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alopolymer2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Babar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Polymer 2 for Ruby on Rails
|
14
|
+
email: babar@alodokter.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/alopolymer2.rb
|
20
|
+
- lib/generators/alo/component/component_generator.rb
|
21
|
+
- lib/generators/alo/component/templates/component.css.erb
|
22
|
+
- lib/generators/alo/component/templates/component.html.erb
|
23
|
+
- lib/generators/alo/component/templates/component.js.erb
|
24
|
+
- lib/generators/alo/download/download_generator.rb
|
25
|
+
- lib/generators/alo/install/install_generator.rb
|
26
|
+
- lib/generators/alo/install/templates/bower.json
|
27
|
+
- lib/generators/alo/install/templates/init.rb
|
28
|
+
homepage: http://rubygems.org/gems/alopolymer2
|
29
|
+
licenses:
|
30
|
+
- MIT
|
31
|
+
metadata: {}
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
requirements: []
|
47
|
+
rubyforge_project:
|
48
|
+
rubygems_version: 2.6.8
|
49
|
+
signing_key:
|
50
|
+
specification_version: 4
|
51
|
+
summary: AloPolymer2
|
52
|
+
test_files: []
|