blocky 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -0
- data/app/views/blocky/content_blocks/index.html.erb +1 -1
- data/lib/blocky/version.rb +1 -1
- data/lib/generators/blocky/install_generator.rb +19 -72
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47b5913b5fca8af33a8132ac10b2c218a180b28f
|
4
|
+
data.tar.gz: a25276667566652cdd7e7b8f8a071258aab9afd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32d357f0799977ec77c94e8f9c6f3013048d3f58bddbb709c8f93697d74d956b957cd7101960d694d41a8cb6261b5f6c2e20479a32b1d97d09b5c95494859b68
|
7
|
+
data.tar.gz: 77e038857499412e99e4d4125e4e90d53d836d2b8eb5a8bf6cb37746d1c5341d4d7f0606a7a597c0487d349ead036505625a0ed063aa065412e32ead6a1aa2f1
|
data/README.md
CHANGED
@@ -50,6 +50,24 @@ By default, any logged in user can create, update, and delete any content block.
|
|
50
50
|
|
51
51
|
TODO: Add example for limiting access to admin users.
|
52
52
|
|
53
|
+
## Usage
|
54
|
+
|
55
|
+
To create a content block, simply use the `blocky` helper
|
56
|
+
and specify a content key in any ERB template:
|
57
|
+
|
58
|
+
```erb
|
59
|
+
<%= blocky(:features) %>
|
60
|
+
```
|
61
|
+
|
62
|
+
By default, using the same content key on multiple pages
|
63
|
+
will create a separate content block for each page. To
|
64
|
+
create a content block that updates across multiple pages,
|
65
|
+
include the `global` option when specifying the content block.
|
66
|
+
|
67
|
+
```erb
|
68
|
+
<%= blocky(:contact_email, global: true) %>
|
69
|
+
```
|
70
|
+
|
53
71
|
## Contributing
|
54
72
|
|
55
73
|
1. Fork it
|
@@ -60,7 +60,7 @@
|
|
60
60
|
<p>
|
61
61
|
<code class="code-block">
|
62
62
|
<span class="tag"><%=</span>
|
63
|
-
<span class="method">blocky</span>(<span class="symbol">:
|
63
|
+
<span class="method">blocky</span>(<span class="symbol">:features</span>)
|
64
64
|
<span class="tag">%></span>
|
65
65
|
</code>
|
66
66
|
</p>
|
data/lib/blocky/version.rb
CHANGED
@@ -1,94 +1,41 @@
|
|
1
|
-
module
|
1
|
+
module Blocky
|
2
2
|
class InstallGenerator < Rails::Generators::Base
|
3
3
|
source_root File.expand_path("../../../..", __FILE__)
|
4
|
-
|
4
|
+
|
5
5
|
def ask_questions
|
6
|
-
@
|
7
|
-
if @
|
8
|
-
@
|
9
|
-
end
|
10
|
-
|
11
|
-
@blogelator_route = ask("What route should be used to access the blog? [/blog]")
|
12
|
-
if @blogelator_route.blank?
|
13
|
-
@blogelator_route = "/blog"
|
6
|
+
@blocky_route = ask("What route should be used to manage content blocks? [/admin/content]")
|
7
|
+
if @blocky_route.blank?
|
8
|
+
@blocky_route = "/admin/content"
|
14
9
|
end
|
15
|
-
|
10
|
+
|
16
11
|
@user_class = ask("What class is used for user authentication? [User]")
|
17
12
|
if @user_class.blank?
|
18
13
|
@user_class = "User"
|
19
14
|
end
|
20
15
|
end
|
21
|
-
|
16
|
+
|
22
17
|
def create_initializer_file
|
23
|
-
create_file "config/initializers/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
Blogelator.s3_secret_access_key = ENV["BLOGELATOR_S3_SECRET"]
|
29
|
-
Blogelator.s3_bucket = ENV["BLOGELATOR_S3_BUCKET"]
|
18
|
+
create_file "config/initializers/blocky.rb", <<-INITIALIZER
|
19
|
+
Blocky.user_class = "#{@user_class}"
|
20
|
+
Blocky.s3_access_key_id = ENV["BLOCKY_S3_KEY"]
|
21
|
+
Blocky.s3_secret_access_key = ENV["BLOCKY_S3_SECRET"]
|
22
|
+
Blocky.s3_bucket = ENV["BLOCKY_S3_BUCKET"]
|
30
23
|
INITIALIZER
|
31
24
|
end
|
32
|
-
|
33
|
-
def create_stylesheets
|
34
|
-
create_file "app/assets/stylesheets/blogelator/application.css.scss", <<-APPLICATIONCSS
|
35
|
-
/*
|
36
|
-
*= require blogelator/application/all
|
37
|
-
*= require_self
|
38
|
-
*/
|
39
|
-
APPLICATIONCSS
|
40
|
-
|
41
|
-
create_file "app/assets/stylesheets/blogelator/admin.css.scss", <<-ADMINCSS
|
42
|
-
/*
|
43
|
-
*= require blogelator/admin/all
|
44
|
-
*= require_self
|
45
|
-
*/
|
46
|
-
ADMINCSS
|
47
|
-
end
|
48
|
-
|
49
|
-
def copy_variables_file
|
50
|
-
puts File.expand_path("../../../..", __FILE__)
|
51
|
-
source = "lib/assets/stylesheets/blogelator/_variables_sample.scss"
|
52
|
-
destination = "app/assets/stylesheets/blogelator/_variables.scss"
|
53
|
-
copy_file source, destination
|
54
|
-
end
|
55
|
-
|
56
|
-
def create_overrides_directory
|
57
|
-
empty_directory "app/overrides"
|
58
|
-
end
|
59
|
-
|
60
|
-
def configure_application
|
61
|
-
application <<-APP
|
62
25
|
|
63
|
-
config.to_prepare do
|
64
|
-
# Load application's model / class decorators
|
65
|
-
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
66
|
-
Rails.configuration.cache_classes ? require(c) : load(c)
|
67
|
-
end
|
68
|
-
|
69
|
-
# Load application's view overrides
|
70
|
-
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
|
71
|
-
Rails.configuration.cache_classes ? require(c) : load(c)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
APP
|
75
|
-
end
|
76
|
-
|
77
26
|
def install_migrations
|
78
|
-
rake "
|
27
|
+
rake "blocky:install:migrations"
|
79
28
|
end
|
80
|
-
|
29
|
+
|
81
30
|
def mount_engine
|
82
31
|
insert_into_file(File.join("config", "routes.rb"), :after => "Application.routes.draw do\n") do <<-MOUNTENGINE
|
83
|
-
# This line mounts
|
84
|
-
# This means, any requests to '#{@
|
32
|
+
# This line mounts Blocky's routes to the path '#{@blocky_route}'.
|
33
|
+
# This means, any requests to '#{@blocky_route}', will go to Blocky::ContentBlocksController.
|
85
34
|
# If you would like to change where this engine is mounted, simply change the :at option to something different.
|
86
|
-
#
|
87
|
-
# We ask that you don't use the :as option here, as Blogelator relies on it being the default of "blogelator"
|
88
|
-
mount Blogelator::Engine, at: "#{@blogelator_route}"
|
35
|
+
mount Blocky::Engine, at: "#{@blocky_route}"
|
89
36
|
MOUNTENGINE
|
90
37
|
end
|
91
38
|
end
|
92
|
-
|
39
|
+
|
93
40
|
end
|
94
|
-
end
|
41
|
+
end
|