route_localize 0.0.7 → 1.0.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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -18
  3. data/Rakefile +9 -17
  4. data/app/helpers/route_localize_helper.rb +23 -17
  5. data/lib/route_localize/route.rb +78 -0
  6. data/lib/route_localize/version.rb +1 -1
  7. data/lib/route_localize.rb +32 -34
  8. metadata +23 -88
  9. data/test/dummy/README.rdoc +0 -28
  10. data/test/dummy/Rakefile +0 -6
  11. data/test/dummy/app/assets/javascripts/application.js +0 -13
  12. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  13. data/test/dummy/app/controllers/application_controller.rb +0 -5
  14. data/test/dummy/app/controllers/trees_controller.rb +0 -25
  15. data/test/dummy/app/helpers/application_helper.rb +0 -3
  16. data/test/dummy/app/models/tree.rb +0 -18
  17. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  18. data/test/dummy/app/views/trees/home.html.erb +0 -3
  19. data/test/dummy/bin/bundle +0 -3
  20. data/test/dummy/bin/rails +0 -4
  21. data/test/dummy/bin/rake +0 -4
  22. data/test/dummy/config/application.rb +0 -23
  23. data/test/dummy/config/boot.rb +0 -5
  24. data/test/dummy/config/database.yml +0 -25
  25. data/test/dummy/config/environment.rb +0 -5
  26. data/test/dummy/config/environments/development.rb +0 -29
  27. data/test/dummy/config/environments/production.rb +0 -80
  28. data/test/dummy/config/environments/test.rb +0 -36
  29. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  30. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  31. data/test/dummy/config/initializers/inflections.rb +0 -16
  32. data/test/dummy/config/initializers/mime_types.rb +0 -5
  33. data/test/dummy/config/initializers/reloader.rb +0 -5
  34. data/test/dummy/config/initializers/secret_token.rb +0 -12
  35. data/test/dummy/config/initializers/session_store.rb +0 -3
  36. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  37. data/test/dummy/config/locales/routes.yml +0 -11
  38. data/test/dummy/config/routes.rb +0 -11
  39. data/test/dummy/config.ru +0 -4
  40. data/test/dummy/db/test.sqlite3 +0 -0
  41. data/test/dummy/log/test.log +0 -380
  42. data/test/dummy/public/404.html +0 -58
  43. data/test/dummy/public/422.html +0 -58
  44. data/test/dummy/public/500.html +0 -57
  45. data/test/dummy/public/favicon.ico +0 -0
  46. data/test/integration/routes_test.rb +0 -63
  47. data/test/route_localize_test.rb +0 -12
  48. data/test/test_helper.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac33fb44a9d0ae4cb2d20a38e66c3e5b01938b7b
4
- data.tar.gz: 8377b6a2ca45e7e5d14afebf1322b33ebba48b40
3
+ metadata.gz: cca893b796c2a21728b27513a273af3f69081c1a
4
+ data.tar.gz: 793b0fe5a3653b53279dd3c7554516b187c339f1
5
5
  SHA512:
6
- metadata.gz: c7d9a28eed03ce3429a45d240acd304c215761608b5494e5c1a0bb2aac9bd7c00120d52775de6fda8d37379c016b5de09a3169526281f766e0268059a5a7eb13
7
- data.tar.gz: e9fd2c544fd8fd7eb98dfc401849fe222cb6073189f96a24412446887c7c7e0a717c71c59546d8efefeb8d3bbb606135bdfd4761f1e33c055666caec2ffc4880
6
+ metadata.gz: 35330f4f8b663bc3750bd7db411e139b5fbcba6936ae297a577b43adb48dfaf4e10550d5d32d151438b284c0e74c4968a8d5087323f517a5f0567f8aa21d0fe3
7
+ data.tar.gz: ab214de2024c22b2d991bed5631ff30bf5ba0ee095f2679ecb0e418647741caf78c85256355e260bd7e9ef1304969b2a63a3f955b4b729dd87da6d054291f465
data/README.md CHANGED
@@ -17,10 +17,17 @@ Install the plugin by running:
17
17
  $ bundle
18
18
  ```
19
19
 
20
+ ## Scopes
21
+
22
+ Route Localize adds two routing scopes you can use on your routes:
23
+
24
+ - `localize`: your locale is the first thing in the path (`http://example.com/en/foo`)
25
+ - `localize_subdomain`: your locale is your subdomain (`http://en.example.com/foo`)
26
+
20
27
 
