flashee 0.3.3 → 0.3.4
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 +4 -4
- data/Rakefile +5 -1
- data/lib/flashee.rb +2 -1
- data/lib/flashee/builders.rb +63 -0
- data/lib/flashee/version.rb +2 -1
- data/lib/generators/flashee/install/bootstrap_generator.rb +9 -14
- data/lib/generators/flashee/install/bulma_generator.rb +8 -13
- data/lib/generators/flashee/install/foundation_generator.rb +9 -14
- data/lib/generators/flashee/install/install.rb +9 -4
- data/lib/generators/flashee/install_generator.rb +8 -14
- data/lib/templates/_flash_messages.html.erb +1 -1
- data/lib/templates/_flash_messages_foundation.html.erb +1 -1
- data/lib/templates/flashee_helper.rb +0 -10
- data/lib/templates/flashee_helper.rb.erb +67 -0
- metadata +18 -5
- data/lib/templates/flashee_bootstrap_helper.rb +0 -16
- data/lib/templates/flashee_bulma_helper.rb +0 -16
- data/lib/templates/flashee_foundation_helper.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 446cda8e1d0cecd2902f3f9805dc6753007571c23875fa54d7a020b87a309477
|
4
|
+
data.tar.gz: 341cc0620380d36ee3d67615f8285f2b3ca09785b10a5df46d2d4f66b611da01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4ffd55bc15af4ba41bb917e94e177ba90089aef08317395c4058cc5a2038af0420c967c05a71ec5eba1b499ab895746952d72d38badb00a8f9ab8c9890efaa8
|
7
|
+
data.tar.gz: 0e24d3bd8d6f49783eee53d2d7a637be9f8ea7d0221f73db2fd065dee58e69e689b75256ac8f4e13fe9990ca10c26529564cdc2a53fe9e619dab72877f66dcf0
|
data/Rakefile
CHANGED
@@ -4,14 +4,18 @@ rescue LoadError
|
|
4
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
5
|
end
|
6
6
|
|
7
|
+
require 'sdoc'
|
7
8
|
require 'rdoc/task'
|
8
9
|
|
9
10
|
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = '
|
11
|
+
rdoc.rdoc_dir = 'docs'
|
11
12
|
rdoc.title = 'Flashee'
|
12
13
|
rdoc.options << '--line-numbers'
|
14
|
+
rdoc.options << '--format=sdoc'
|
15
|
+
rdoc.template = 'rails'
|
13
16
|
rdoc.rdoc_files.include('README.md')
|
14
17
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
18
|
+
rdoc.main = 'README.md'
|
15
19
|
end
|
16
20
|
|
17
21
|
require 'bundler/gem_tasks'
|
data/lib/flashee.rb
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
module Flashee
|
2
|
+
class Builders
|
3
|
+
# Called by install generators to build the appropriate helper file
|
4
|
+
#
|
5
|
+
# == Parameters:
|
6
|
+
#
|
7
|
+
# * flashee_helper_mode::
|
8
|
+
# A string to define what mode to render the templates in
|
9
|
+
#
|
10
|
+
# == Returns:
|
11
|
+
# A string of the template contents
|
12
|
+
#
|
13
|
+
def self.helper_builder flashee_helper_mode
|
14
|
+
@mode = flashee_helper_mode
|
15
|
+
@template = File.read(File.join(Gem.loaded_specs["flashee"].full_gem_path, "lib", "templates", "flashee_helper.rb.erb"))
|
16
|
+
return ERB.new(@template).result(binding)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Called by install generators to build the appropriate view partial
|
20
|
+
#
|
21
|
+
# == Parameters:
|
22
|
+
#
|
23
|
+
# * flashee_helper_mode::
|
24
|
+
# if flashee_helper_mode is set to "foundation" it will copy the foundation template.
|
25
|
+
# Otherwise it will copy the standard template that fits everything else.
|
26
|
+
#
|
27
|
+
# == Returns:
|
28
|
+
# A string of the template contents
|
29
|
+
#
|
30
|
+
def self.view_builder flashee_helper_mode
|
31
|
+
@mode = flashee_helper_mode
|
32
|
+
if @mode == "foundation"
|
33
|
+
view_partial_source = File.join(Gem.loaded_specs["flashee"].full_gem_path, "lib", "templates", "_flash_messages_foundation.html.erb")
|
34
|
+
view_partial_target = File.join(Rails.root, "app", "views", "partials", "_flash_messages.html.erb")
|
35
|
+
FileUtils::mkdir_p File.join(Rails.root, "app", "views", "partials")
|
36
|
+
FileUtils.cp_r view_partial_source, view_partial_target
|
37
|
+
else
|
38
|
+
view_partial_source = File.join(Gem.loaded_specs["flashee"].full_gem_path, "lib", "templates", "_flash_messages.html.erb")
|
39
|
+
view_partial_target = File.join(Rails.root, "app", "views", "partials", "_flash_messages.html.erb")
|
40
|
+
FileUtils::mkdir_p File.join(Rails.root, "app", "views", "partials")
|
41
|
+
FileUtils.cp_r view_partial_source, view_partial_target
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Called by install generators to create a file inside of the apps file structure
|
46
|
+
#
|
47
|
+
# == Parameters:
|
48
|
+
# * file_path::
|
49
|
+
# Path to file including filename and extension
|
50
|
+
#
|
51
|
+
# * file_contents::
|
52
|
+
# Contents to print into the file_path
|
53
|
+
#
|
54
|
+
# == Returns:
|
55
|
+
# A file inside file_path containing file_contents
|
56
|
+
#
|
57
|
+
def self.file_builder file_path, file_contents
|
58
|
+
@out_file = File.new(file_path, 'w')
|
59
|
+
@out_file.puts(file_contents)
|
60
|
+
@out_file.close
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/flashee/version.rb
CHANGED
@@ -4,23 +4,18 @@ module Flashee
|
|
4
4
|
# Houses the logic to install flashee into the target rails app using the bootstrap CSS framework.
|
5
5
|
# BootstrapGenerator translates to the `flashee:install:bootstrap
|
6
6
|
class BootstrapGenerator < Rails::Generators::Base
|
7
|
-
|
8
|
-
# Copies `lib/templates/flashee_bootstrap_helper.rb` into `app/helpers/flashee_helper.rb`.
|
9
|
-
def copy_helper
|
10
|
-
helper_source = File.join(Gem.loaded_specs["flashee"].full_gem_path, "lib", "templates", "flashee_bootstrap_helper.rb")
|
11
|
-
helper_target = File.join(Rails.root, "app", "helpers", "flashee_helper.rb")
|
12
7
|
|
13
|
-
|
14
|
-
|
8
|
+
# Creates bootstrap mode helper.
|
9
|
+
def create_helper
|
10
|
+
@helper_file = Builders.helper_builder "bootstrap"
|
11
|
+
helper_target_path = File.join(Rails.root, "app", "helpers", "flashee_helper.rb")
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
def copy_partial
|
19
|
-
view_partial_source = File.join(Gem.loaded_specs["flashee"].full_gem_path, "lib", "templates", "_flash_messages.html.erb")
|
20
|
-
view_partial_target = File.join(Rails.root, "app", "views", "partials", "_flash_messages.html.erb")
|
13
|
+
Builders.file_builder helper_target_path, @helper_file
|
14
|
+
end
|
21
15
|
|
22
|
-
|
23
|
-
|
16
|
+
# Creates bootstrap mode view partial
|
17
|
+
def create_partial
|
18
|
+
Builders.view_builder "bootstrap"
|
24
19
|
end
|
25
20
|
|
26
21
|
# After installation completes, print the ERB snippet to the command line.
|
@@ -5,22 +5,17 @@ module Flashee
|
|
5
5
|
# BulmaGenerator translates to the `flashee:install:bulma` command.
|
6
6
|
class BulmaGenerator < Rails::Generators::Base
|
7
7
|
|
8
|
-
#
|
9
|
-
def
|
10
|
-
|
11
|
-
|
8
|
+
# Creates bulma mode helper.
|
9
|
+
def create_helper
|
10
|
+
@helper_file = Builders.helper_builder "bulma"
|
11
|
+
helper_target_path = File.join(Rails.root, "app", "helpers", "flashee_helper.rb")
|
12
12
|
|
13
|
-
|
13
|
+
Builders.file_builder helper_target_path, @helper_file
|
14
14
|
end
|
15
15
|
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
view_partial_source = File.join(Gem.loaded_specs["flashee"].full_gem_path, "lib", "templates", "_flash_messages.html.erb")
|
20
|
-
view_partial_target = File.join(Rails.root, "app", "views", "partials", "_flash_messages.html.erb")
|
21
|
-
|
22
|
-
FileUtils::mkdir_p File.join(Rails.root, "app", "views", "partials")
|
23
|
-
FileUtils.cp_r view_partial_source, view_partial_target
|
16
|
+
# Creates bulma mode view partial
|
17
|
+
def create_partial
|
18
|
+
Builders.view_builder "bulma"
|
24
19
|
end
|
25
20
|
|
26
21
|
# After installation completes, print the ERB snippet to the command line.
|
@@ -4,23 +4,18 @@ module Flashee
|
|
4
4
|
# Houses the logic to install flashee into the target rails app using the foundation CSS framework.
|
5
5
|
# FoundationGenerator translates to the `flashee:install:foundation` command.
|
6
6
|
class FoundationGenerator < Rails::Generators::Base
|
7
|
-
|
8
|
-
# Copies `lib/templates/flashee_foundation_helper.rb` into `app/helpers/flashee_helper.rb`.
|
9
|
-
def copy_helper
|
10
|
-
helper_source = File.join(Gem.loaded_specs["flashee"].full_gem_path, "lib", "templates", "flashee_foundation_helper.rb")
|
11
|
-
helper_target = File.join(Rails.root, "app", "helpers", "flashee_helper.rb")
|
12
7
|
|
13
|
-
|
14
|
-
|
8
|
+
# Creates foundation mode helper.
|
9
|
+
def create_helper
|
10
|
+
@helper_file = Builders.helper_builder "foundation"
|
11
|
+
helper_target_path = File.join(Rails.root, "app", "helpers", "flashee_helper.rb")
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
def copy_partial
|
19
|
-
view_partial_source = File.join(Gem.loaded_specs["flashee"].full_gem_path, "lib", "templates", "_flash_messages_foundation.html.erb")
|
20
|
-
view_partial_target = File.join(Rails.root, "app", "views", "partials", "_flash_messages.html.erb")
|
13
|
+
Builders.file_builder helper_target_path, @helper_file
|
14
|
+
end
|
21
15
|
|
22
|
-
|
23
|
-
|
16
|
+
# Creates foundation mode view partial
|
17
|
+
def create_partial
|
18
|
+
Builders.view_builder "foundation"
|
24
19
|
end
|
25
20
|
|
26
21
|
# After installation completes, print the ERB snippet to the command line.
|
@@ -1,13 +1,18 @@
|
|
1
1
|
module Flashee
|
2
2
|
module Generators
|
3
3
|
# Parent class that houses all of the sub generators, fund below a list of current generators and their corresponding commands.
|
4
|
-
#
|
4
|
+
#
|
5
|
+
# * InstallGenerator
|
6
|
+
# $ rails generate flashee:install
|
7
|
+
#
|
5
8
|
# * Install::BootstrapGenerator
|
6
|
-
# flashee:install:bootstrap
|
9
|
+
# $ rails generate flashee:install:bootstrap
|
10
|
+
#
|
7
11
|
# * Install::BulmaGenerator
|
8
|
-
# flashee:install:bulma
|
12
|
+
# $ rails generate flashee:install:bulma
|
13
|
+
#
|
9
14
|
# * Install::FoundationGenerator
|
10
|
-
# flashee:install:foundation
|
15
|
+
# $ rails generate flashee:install:foundation
|
11
16
|
#
|
12
17
|
module Install
|
13
18
|
end
|
@@ -4,22 +4,16 @@ module Flashee
|
|
4
4
|
# InstallGenerator translates to the `flashee:install` command.
|
5
5
|
class InstallGenerator < Rails::Generators::Base
|
6
6
|
|
7
|
-
#
|
8
|
-
def
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
FileUtils.cp_r helper_source, helper_target
|
7
|
+
# Creates basic mode helper.
|
8
|
+
def create_helper
|
9
|
+
@helper_file = Builders.helper_builder "basic"
|
10
|
+
helper_target_path = File.join(Rails.root, "app", "helpers", "flashee_helper.rb")
|
11
|
+
Builders.file_builder helper_target_path, @helper_file
|
13
12
|
end
|
14
13
|
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
view_partial_source = File.join(Gem.loaded_specs["flashee"].full_gem_path, "lib", "templates", "_flash_messages.html.erb")
|
19
|
-
view_partial_target = File.join(Rails.root, "app", "views", "partials", "_flash_messages.html.erb")
|
20
|
-
|
21
|
-
FileUtils::mkdir_p File.join(Rails.root, "app", "views", "partials")
|
22
|
-
FileUtils.cp_r view_partial_source, view_partial_target
|
14
|
+
# Creates basic mode view partial
|
15
|
+
def create_partial
|
16
|
+
Builders.view_builder "basic"
|
23
17
|
end
|
24
18
|
|
25
19
|
# After installation completes, print the ERB snippet to the command line.
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<% if @mode == "basic" %>
|
2
|
+
module FlasheeHelper
|
3
|
+
def flashee_for flash_type
|
4
|
+
case flash_type.to_s
|
5
|
+
when "success"
|
6
|
+
"success"
|
7
|
+
when "error"
|
8
|
+
"error"
|
9
|
+
when "alert"
|
10
|
+
"alert"
|
11
|
+
else
|
12
|
+
flash_type.to_s
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
<% elsif @mode == "bootstrap" %>
|
17
|
+
module FlasheeHelper
|
18
|
+
def flashee_for flash_type
|
19
|
+
case flash_type.to_s
|
20
|
+
when "success"
|
21
|
+
"alert alert-success"
|
22
|
+
when "error"
|
23
|
+
"alert alert-danger"
|
24
|
+
when "alert"
|
25
|
+
"alert alert-warning"
|
26
|
+
when "info"
|
27
|
+
"alert alert-primary"
|
28
|
+
else
|
29
|
+
flash_type.to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
<% elsif @mode == "foundation" %>
|
34
|
+
module FlasheeHelper
|
35
|
+
def flashee_for flash_type
|
36
|
+
case flash_type.to_s
|
37
|
+
when "success"
|
38
|
+
"alert-box success"
|
39
|
+
when "error"
|
40
|
+
"alert-box alert"
|
41
|
+
when "alert"
|
42
|
+
"alert-box warning"
|
43
|
+
when "info"
|
44
|
+
"alert-box info"
|
45
|
+
else
|
46
|
+
flash_type.to_s
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
<% elsif @mode == "bulma" %>
|
51
|
+
module FlasheeHelper
|
52
|
+
def flashee_for flash_type
|
53
|
+
case flash_type.to_s
|
54
|
+
when "success"
|
55
|
+
"notification is-success"
|
56
|
+
when "error"
|
57
|
+
"notification is-danger"
|
58
|
+
when "alert"
|
59
|
+
"notification is-warning"
|
60
|
+
when "info"
|
61
|
+
"notification is-primary"
|
62
|
+
else
|
63
|
+
flash_type.to_s
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flashee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Burns
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Rails helper to style flash messages
|
42
56
|
email:
|
43
57
|
- jb@jbernsie.me
|
@@ -48,6 +62,7 @@ files:
|
|
48
62
|
- README.md
|
49
63
|
- Rakefile
|
50
64
|
- lib/flashee.rb
|
65
|
+
- lib/flashee/builders.rb
|
51
66
|
- lib/flashee/railtie.rb
|
52
67
|
- lib/flashee/version.rb
|
53
68
|
- lib/generators/flashee/install/bootstrap_generator.rb
|
@@ -57,10 +72,8 @@ files:
|
|
57
72
|
- lib/generators/flashee/install_generator.rb
|
58
73
|
- lib/templates/_flash_messages.html.erb
|
59
74
|
- lib/templates/_flash_messages_foundation.html.erb
|
60
|
-
- lib/templates/flashee_bootstrap_helper.rb
|
61
|
-
- lib/templates/flashee_bulma_helper.rb
|
62
|
-
- lib/templates/flashee_foundation_helper.rb
|
63
75
|
- lib/templates/flashee_helper.rb
|
76
|
+
- lib/templates/flashee_helper.rb.erb
|
64
77
|
homepage: https://github.com/jbernsie/flashee
|
65
78
|
licenses:
|
66
79
|
- MIT
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module FlasheeHelper
|
2
|
-
def flashee_for flash_type
|
3
|
-
case flash_type.to_s
|
4
|
-
when "success"
|
5
|
-
"alert alert-success"
|
6
|
-
when "error"
|
7
|
-
"alert alert-danger"
|
8
|
-
when "alert"
|
9
|
-
"alert alert-warning"
|
10
|
-
when "info"
|
11
|
-
"alert alert-primary"
|
12
|
-
else
|
13
|
-
flash_type.to_s
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module FlasheeHelper
|
2
|
-
def flashee_for flash_type
|
3
|
-
case flash_type.to_s
|
4
|
-
when "success"
|
5
|
-
"notification is-success"
|
6
|
-
when "error"
|
7
|
-
"notification is-danger"
|
8
|
-
when "alert"
|
9
|
-
"notification is-warning"
|
10
|
-
when "info"
|
11
|
-
"notification is-primary"
|
12
|
-
else
|
13
|
-
flash_type.to_s
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module FlasheeHelper
|
2
|
-
def flashee_for flash_type
|
3
|
-
case flash_type.to_s
|
4
|
-
when "success"
|
5
|
-
"alert-box success"
|
6
|
-
when "error"
|
7
|
-
"alert-box alert"
|
8
|
-
when "alert"
|
9
|
-
"alert-box warning"
|
10
|
-
when "info"
|
11
|
-
"alert-box info"
|
12
|
-
else
|
13
|
-
flash_type.to_s
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|