stachio 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/README.md +4 -1
- data/app/models/stachio/template.rb +5 -1
- data/app/views/stachio/templates/_form.html.erb +4 -0
- data/app/views/stachio/templates/index.html.erb +10 -10
- data/app/views/stachio/templates/show.html.erb +14 -10
- data/db/migrate/20130529130543_add_description_to_stachio_templates.rb +5 -0
- data/lib/stachio/version.rb +1 -1
- data/spec/dummy/db/migrate/20130529132016_create_stachio_templates.stachio.rb +11 -0
- data/spec/dummy/db/migrate/20130529132017_add_description_to_stachio_templates.stachio.rb +6 -0
- data/spec/dummy/db/schema.rb +2 -1
- data/stachio.gemspec +2 -2
- metadata +20 -9
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
1
|
Stash your Stache with *Stachio*
|
2
2
|
==============================
|
3
|
-
Stachio is a rails engine which aims to facilitate the creation, retrieval,
|
3
|
+
Stachio is a rails engine which aims to facilitate the creation, retrieval,
|
4
|
+
update, & deletion of mustache templates in a relational database.
|
5
|
+
|
6
|
+
[![Build Status](https://travis-ci.org/bwthomas/stachio.png)](https://travis-ci.org/bwthomas/stachio)
|
@@ -4,7 +4,7 @@ module Stachio
|
|
4
4
|
class Template < ActiveRecord::Base
|
5
5
|
lookup_by :template_name
|
6
6
|
|
7
|
-
attr_accessible :template_name, :content
|
7
|
+
attr_accessible :template_name, :description, :content
|
8
8
|
validates_presence_of :template_name, :content
|
9
9
|
|
10
10
|
attr_accessor :presents, :rendered
|
@@ -27,5 +27,9 @@ module Stachio
|
|
27
27
|
self.presents = values
|
28
28
|
render options.merge(:force => true)
|
29
29
|
end
|
30
|
+
|
31
|
+
def describe(n=32)
|
32
|
+
(description && description.size > n) ? description[0..n] + ' [...]' : description
|
33
|
+
end
|
30
34
|
end
|
31
35
|
end
|
@@ -15,6 +15,10 @@
|
|
15
15
|
<%= f.label :template_name %><br />
|
16
16
|
<%= f.text_field :template_name %>
|
17
17
|
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :description %><br />
|
20
|
+
<%= f.text_area :description %>
|
21
|
+
</div>
|
18
22
|
<div class="field">
|
19
23
|
<%= f.label :content %><br />
|
20
24
|
<%= f.text_area :content %>
|
@@ -3,21 +3,21 @@
|
|
3
3
|
<table>
|
4
4
|
<tr>
|
5
5
|
<th>Template name</th>
|
6
|
-
<th>
|
7
|
-
<th></th>
|
8
|
-
<th></th>
|
6
|
+
<th>Description</th>
|
9
7
|
<th></th>
|
10
8
|
</tr>
|
11
9
|
|
12
10
|
<% @templates.each do |template| %>
|
13
11
|
<tr>
|
14
|
-
<td><%= template.template_name %></td>
|
15
|
-
<td><%= template.
|
16
|
-
<td
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
<td style="border: 1px solid grey; padding: 1ex; margin: 1ex;"><%= template.template_name %></td>
|
13
|
+
<td style="border: 1px solid grey; padding: 1ex; margin: 1ex;"><%= template.describe %></td>
|
14
|
+
<td style="border: 1px solid grey; padding: 1ex; margin: 1ex;">
|
15
|
+
<%= link_to 'Show', template %>
|
16
|
+
<% unless readonly %>
|
17
|
+
<%= link_to 'Edit', edit_template_path(template) %>
|
18
|
+
<%= link_to 'Destroy', template, method: :delete, data: { confirm: 'Are you sure?' } %>
|
19
|
+
<% end %>
|
20
|
+
</td>
|
21
21
|
</tr>
|
22
22
|
<% end %>
|
23
23
|
</table>
|
@@ -1,17 +1,21 @@
|
|
1
|
-
<
|
1
|
+
<div style="border: 1px solid grey; padding: 1ex; margin: 1ex; width: 92%; word-wrap: break-word;">
|
2
|
+
<h4>Template name:</h4>
|
3
|
+
<p><%= @template.template_name %></p>
|
4
|
+
</div>
|
2
5
|
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
</
|
7
|
-
|
8
|
-
<p>
|
9
|
-
<b>Content:</b>
|
10
|
-
<%= @template.content %>
|
11
|
-
</p>
|
6
|
+
<div style="border: 1px solid grey; padding: 1ex; margin: 1ex; width: 92%; word-wrap: break-word;">
|
7
|
+
<h4>Description:</h4>
|
8
|
+
<p><%= @template.description %></p>
|
9
|
+
</div>
|
12
10
|
|
11
|
+
<div style="border: 1px solid grey; padding: 1ex; margin: 1ex; width: 92%; word-wrap: break-word;">
|
12
|
+
<h4>Content:</h4>
|
13
|
+
<p><%= @template.content %></p>
|
14
|
+
</div>
|
13
15
|
|
16
|
+
<div style="border: 1px solid grey; padding: 1ex; margin: 1ex; width: 92%; word-wrap: break-word;">
|
14
17
|
<% unless readonly %>
|
15
18
|
<%= link_to 'Edit', edit_template_path(@template) %> |
|
16
19
|
<% end %>
|
17
20
|
<%= link_to 'Back', templates_path %>
|
21
|
+
</div>
|
data/lib/stachio/version.rb
CHANGED
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,13 +11,14 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20130529132017) do
|
15
15
|
|
16
16
|
create_table "stachio_templates", :force => true do |t|
|
17
17
|
t.string "template_name"
|
18
18
|
t.text "content"
|
19
19
|
t.datetime "created_at", :null => false
|
20
20
|
t.datetime "updated_at", :null => false
|
21
|
+
t.text "description"
|
21
22
|
end
|
22
23
|
|
23
24
|
end
|
data/stachio.gemspec
CHANGED
@@ -16,10 +16,10 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec}/*`.split("\n")
|
18
18
|
|
19
|
-
s.add_dependency "rails", "~> 3.2.
|
19
|
+
s.add_dependency "rails", "~> 3.2.13"
|
20
20
|
s.add_dependency "lookup_by"
|
21
21
|
s.add_dependency "jquery-rails" ## required by the dummy application
|
22
|
-
s.add_dependency "stache"
|
22
|
+
s.add_dependency "stache", "~> 1.0.2" ## use mustache/handlebars for views
|
23
23
|
s.add_dependency "mustache"
|
24
24
|
s.add_dependency "handlebars"
|
25
25
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stachio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-06-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.2.
|
22
|
+
version: 3.2.13
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 3.2.
|
30
|
+
version: 3.2.13
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: lookup_by
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,17 +65,17 @@ dependencies:
|
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ~>
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
70
|
+
version: 1.0.2
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ~>
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
78
|
+
version: 1.0.2
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
80
|
name: mustache
|
81
81
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,6 +233,7 @@ files:
|
|
233
233
|
- .rspec
|
234
234
|
- .ruby-version
|
235
235
|
- .simplecov
|
236
|
+
- .travis.yml
|
236
237
|
- Gemfile
|
237
238
|
- MIT-LICENSE
|
238
239
|
- README.md
|
@@ -256,6 +257,7 @@ files:
|
|
256
257
|
- app/views/stachio/templates/show.html.erb
|
257
258
|
- config/routes.rb
|
258
259
|
- db/migrate/20130509172418_create_stachio_templates.rb
|
260
|
+
- db/migrate/20130529130543_add_description_to_stachio_templates.rb
|
259
261
|
- lib/stachio.rb
|
260
262
|
- lib/stachio/engine.rb
|
261
263
|
- lib/stachio/version.rb
|
@@ -289,6 +291,8 @@ files:
|
|
289
291
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
290
292
|
- spec/dummy/config/locales/en.yml
|
291
293
|
- spec/dummy/config/routes.rb
|
294
|
+
- spec/dummy/db/migrate/20130529132016_create_stachio_templates.stachio.rb
|
295
|
+
- spec/dummy/db/migrate/20130529132017_add_description_to_stachio_templates.stachio.rb
|
292
296
|
- spec/dummy/db/schema.rb
|
293
297
|
- spec/dummy/lib/assets/.gitkeep
|
294
298
|
- spec/dummy/log/.gitkeep
|
@@ -315,12 +319,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
315
319
|
- - ! '>='
|
316
320
|
- !ruby/object:Gem::Version
|
317
321
|
version: '0'
|
322
|
+
segments:
|
323
|
+
- 0
|
324
|
+
hash: 4268679556891799205
|
318
325
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
319
326
|
none: false
|
320
327
|
requirements:
|
321
328
|
- - ! '>='
|
322
329
|
- !ruby/object:Gem::Version
|
323
330
|
version: '0'
|
331
|
+
segments:
|
332
|
+
- 0
|
333
|
+
hash: 4268679556891799205
|
324
334
|
requirements: []
|
325
335
|
rubyforge_project:
|
326
336
|
rubygems_version: 1.8.23
|
@@ -356,6 +366,8 @@ test_files:
|
|
356
366
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
357
367
|
- spec/dummy/config/locales/en.yml
|
358
368
|
- spec/dummy/config/routes.rb
|
369
|
+
- spec/dummy/db/migrate/20130529132016_create_stachio_templates.stachio.rb
|
370
|
+
- spec/dummy/db/migrate/20130529132017_add_description_to_stachio_templates.stachio.rb
|
359
371
|
- spec/dummy/db/schema.rb
|
360
372
|
- spec/dummy/lib/assets/.gitkeep
|
361
373
|
- spec/dummy/log/.gitkeep
|
@@ -369,4 +381,3 @@ test_files:
|
|
369
381
|
- spec/requests/stachio/stachio_templates_spec.rb
|
370
382
|
- spec/routing/stachio/templates_routing_spec.rb
|
371
383
|
- spec/spec_helper.rb
|
372
|
-
has_rdoc:
|