21
28
  ## Usage
22
29
 
23
- In your `config/routes.rb`, localize the routes you want by surrounding them with a scope. For example:
30
+ In your `config/routes.rb`, localize some routes with one of the scopes. For example:
24
31
 
25
32
  ```rb
26
33
  scope localize: [:en, :fr] do
@@ -59,7 +66,7 @@ module ApplicationHelper
59
66
  end
60
67
  ```
61
68
 
62
- You can then use the `locale_switch_url` helper in your views:
69
+ You can then use the `locale_switch_url` or `locale_switch_subdomain_url` helpers in your views:
63
70
 
64
71
  ```erb
65
72
  <%= link_to "fr", locale_switch_url("fr") %>
@@ -73,7 +80,8 @@ If your params are different depending on the language, you can override
73
80
  the switcher's params by creating a `route_localize_options` method that
74
81
  takes the locale as a parameter.
75
82
 
76
- For example if you would like to switch `http://en.example.org/products/keyboard`
83
+ For example if you would like to switch from
84
+ `http://en.example.org/products/keyboard`
77
85
  to `http://fr.example.org/produits/clavier`, where `keyboard` and `clavier`
78
86
  are the `:id` parameter.
79
87
 
@@ -103,37 +111,39 @@ Then you would need to add this inside your controller:
103
111
 
104
112
  ## Caveats
105
113
 
106
- - Tests are missing for the `locale_switch_url` helper.
107
- - Rails' `url_for` cannot find the translation, prefer to use the `_path` and
108
- `_url` methods instead. If you can't, one way around is to use
109
- `RouteLocalize.translate_path`.
114
+ Rails' `url_for` cannot find the translation url automatically,
115
+ prefer to use the `_path` and `_url` methods instead.
110
116
 
111
- For example :
117
+ If you can't, one way around is to use `RouteLocalize.translate_path`.
118
+
119
+ For example :
120
+
121
+ ```ruby
122
+ RouteLocalize.translate_path(url_for(controller: 'trees', action: 'index'),
123
+ I18n.locale)
124
+ ```
112
125
 
113
- ```ruby
114
- url = url_for(controller: 'trees', action: 'index')
115
- url = RouteLocalize.translate_path(url, I18n.locale)
116
- ```
126
+ If you are using subdomains you should add `by_subdomain: true` option.
117
127
 
118
128
 
119
129
  ## Development
120
130
 
