mountain_view 0.7.0 → 0.7.1
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/README.md +0 -7
- data/app/assets/javascripts/mountain_view.js.erb +4 -4
- data/app/assets/stylesheets/mountain_view/styleguide.css +2 -1
- data/app/assets/stylesheets/mountain_view.css.erb +4 -4
- data/app/helpers/mountain_view/styleguide_helper.rb +2 -1
- data/lib/mountain_view/component.rb +1 -1
- data/lib/mountain_view/configuration.rb +5 -0
- data/lib/mountain_view/engine.rb +9 -2
- data/lib/mountain_view/version.rb +1 -1
- data/lib/mountain_view.rb +2 -1
- data/test/dummy/log/test.log +1779 -2415
- metadata +3 -5
- data/test/dummy/log/development.log +0 -5452
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25ec841a341408131f8ccd8733828fe272c650ff
|
|
4
|
+
data.tar.gz: 542bd1791a9512035b28beaf141c500a78b702cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f1141f20cc830bf54197f9e72f9fc0d3479314b2b12247e888dc7a30cfcff4e0924a53e76a412119169acd5b0b7935cd2f096e05d5fb68d738dcebfde3acf958
|
|
7
|
+
data.tar.gz: 3399e1b98ae937d0b49d8a5f350fcbaefcc5cf1931b80b4aa836bda6e4407d8bba5b0875cfd956966f1e28f07cf440dfa4e97bfb621f4cbd1cae12259e95d963
|
data/README.md
CHANGED
|
@@ -71,13 +71,6 @@ helper:
|
|
|
71
71
|
<%= render_component "header", title: "This is a title", subtitle: "And this is a subtitle" %>
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
#### Note about URL helpers
|
|
75
|
-
|
|
76
|
-
If you want to use URL helpers in your components (eg: `<%= link_to "Users", users_path %>`) you should prefix the helper with `main_app`, so the component knows the proper route when displayed on the stylesheet.
|
|
77
|
-
With that, the example above would look like `<%= link_to "Users", main_app.users_path %>`.
|
|
78
|
-
|
|
79
|
-
**Important**: This is a temporary work-around, and will be fixed in future versions of Mountain View.
|
|
80
|
-
|
|
81
74
|
### Assets
|
|
82
75
|
You can require all the components CSS and JS automatically by requiring `mountain_view` in your main JS and CSS files.
|
|
83
76
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<% if Dir.exists?(
|
|
2
|
-
<% depend_on
|
|
3
|
-
<% Dir.glob(
|
|
1
|
+
<% if Dir.exists?(MountainView.configuration.components_path) %>
|
|
2
|
+
<% depend_on MountainView.configuration.components_path.to_s %>
|
|
3
|
+
<% Dir.glob(MountainView.configuration.components_path.join('*')).each do |component_dir|
|
|
4
4
|
component = File.basename component_dir
|
|
5
5
|
begin
|
|
6
|
-
require_asset "#{component}/#{component}"
|
|
6
|
+
require_asset "#{component}/#{component}.js"
|
|
7
7
|
rescue Sprockets::FileNotFound
|
|
8
8
|
Rails.logger.debug("MountainView: javascript not found for component '#{component}'")
|
|
9
9
|
%>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<% MountainView.configuration.included_stylesheets.each do |included_stylesheet| %>
|
|
2
2
|
<%= require_asset included_stylesheet %>
|
|
3
3
|
<% end %>
|
|
4
|
-
<% if Dir.exists?(
|
|
5
|
-
<% depend_on
|
|
6
|
-
<% Dir.glob(
|
|
4
|
+
<% if Dir.exists?(MountainView.configuration.components_path) %>
|
|
5
|
+
<% depend_on MountainView.configuration.components_path.to_s %>
|
|
6
|
+
<% Dir.glob(MountainView.configuration.components_path.join('*')).each do |component_dir|
|
|
7
7
|
component = File.basename component_dir
|
|
8
8
|
begin
|
|
9
|
-
require_asset "#{component}/#{component}"
|
|
9
|
+
require_asset "#{component}/#{component}.css"
|
|
10
10
|
rescue Sprockets::FileNotFound
|
|
11
11
|
Rails.logger.debug("MountainView: stylesheet not found for component '#{component}'")
|
|
12
12
|
%>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
module MountainView
|
|
2
2
|
module StyleguideHelper
|
|
3
3
|
def mv_components
|
|
4
|
-
|
|
4
|
+
component_dirs = MountainView.configuration.components_path.join("*")
|
|
5
|
+
Dir.glob(component_dirs).map do |component_dir|
|
|
5
6
|
MountainView::Component.new File.basename(component_dir)
|
|
6
7
|
end
|
|
7
8
|
end
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
module MountainView
|
|
2
2
|
class Configuration
|
|
3
3
|
attr_accessor :included_stylesheets
|
|
4
|
+
attr_reader :components_path
|
|
4
5
|
|
|
5
6
|
def initialize
|
|
6
7
|
@included_stylesheets = []
|
|
7
8
|
end
|
|
9
|
+
|
|
10
|
+
def components_path=(path)
|
|
11
|
+
@components_path = Pathname.new(path)
|
|
12
|
+
end
|
|
8
13
|
end
|
|
9
14
|
end
|
data/lib/mountain_view/engine.rb
CHANGED
|
@@ -6,15 +6,22 @@ module MountainView
|
|
|
6
6
|
class Engine < ::Rails::Engine
|
|
7
7
|
isolate_namespace MountainView
|
|
8
8
|
|
|
9
|
+
initializer "mountain_view.components_path" do |app|
|
|
10
|
+
MountainView.configure do |c|
|
|
11
|
+
c.components_path ||= app.root.join("app", "components")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
9
15
|
initializer "mountain_view.assets" do |app|
|
|
10
|
-
Rails.application.config.assets.paths <<
|
|
16
|
+
Rails.application.config.assets.paths <<
|
|
17
|
+
MountainView.configuration.components_path
|
|
11
18
|
Rails.application.config.assets.precompile += %w( mountain_view/styleguide.css
|
|
12
19
|
mountain_view/styleguide.js )
|
|
13
20
|
end
|
|
14
21
|
|
|
15
22
|
initializer "mountain_view.append_view_paths" do |app|
|
|
16
23
|
ActiveSupport.on_load :action_controller do
|
|
17
|
-
append_view_path
|
|
24
|
+
append_view_path MountainView.configuration.components_path
|
|
18
25
|
end
|
|
19
26
|
end
|
|
20
27
|
|
data/lib/mountain_view.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require "mountain_view/version"
|
|
2
2
|
require "mountain_view/configuration"
|
|
3
|
-
require 'mountain_view/engine' if defined?(Rails)
|
|
4
3
|
|
|
5
4
|
module MountainView
|
|
6
5
|
def self.configuration
|
|
@@ -11,3 +10,5 @@ module MountainView
|
|
|
11
10
|
yield(configuration)
|
|
12
11
|
end
|
|
13
12
|
end
|
|
13
|
+
|
|
14
|
+
require "mountain_view/engine" if defined?(Rails)
|