Skip to content

Commit ed0ee82

Browse files
committed
[RAILS] Updated the application templates to work with README.md instead of README.rdoc
Current Rails version uses `README.md` instead of the old `.rdoc` file, and the templates have not been updated to reflect that. This patch changes both the logic to insert content into the README file and the check whether a previous template has been already run. Related: elastic#668
1 parent 9c79376 commit ed0ee82

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

elasticsearch-rails/lib/rails/templates/01-basic.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@
8080
say_status "README", "Adding Readme...\n", :yellow
8181
puts '-'*80, ''; sleep 0.25
8282

83-
remove_file 'README.rdoc'
83+
remove_file 'README.md'
8484

85-
create_file 'README.rdoc', <<-README
86-
= Ruby on Rails and Elasticsearch: Example application
85+
create_file 'README.md', <<-README
86+
# Ruby on Rails and Elasticsearch: Example application
8787
8888
This application is an example of integrating the {Elasticsearch}[http://www.elasticsearch.org]
8989
search engine with the {Ruby On Rails}[http://rubyonrails.org] web framework.
9090
9191
It has been generated by application templates available at
9292
https://github.com/elasticsearch/elasticsearch-rails/tree/master/elasticsearch-rails/lib/rails/templates.
9393
94-
== [1] Basic
94+
## [1] Basic
9595
9696
The `basic` version provides a simple integration for a simple Rails model, `Article`, showing how
9797
to include the search engine support in your model, automatically index changes to records,

elasticsearch-rails/lib/rails/templates/02-pretty.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# $ rails new searchapp --skip --skip-bundle --template https://raw.github.com/elasticsearch/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/02-pretty.rb
22

3-
unless File.read('README.rdoc').include? '== [1] Basic'
3+
unless File.read('README.md').include? '## [1] Basic'
44
say_status "ERROR", "You have to run the 01-basic.rb template first.", :red
55
exit(1)
66
end
@@ -9,9 +9,9 @@
99
say_status "README", "Updating Readme...\n", :yellow
1010
puts '-'*80, ''; sleep 0.25
1111

12-
append_to_file 'README.rdoc', <<-README
12+
append_to_file 'README.md', <<-README
1313
14-
== [2] Pretty
14+
## [2] Pretty
1515
1616
The `pretty` template builds on the `basic` version and brings couple of improvements:
1717
@@ -22,7 +22,7 @@
2222
2323
README
2424

25-
git add: "README.rdoc"
25+
git add: "README.md"
2626
git commit: "-m '[02] Updated the application README'"
2727

2828
# ----- Update application.rb ---------------------------------------------------------------------

elasticsearch-rails/lib/rails/templates/03-expert.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# $ rails new searchapp --skip --skip-bundle --template https://raw.github.com/elasticsearch/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/03-expert.rb
22

3-
unless File.read('README.md').include? '== [2] Pretty'
3+
unless File.read('README.md').include? '## [2] Pretty'
44
say_status "ERROR", "You have to run the 01-basic.rb and 02-pretty.rb templates first.", :red
55
exit(1)
66
end

elasticsearch-rails/lib/rails/templates/04-dsl.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# $ rails new searchapp --skip --skip-bundle --template https://raw.githubusercontent.com/elastic/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/04-dsl.rb
22

3-
unless File.read('README.rdoc').include? '== [3] Expert'
3+
unless File.read('README.md').include? '## [3] Expert'
44
say_status "ERROR", "You have to run the 01-basic.rb, 02-pretty.rb and 03-expert.rb templates first.", :red
55
exit(1)
66
end
77

8-
append_to_file 'README.rdoc', <<-README
8+
append_to_file 'README.md', <<-README
99
10-
== [4] DSL
10+
## [4] DSL
1111
1212
The `dsl` template refactors the search definition in SearchController#index
1313
to use the [`elasticsearch-dsl`](https://github.com/elastic/elasticsearch-ruby/tree/dsl/elasticsearch-dsl)
1414
Rubygem for better expresivity and readability of the code.
1515
1616
README
1717

18-
git add: "README.rdoc"
18+
git add: "README.md"
1919
git commit: "-m '[03] Updated the application README'"
2020

2121
run 'rm -f app/assets/stylesheets/*.scss'

elasticsearch-rails/lib/rails/templates/05-settings-files.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
# (See: 01-basic.rb, 02-pretty.rb, 03-expert.rb, 04-dsl.rb)
44

5-
append_to_file 'README.rdoc', <<-README
5+
append_to_file 'README.md', <<-README
66
7-
== [5] Settings Files
7+
## [5] Settings Files
88
99
The `settings-files` template refactors the `Searchable` module to load the index settings
1010
from an external file.
1111
1212
README
1313

14-
git add: "README.rdoc"
14+
git add: "README.md"
1515
git commit: "-m '[05] Updated the application README'"
1616

1717
# ----- Setup the Searchable module to load settings from config/elasticsearch/articles_settings.json

0 commit comments

Comments
 (0)