121
- Please help by [submitting issues](https://github.com/sunny/route_localize),
122
- creating pull requests, talking about the gem or saying thanks.
131
+ You may help by [submitting issues](https://github.com/sunny/route_localize),
132
+ creating pull requests, talking about the gem or by saying thanks.
123
133
 
124
134
 
125
135
  ## Other gems to translate Rails routes
126
136
 
127
- The following gems could be a good match for your project:
137
+ The following gems could also be a good match for your project:
128
138
 
129
139
  - [translate_routes](https://github.com/raul/translate_routes)
130
140
  - [route_translator](https://github.com/enriclluelles/route_translator/)
131
141
  - [rails-translate-routes](https://github.com/francesc/rails-translate-routes/)
132
142
  - [routing-filter](https://github.com/svenfuchs/routing-filter)
133
143
 
134
- Route Localize is different because it:
144
+ Route Localize is different from these solutions because it:
135
145
 
136
- - adds a constraint to the subdomain instead of relying on the locale beeing in the url (`en/…` `fr/`)
146
+ - can add a constraint to the subdomain instead of relying on the locale beeing in the url (`en/…` `fr/`)
137
147
  - plays well with gems that introduce extra locales, routes you don't want to translate, or reload routes before i18n is loaded (`activeadmin` for example)
138
- - includes a powerfull language switcher helper.
148
+ - includes a language switcher helper that returns the correct url in each other language
139
149
 
data/Rakefile CHANGED
@@ -1,11 +1,13 @@
1
+ # Bundler
1
2
  begin
2
3
  require 'bundler/setup'
3
4
  rescue LoadError
4
5
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
6
  end
7
+ Bundler::GemHelper.install_tasks
6
8
 
9
+ # Rdoc
7
10
  require 'rdoc/task'
8
-
9
11
  RDoc::Task.new(:rdoc) do |rdoc|
10
12
  rdoc.rdoc_dir = 'rdoc'
11
13
  rdoc.title = 'RouteLocalize'
@@ -14,21 +16,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
16
  rdoc.rdoc_files.include('lib/**/*.rb')
15
17
  end
16
18
 
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
19
+ # Dummy app tasks
20
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
21
  load 'rails/tasks/engine.rake'
19
22
 
20
-
21
-
22
- Bundler::GemHelper.install_tasks
23
-
24
- require 'rake/testtask'
25
-
26
- Rake::TestTask.new(:test) do |t|
27
- t.libs << 'lib'
28
- t.libs << 'test'
29
- t.pattern = 'test/**/*_test.rb'
30
- t.verbose = false
31
- end
32
-
33
-
34
- task default: :test
23
+ # Rspec
24
+ require 'rspec/core/rake_task'
25
+ RSpec::Core::RakeTask.new(:spec)
26
+ task default: :spec
@@ -1,33 +1,44 @@
1
1
  # Helper to include in ApplicationHelper
2
2
 
3
3
  module RouteLocalizeHelper
4
- # URL to another language to switch to.
5
- # Can be overridden per-controller.
4
+
5
+ # Returns the URL to the current page in another locale
6
6
  def locale_switch_url(locale)
7
- name = request_route_name.to_s.sub(/_#{I18n.locale}$/, '')
7
+ route_localize_switch(locale)
8
+ end
9
+
10
+ # Returns the URL to the current page in another locale, using subdomains
11
+ def locale_switch_subdomain_url(locale)
12
+ route_localize_switch(locale, subdomain: locale)
13
+ end
14
+
15
+
16
+ private
17
+
18
+ def route_localize_switch(locale, options = {})
19
+ name = route_localize_route_name
8
20
  method = "#{name}_#{locale}_url"
9
21
  method = "#{name}_url" unless respond_to?(method)
22
+ method = "#{locale}_root_url" unless respond_to?(method)
10
23
  method = "root_url" unless respond_to?(method)
11
24
 
12
- options = { subdomain: locale }
13
- options.merge! route_localize_options(locale).to_h
25
+ options.merge! route_localize_options(locale)
14
26
  route = send(method, options)
15
27
 
16
28
  # Ensure the locale switcher only goes to GET routes
17
29
  begin
18
30
  Rails.application.routes.recognize_path(route, method: :get)
19
31
  rescue ActionController::RoutingError
20
- route = root_url
32
+ route = root_url(options)
21
33
  end
22
34
 
23
35
  route
24
36
  end
25
37
 
26
- private
27
-
28
- def request_route_name
29
- Rails.application.routes.router.recognize(request) do |route, _|
30
- return route.name
38
+ # Return current route name without the _en or _fr
39
+ def route_localize_route_name
40
+ Rails.application.routes.router.recognize(request) do |route, *_|
41
+ return route.name.to_s.sub(/_#{I18n.locale}$/, '')
31
42
  end
32
43
  end
33
44
 
@@ -35,12 +46,7 @@ module RouteLocalizeHelper
35
46
  # `route_localize_path_options` method that accepts a locale.
36
47
  def route_localize_options(locale)
37
48
  if respond_to?(:route_localize_path_options)
38
- route_localize_path_options(locale)
39
-
40
- # DEPRECATED method that could redefine the id parameter
41
- elsif respond_to?(:localize_param)
42
- { id: localize_param(locale) }
43
-
49
+ route_localize_path_options(locale).to_h
44
50
  else
45
51
  {}
46
52
  end
@@ -0,0 +1,78 @@
1
+ module RouteLocalize
2
+ # Represents a route line that needs to be translated in a given locale.
3
+ #
4
+ # Instances of Route accept the same arguments that
5
+ # `ActionDispatch::Routing::RouteSet`'s method `add_route` accepts, with the
6
+ # addition of:
7
+ # - `route_set`: the app's current route set
8
+ # - `locale`: locale for the given route
9
+ Route = Struct.new(:app, :conditions, :requirements, :defaults,
10
+ :as, :anchor, :route_set, :locale) do
11
+
12
+ # Returns the arguments to pass on to `add_route` to create the route
13
+ def to_add_route_arguments
14
+ [app,
15
+ locale_conditions,
16
+ locale_requirements,
17
+ locale_defaults,
18
+ locale_as,
19
+ anchor]
20
+ end
21
+
22
+
23
+ private
24
+
25
+ # Returns route conditions that match the locale
26
+ def locale_conditions
27
+ cond = conditions.dup
28
+
29
+ cond[:path_info] = RouteLocalize.translate_path(
30
+ conditions[:path_info],
31
+ locale,
32
+ by_subdomain: by_subdomain?)
33
+
34
+ if by_subdomain?
35
+ cond[:subdomain] = locale.to_s
36
+ else
37
+ cond[:locale] = locale.to_s
38
+ end
39
+
40
+ # For good measure
41
+ cond[:required_defaults] -= [:localize, :localize_subdomain]
42
+
43
+ cond
44
+ end
45
+
46
+ def locale_requirements
47
+ if by_subdomain?
48
+ { subdomain: locale.to_s }
49
+ else
50
+ { locale: locale.to_s }
51
+ end
52
+ end
53
+
54
+ # Return route defaults for the locale
55
+ def locale_defaults
56
+ if by_subdomain?
57
+ defaults.merge(subdomain: locale.to_s)
58
+ else
59
+ defaults.merge(locale: locale.to_s)
60
+ end
61
+ end
62
+
63
+ # Returns a route name that includes the locale
64
+ # Example: "trees" -> "trees_fr"
65
+ def locale_as
66
+ locale_as = "#{as}_#{locale}"
67
+ locale_as = nil if route_set.named_routes.routes[locale_as.to_sym]
68
+ locale_as
69
+ end
70
+
71
+ # Returns true if the route must be by subdomain ("fr.example.com"),
72
+ # false if it should be by path ("example.com/fr")
73
+ def by_subdomain?
74
+ conditions[:required_defaults].include?(:localize_subdomain)
75
+ end
76
+
77
+ end
78
+ end
@@ -1,3 +1,3 @@
1
1
  module RouteLocalize
2
- VERSION = "0.0.7"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -1,27 +1,37 @@
1
1
  require "route_localize/engine"
2
2
  require "route_localize/extensions"
3
+ require "route_localize/route"
3
4
 
4
5
  module RouteLocalize
5
- extend self
6
-
7
- # Yields one or several routes if the route definition has a `localize:` scope
6
+ module_function
7
+
8
+ # Yields one or several route definitions if the route definition has a
9
+ # `localize` or `localize_subdomain` scope
10
+ #
11
+ # The arguments it accepts are the arguments given to
12
+ # `ActionDispatch::Routing::RouteSet`'s method `add_route`, with the addition
13
+ # of the `route_set` argument that should hold the current route set.
14
+ #
15
+ # The array it yields are the arguments accepted by `add_route` so that these
16
+ # can be handed back to Rails to insert the yielded route.
8
17
  def translate_route(app, conditions, requirements, defaults, as, anchor, route_set)
18
+ locales = defaults.delete(:localize) || defaults.delete(:localize_subdomain)
19
+ if locales.present?
9
20
 
10
- if defaults[:localize]
11
- # Makes sure the routes aren't loaded before i18n can read translations
12
- # This happens when gems like `activeadmin` call `Rails.application.reload_routes!`
21
+ # Makes sure the routes aren't created before i18n can read translations
22
+ # This happens when gems like activeadmin call `Rails.application.reload_routes!`
13
23
  return unless I18n.load_path.grep(/routes.yml$/).any?
14
24
 
15
- locales = defaults.delete(:localize)
16
25
  locales.each do |locale|
17
- yield *route_args_for_locale(locale, app, conditions, requirements, defaults, as, anchor, route_set)
26
+ route = Route.new(app, conditions, requirements, defaults,
27
+ as, anchor, route_set, locale)
28
+ yield *route.to_add_route_arguments
18
29
  end
19
30
 
20
31
  define_locale_helpers(as, route_set.named_routes.module)
21
32
  else
22
33
  yield app, conditions, requirements, defaults, as, anchor
23
34
  end
24
-
25
35
  end
26
36
 
27
37
  # Create _path and _url helpers for the given path name
@@ -34,8 +44,10 @@ module RouteLocalize
34
44
  end
35
45
  end
36
46
 
37
- # Translate a path
38
- def translate_path(path, locale)
47
+
48
+ # Returns a translated path
49
+ # Example: "/trees/:id(.:format)" -> "/arbres/:id(.:format)", …
50
+ def translate_path(path, locale, by_subdomain: false)
39
51
  path = path.dup
40
52
 
41
53
  # Remove "(.:format)" in routes or "?args" if used elsewhere
@@ -44,36 +56,22 @@ module RouteLocalize
44
56
  segments = path.split('/').map do |segment|
45
57
  translate_segment(segment, locale)
46
58
  end
47
- "#{segments.join('/')}#{final_options}"
59
+
60
+ segments.unshift(":locale") unless by_subdomain
61
+ segments = segments.reject(&:blank?)
62
+
63
+ "/#{segments.join('/')}#{final_options}"
48
64
  end
49
65
 
50
- # Translate part of a path
66
+ # Translates part of a path if it can
67
+ # Example: "trees" -> "arbres", ":id" -> ":id"
51
68
  def translate_segment(segment, locale)
52
69
  if segment =~ /^[a-z_0-9]+$/i
53
- translation = I18n.t "routes.#{segment}", default: segment, locale: locale
70
+ translation = I18n.t "routes.#{segment}", default: segment,
71
+ locale: locale
54
72
  CGI.escape(translation)
55
73
  else
56
74
  segment
57
75
  end
58
76
  end
59
-
60
-
61
- private
62
-
63
- def route_args_for_locale(locale, app, conditions, requirements, defaults, as, anchor, route_set)
64
- # Name
65
- locale_as = "#{as}_#{locale}"
66
- locale_as = nil if route_set.named_routes.routes[locale_as.to_sym]
67
-
68
- # Path
69
- locale_conditions = conditions.dup
70
- locale_conditions[:path_info] = translate_path(locale_conditions[:path_info], locale)
71
- locale_conditions[:subdomain] = locale.to_s
72
- locale_conditions[:required_defaults] = locale_conditions[:required_defaults].reject { |l| l == :localize }
73
-
74
- # Other arguments
75
- locale_defaults = defaults.merge(subdomain: locale.to_s)
76
-
77
- [app, locale_conditions, requirements, locale_defaults, locale_as, anchor]
78
- end
79
77
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: route_localize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunny Ripert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
11
+ date: 2014-10-08 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: rspec-rails
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 4 engine to to translate routes using locale files and subdomains.
42
56
  email:
43
57
  - sunny@sunfox.org
@@ -45,55 +59,16 @@ executables: []
45
59
  extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
62
+ - MIT-LICENSE
63
+ - README.md
64
+ - Rakefile
48
65
  - app/helpers/route_localize_helper.rb
66
+ - lib/route_localize.rb
49
67
  - lib/route_localize/engine.rb
50
68
  - lib/route_localize/extensions.rb
69
+ - lib/route_localize/route.rb
51
70
  - lib/route_localize/version.rb
52
- - lib/route_localize.rb
53
71
  - lib/tasks/route_localize_tasks.rake
54
- - MIT-LICENSE
55
- - Rakefile
56
- - README.md
57
- - test/dummy/app/assets/javascripts/application.js
58
- - test/dummy/app/assets/stylesheets/application.css
59
- - test/dummy/app/controllers/application_controller.rb
60
- - test/dummy/app/controllers/trees_controller.rb
61
- - test/dummy/app/helpers/application_helper.rb
62
- - test/dummy/app/models/tree.rb
63
- - test/dummy/app/views/layouts/application.html.erb
64
- - test/dummy/app/views/trees/home.html.erb
65
- - test/dummy/bin/bundle
66
- - test/dummy/bin/rails
67
- - test/dummy/bin/rake
68
- - test/dummy/config/application.rb
69
- - test/dummy/config/boot.rb
70
- - test/dummy/config/database.yml
71
- - test/dummy/config/environment.rb
72
- - test/dummy/config/environments/development.rb
73
- - test/dummy/config/environments/production.rb
74
- - test/dummy/config/environments/test.rb
75
- - test/dummy/config/initializers/backtrace_silencers.rb
76
- - test/dummy/config/initializers/filter_parameter_logging.rb
77
- - test/dummy/config/initializers/inflections.rb
78
- - test/dummy/config/initializers/mime_types.rb
79
- - test/dummy/config/initializers/reloader.rb
80
- - test/dummy/config/initializers/secret_token.rb
81
- - test/dummy/config/initializers/session_store.rb
82
- - test/dummy/config/initializers/wrap_parameters.rb
83
- - test/dummy/config/locales/routes.yml
84
- - test/dummy/config/routes.rb
85
- - test/dummy/config.ru
86
- - test/dummy/db/test.sqlite3
87
- - test/dummy/log/test.log
88
- - test/dummy/public/404.html
89
- - test/dummy/public/422.html
90
- - test/dummy/public/500.html
91
- - test/dummy/public/favicon.ico
92
- - test/dummy/Rakefile
93
- - test/dummy/README.rdoc
94
- - test/integration/routes_test.rb
95
- - test/route_localize_test.rb
96
- - test/test_helper.rb
97
72
  homepage: http://github.com/sunny/route_localize
98
73
  licenses:
99
74
  - MIT
@@ -114,48 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
89
  version: '0'
115
90
  requirements: []
116
91
  rubyforge_project:
117
- rubygems_version: 2.1.11
92
+ rubygems_version: 2.4.1
118
93
  signing_key:
119
94
  specification_version: 4
120
95
  summary: Rails 4 engine to translate routes.
121
- test_files:
122
- - test/dummy/app/assets/javascripts/application.js
123
- - test/dummy/app/assets/stylesheets/application.css
124
- - test/dummy/app/controllers/application_controller.rb
125
- - test/dummy/app/controllers/trees_controller.rb
126
- - test/dummy/app/helpers/application_helper.rb
127
- - test/dummy/app/models/tree.rb
128
- - test/dummy/app/views/layouts/application.html.erb
129
- - test/dummy/app/views/trees/home.html.erb
130
- - test/dummy/bin/bundle
131
- - test/dummy/bin/rails
132
- - test/dummy/bin/rake
133
- - test/dummy/config/application.rb
134
- - test/dummy/config/boot.rb
135
- - test/dummy/config/database.yml
136
- - test/dummy/config/environment.rb
137
- - test/dummy/config/environments/development.rb
138
- - test/dummy/config/environments/production.rb
139
- - test/dummy/config/environments/test.rb
140
- - test/dummy/config/initializers/backtrace_silencers.rb
141
- - test/dummy/config/initializers/filter_parameter_logging.rb
142
- - test/dummy/config/initializers/inflections.rb
143
- - test/dummy/config/initializers/mime_types.rb
144
- - test/dummy/config/initializers/reloader.rb
145
- - test/dummy/config/initializers/secret_token.rb
146
- - test/dummy/config/initializers/session_store.rb
147
- - test/dummy/config/initializers/wrap_parameters.rb
148
- - test/dummy/config/locales/routes.yml
149
- - test/dummy/config/routes.rb
150
- - test/dummy/config.ru
151
- - test/dummy/db/test.sqlite3
152
- - test/dummy/log/test.log
153
- - test/dummy/public/404.html
154
- - test/dummy/public/422.html
155
- - test/dummy/public/500.html
156
- - test/dummy/public/favicon.ico
157
- - test/dummy/Rakefile
158
- - test/dummy/README.rdoc
159
- - test/integration/routes_test.rb
160
- - test/route_localize_test.rb
161
- - test/test_helper.rb
96
+ test_files: []
@@ -1,28 +0,0 @@
1
- == README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
25
-
26
-
27
- Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.
data/test/dummy/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Dummy::Application.load_tasks
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
@@ -1,13 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
10
- *
11
- *= require_self
12
- *= require_tree .
13
- */
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
@@ -1,25 +0,0 @@
1
- class TreesController < ApplicationController
2
- def home
3
- render text: 'home'
4
- end
5
-
6
- def show
7
- render text: 'show'
8
- end
9
-
10
- def create
11
- render text: 'create'
12
- end
13
-
14
- def edit
15
- render text: 'edit'
16
- end
17
-
18
- def update
19
- render text: 'update'
20
- end
21
-
22
- def index
23
- render text: 'index'
24
- end
25
- end
@@ -1,3 +0,0 @@
1
- module ApplicationHelper
2
- include RouteLocalizeHelper
3
- end
@@ -1,18 +0,0 @@
1
- # Object that acts like a routeable ActiveRecord model
2
- class Tree
3
- def initialize(attributes)
4
- @attributes = attributes
5
- end
6
-
7
- def to_param
8
- @attributes[:id]
9
- end
10
-
11
- def self.model_name
12
- self
13
- end
14
-
15
- def self.singular_route_key
16
- "tree"
17
- end
18
- end