mountain_view 0.9.1 → 0.10.0

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: f9d3b71931e79675624c362a75e20a833b8b5ea2
4
- data.tar.gz: 039a5cf0da9c0f415d4da5a1ac9f4a84b71c4ae3
3
+ metadata.gz: 67887fb2ae93d0eac1d9885cf29dcdf662415a96
4
+ data.tar.gz: 6940be95e5c1c73fd4122494ab7dafb375505a80
5
5
  SHA512:
6
- metadata.gz: b0ab3347848443dce35e3ec29794e60b3badca063042c4ce1f3cfce765d6fadca00acd9921e7445f76b0d9585ff6fddb366f7c807859745399d181d2257aafc2
7
- data.tar.gz: 35be4d573370024634d56fc9a15d9c8aa0da8a76f565ab6fdef227399a9e9cdc4e0b7b6ea3252bbb985e092ad8715f0a2b2e9318645b9af99798d0a814445654
6
+ metadata.gz: c644d342583ac28525909af5d5d0cc4d437e037853017e483cdf226091d151e2f7464fdbc9afb854cf898140a1c3fc322f423daa3628e74e5a48d3ab40587861
7
+ data.tar.gz: 3578fc09a249f2e05afcdf37193868bb49623735d7c0595c0050b9f1501a9e34e5e2708bde9d58ace2f7e5185ddef95b26e37e91729ad9b8e5d4619a65b189ca
data/README.md CHANGED
@@ -4,9 +4,13 @@
4
4
  [![Build Status](https://travis-ci.org/devnacho/mountain_view.svg?branch=master)](https://travis-ci.org/devnacho/mountain_view)
5
5
  [![Code Climate](https://codeclimate.com/github/devnacho/mountain_view/badges/gpa.svg)](https://codeclimate.com/github/devnacho/mountain_view)
6
6
 
7
- With Mountain View you create reusable components for your Rails frontend, while generating a living style guide.
7
+ With Mountain View you create reusable components for your Rails frontend, while generating a living style guide.
8
8
 
9
- _FAQ_: Does it generate it automatically? You bet!
9
+ **FAQ**
10
+
11
+ _Hey! What is a living style guide?_ A living style guide is a style guide that is always up-to-date and never falls behind.
12
+
13
+ _Does it generate it automatically?_ You bet!
10
14
 
11
15
  #### Example Style Guide
12
16
 
@@ -107,13 +111,13 @@ helper:
107
111
  You can require all the components CSS and JS automatically by requiring `mountain_view` in your main JS and CSS files.
108
112
 
109
113
  ### Global Stylesheets
110
- In case you want to add global stylesheets (e.g. colors.scss, fonts.scss, etc.) to your Mountain View components you can do it by calling them with an initializer
114
+ In case you want to add global stylesheets (e.g. reset, bootstrap, a grid system, etc) to your Mountain View components you can do it by calling them with an initializer
111
115
 
112
116
  ```ruby
113
117
  #config/initializers/mountain_view.rb
114
118
 
115
119
  MountainView.configure do |config|
116
- config.included_stylesheets = ["colors", "fonts"]
120
+ config.included_stylesheets = ["reset", "bootstrap"]
117
121
  end
118
122
 
119
123
  ```
@@ -122,6 +126,14 @@ end
122
126
  //= require mountain_view
123
127
  ```
124
128
 
129
+ You don't need to require those again in your application if you're requiring
130
+ `mountain_view` already, that will cause duplicate CSS.
131
+
132
+ For SASS mixins, variables, functions, etc (anything that doesn't generate
133
+ code), you'd need to explicitly do and `@import` in each component stylesheet.
134
+ As that doesn't generate extra CSS this won't cause any issues with the
135
+ generated CSS, you're only giving that stylesheet access to those definitions.
136
+
125
137
  ## Automatically generated Style Guide
126
138
  A style guide will be automatically generated. This style guide never falls behind and it reflects your components in their latest version.
127
139
 
@@ -163,6 +175,18 @@ Visit the **<a href="https://mountain-view.herokuapp.com/mountain_view/styleguid
163
175
 
164
176
  ![mountain_view](https://cloud.githubusercontent.com/assets/623766/7099771/5b06d8da-dfd4-11e4-8558-1b7f026f28ad.gif)
165
177
 
178
+ ### Custom Routes
179
+
180
+ To override the path used within the mountain_view engine, set the `styleguide_path` option.
181
+
182
+ ```ruby
183
+ #config/initializers/mountain_view.rb
184
+
185
+ MountainView.configure do |config|
186
+ config.styleguide_path = "my-style-guide"
187
+ end
188
+ ```
189
+
166
190
  ## Contributing
167
191
 
168
192
  See the [contributing guide](./CONTRIBUTING.md).
data/config/routes.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  MountainView::Engine.routes.draw do
2
2
  root to: "styleguide#index"
3
3
 
4
- resources :styleguide, only: [:index, :show]
4
+ resources :styleguide, only: [:index, :show], path: MountainView.configuration.styleguide_path
5
5
  end
@@ -1,6 +1,7 @@
1
1
  module MountainView
2
2
  class Configuration
3
3
  attr_accessor :included_stylesheets
4
+ attr_accessor :styleguide_path
4
5
  attr_reader :components_path
5
6
 
6
7
  def initialize
@@ -1,3 +1,3 @@
1
1
  module MountainView
2
- VERSION = "0.9.1".freeze
2
+ VERSION = "0.10.0".freeze
3
3
  end
@@ -0,0 +1,150 @@
1
+ ---------------------------------------
2
+ MountainViewTest: test_engine_is_loaded
3
+ ---------------------------------------
4
+ ------------------------------------------------------
5
+ MountainViewTest: test_stylesheets_are_properly_served
6
+ ------------------------------------------------------
7
+ Started GET "/assets/mountain_view.css" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
8
+ MountainView: stylesheet not found for component 'paragraph'
9
+ -----------------------------------------------
10
+ MountainViewTest: test_shows_specific_component
11
+ -----------------------------------------------
12
+ Started GET "/mountain_view/styleguide/header" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
13
+ Processing by MountainView::StyleguideController#show as HTML
14
+ Parameters: {"id"=>"header"}
15
+ Rendered app/components/header/_header.html.erb (2.2ms)
16
+ Rendered app/components/header/_header.html.erb (0.4ms)
17
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/show.html.erb within layouts/mountain_view (19.0ms)
18
+ MountainView: javascript not found for component 'paragraph'
19
+ Completed 200 OK in 80ms (Views: 80.1ms)
20
+ -------------------------------------------------------------
21
+ MountainViewTest: test_global_stylesheets_are_properly_served
22
+ -------------------------------------------------------------
23
+ Started GET "/assets/mountain_view.css" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
24
+ ------------------------------------------------------
25
+ MountainViewTest: test_javascripts_are_properly_served
26
+ ------------------------------------------------------
27
+ Started GET "/assets/mountain_view.js" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
28
+ -------------------------------------------------------------------------------
29
+ MountainViewTest: test_shows_a_hint_message_if_the_component_stub_file_is_empty
30
+ -------------------------------------------------------------------------------
31
+ Started GET "/mountain_view/styleguide/breadcrumbs" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
32
+ Processing by MountainView::StyleguideController#show as HTML
33
+ Parameters: {"id"=>"breadcrumbs"}
34
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/_example.html.erb (0.5ms)
35
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/show.html.erb within layouts/mountain_view (3.5ms)
36
+ Completed 200 OK in 6ms (Views: 5.5ms)
37
+ -----------------------------------------------------------------------------
38
+ MountainViewTest: test_shows_specific_component_that_uses_a_main_app_url_okay
39
+ -----------------------------------------------------------------------------
40
+ Started GET "/mountain_view/styleguide/header" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
41
+ Processing by MountainView::StyleguideController#show as HTML
42
+ Parameters: {"id"=>"header"}
43
+ Rendered app/components/header/_header.html.erb (0.3ms)
44
+ Rendered app/components/header/_header.html.erb (0.2ms)
45
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/show.html.erb within layouts/mountain_view (7.7ms)
46
+ Completed 200 OK in 10ms (Views: 9.7ms)
47
+ ---------------------------------------
48
+ MountainViewTest: test_shows_styleguide
49
+ ---------------------------------------
50
+ Started GET "/mountain_view" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
51
+ Processing by MountainView::StyleguideController#index as HTML
52
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/index.html.erb within layouts/mountain_view (0.6ms)
53
+ Completed 200 OK in 4ms (Views: 4.3ms)
54
+ -----------------------------------------------------------------------------------
55
+ MountainViewTest: test_shows_a_hint_message_if_the_component_stub_file_is_not_found
56
+ -----------------------------------------------------------------------------------
57
+ Started GET "/mountain_view/styleguide/something" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
58
+ Processing by MountainView::StyleguideController#show as HTML
59
+ Parameters: {"id"=>"something"}
60
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/_example.html.erb (0.0ms)
61
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/show.html.erb within layouts/mountain_view (0.4ms)
62
+ Completed 200 OK in 2ms (Views: 2.3ms)
63
+ -------------------------------------------------
64
+ MountainViewComponentTest: test_stubs_extra_info?
65
+ -------------------------------------------------
66
+ --------------------------------------
67
+ MountainViewComponentTest: test_stubs?
68
+ --------------------------------------
69
+ -----------------------------------------------
70
+ MountainViewComponentTest: test_component_stubs
71
+ -----------------------------------------------
72
+ -----------------------------------------------------
73
+ MountainViewComponentTest: test_stubs_correct_format?
74
+ -----------------------------------------------------
75
+ ------------------------------------
76
+ MountainViewComponentTest: test_name
77
+ ------------------------------------
78
+ ------------------------------------------------
79
+ MountainViewComponentTest: test_stubs_extra_info
80
+ ------------------------------------------------
81
+ ------------------------------------------
82
+ MountainViewComponentTest: test_stubs_file
83
+ ------------------------------------------
84
+ -----------------------------------------------
85
+ MountainViewComponentTest: test_humanized_title
86
+ -----------------------------------------------
87
+ ------------------------------------------------
88
+ MountainViewComponentTest: test_styleguide_stubs
89
+ ------------------------------------------------
90
+ ------------------------------------------------
91
+ MountainViewComponentTest: test_component_stubs?
92
+ ------------------------------------------------
93
+ -------------------------------------------------------------------
94
+ MountainViewConfigurationTest: test_set_custom_included_stylesheets
95
+ -------------------------------------------------------------------
96
+ ----------------------------------------------------------------------------
97
+ MountainViewConfigurationTest: test_default_value_for_styleguide_path_is_nil
98
+ ----------------------------------------------------------------------------
99
+ --------------------------------------------------------------------------------------------
100
+ MountainViewConfigurationTest: test_default_value_for_included_stylesheets_is_an_empty_array
101
+ --------------------------------------------------------------------------------------------
102
+ --------------------------------------------------------------
103
+ MountainViewConfigurationTest: test_set_custom_styleguide_path
104
+ --------------------------------------------------------------
105
+ ------------------------------------------------------------------
106
+ ComponentGeneratorTest: test_Assert_all_files_are_properly_created
107
+ ------------------------------------------------------------------
108
+ --------------------------------------------------------
109
+ ComponentGeneratorTest: test_Generates_different_engines
110
+ --------------------------------------------------------
111
+ -------------------------------------------------------------------------
112
+ MountedEngineTest: test_Custom_path_can_be_applied_to_styleguide_resource
113
+ -------------------------------------------------------------------------
114
+ Started GET "/mountain_view/style-guide" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
115
+ Processing by MountainView::StyleguideController#index as HTML
116
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/index.html.erb within layouts/mountain_view (0.3ms)
117
+ Completed 200 OK in 3ms (Views: 2.5ms)
118
+ -----------------------------------------------------
119
+ MountedEngineTest: test_Has_been_mounted_successfully
120
+ -----------------------------------------------------
121
+ Started GET "/mountain_view" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
122
+ Processing by MountainView::StyleguideController#index as HTML
123
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/index.html.erb within layouts/mountain_view (0.4ms)
124
+ Completed 200 OK in 3ms (Views: 3.0ms)
125
+ ------------------------------------------------
126
+ MountedEngineTest: test_Has_the_styleguide_route
127
+ ------------------------------------------------
128
+ Started GET "/mountain_view/styleguide" for 127.0.0.1 at 2017-04-02 17:43:40 +0200
129
+ Processing by MountainView::StyleguideController#index as HTML
130
+ Rendered /Users/kito/dev/mountain_view/app/views/mountain_view/styleguide/index.html.erb within layouts/mountain_view (0.2ms)
131
+ Completed 200 OK in 2ms (Views: 2.0ms)
132
+ --------------------------------------------------------------------
133
+ MountainView::ComponentHelperTest: test_renders_the_proper_component
134
+ --------------------------------------------------------------------
135
+ Rendered app/components/header/_header.html.erb (0.8ms)
136
+ -----------------------------------------------------------------------------------------
137
+ MountainView::PresenterTest: test_inherited_presenter_returns_the_default_value_for_#data
138
+ -----------------------------------------------------------------------------------------
139
+ -------------------------------------------------------------------------------
140
+ MountainView::PresenterTest: test_inherited_presenter_returns_the_correct_title
141
+ -------------------------------------------------------------------------------
142
+ ----------------------------------------------------------------
143
+ MountainView::PresenterTest: test_exposes_properties_as_provided
144
+ ----------------------------------------------------------------
145
+ -----------------------------------------------------------------------
146
+ MountainView::PresenterTest: test_inherited_presenter_responds_to_#data
147
+ -----------------------------------------------------------------------
148
+ ------------------------------------------------------------------
149
+ MountainView::PresenterTest: test_returns_the_correct_partial_path
150
+ ------------------------------------------------------------------
@@ -0,0 +1,26 @@
1
+ class MountedEngineTest < ActionDispatch::IntegrationTest
2
+ test "Has been mounted successfully" do
3
+ get "/mountain_view"
4
+ assert_response :success
5
+ end
6
+
7
+ test "Has the styleguide route" do
8
+ get "/mountain_view/styleguide"
9
+ assert_response :success
10
+ end
11
+
12
+ test "Custom path can be applied to styleguide resource" do
13
+ styleguide_path = MountainView.configuration.styleguide_path
14
+
15
+ # Set the new path
16
+ MountainView.configuration.styleguide_path = "style-guide"
17
+ Rails.application.reload_routes!
18
+
19
+ get "/mountain_view/style-guide"
20
+ assert_response :success
21
+
22
+ # Reset back to original
23
+ MountainView.configuration.styleguide_path = styleguide_path
24
+ Rails.application.reload_routes!
25
+ end
26
+ end
@@ -5,10 +5,21 @@ class MountainViewConfigurationTest < ActiveSupport::TestCase
5
5
  assert_equal MountainView::Configuration.new.included_stylesheets, []
6
6
  end
7
7
 
8
+ test "default value for styleguide_path is nil" do
9
+ assert_nil MountainView::Configuration.new.styleguide_path
10
+ end
11
+
8
12
  test "set custom included_stylesheets" do
9
13
  config = MountainView::Configuration.new
10
14
  config.included_stylesheets = ["global", "fonts"]
11
15
 
12
16
  assert_equal config.included_stylesheets, ["global", "fonts"]
13
17
  end
18
+
19
+ test "set custom styleguide_path" do
20
+ config = MountainView::Configuration.new
21
+ config.styleguide_path = "style-guide"
22
+
23
+ assert_equal config.styleguide_path, "style-guide"
24
+ end
14
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mountain_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Gutierrez
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-31 00:00:00.000000000 Z
12
+ date: 2017-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -122,12 +122,14 @@ files:
122
122
  - test/dummy/config/locales/en.yml
123
123
  - test/dummy/config/routes.rb
124
124
  - test/dummy/config/secrets.yml
125
+ - test/dummy/log/test.log
125
126
  - test/dummy/public/404.html
126
127
  - test/dummy/public/422.html
127
128
  - test/dummy/public/500.html
128
129
  - test/dummy/public/favicon.ico
129
130
  - test/generators/component_generator_test.rb
130
131
  - test/helpers/mountain_view/component_helper_test.rb
132
+ - test/integration/mounted_engine_test.rb
131
133
  - test/mountain_view/component_test.rb
132
134
  - test/mountain_view/configuration_test.rb
133
135
  - test/mountain_view/presenter_test.rb
@@ -157,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
159
  version: '0'
158
160
  requirements: []
159
161
  rubyforge_project:
160
- rubygems_version: 2.5.1
162
+ rubygems_version: 2.6.10
161
163
  signing_key:
162
164
  specification_version: 4
163
165
  summary: Mountain View helps you create reusable visual components on your Rails Application.
@@ -208,6 +210,7 @@ test_files:
208
210
  - test/dummy/config/routes.rb
209
211
  - test/dummy/config/secrets.yml
210
212
  - test/dummy/config.ru
213
+ - test/dummy/log/test.log
211
214
  - test/dummy/public/404.html
212
215
  - test/dummy/public/422.html
213
216
  - test/dummy/public/500.html
@@ -216,6 +219,7 @@ test_files:
216
219
  - test/dummy/README.rdoc
217
220
  - test/generators/component_generator_test.rb
218
221
  - test/helpers/mountain_view/component_helper_test.rb
222
+ - test/integration/mounted_engine_test.rb
219
223
  - test/mountain_view/component_test.rb
220
224
  - test/mountain_view/configuration_test.rb
221
225
  - test/mountain_view/presenter_test.rb