stachio 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/.gitignore +9 -0
  2. data/.rspec +1 -0
  3. data/.ruby-version +1 -0
  4. data/.simplecov +21 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +152 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +3 -0
  9. data/Rakefile +50 -0
  10. data/app/assets/images/stachio/.gitkeep +0 -0
  11. data/app/assets/javascripts/stachio/application.js +15 -0
  12. data/app/assets/javascripts/stachio/templates.js +2 -0
  13. data/app/assets/stylesheets/scaffold.css +56 -0
  14. data/app/assets/stylesheets/stachio/application.css +13 -0
  15. data/app/assets/stylesheets/stachio/templates.css +4 -0
  16. data/app/controllers/stachio/application_controller.rb +4 -0
  17. data/app/controllers/stachio/templates_controller.rb +87 -0
  18. data/app/helpers/stachio/application_helper.rb +4 -0
  19. data/app/helpers/stachio/templates_helper.rb +4 -0
  20. data/app/models/stachio/template.rb +21 -0
  21. data/app/views/layouts/stachio/application.html.erb +14 -0
  22. data/app/views/stachio/templates/_form.html.erb +25 -0
  23. data/app/views/stachio/templates/edit.html.erb +6 -0
  24. data/app/views/stachio/templates/index.html.erb +25 -0
  25. data/app/views/stachio/templates/new.html.erb +5 -0
  26. data/app/views/stachio/templates/show.html.erb +15 -0
  27. data/config/routes.rb +4 -0
  28. data/db/migrate/20130509172418_create_stachio_templates.rb +10 -0
  29. data/lib/stachio.rb +4 -0
  30. data/lib/stachio/engine.rb +17 -0
  31. data/lib/stachio/proxy.rb +20 -0
  32. data/lib/stachio/version.rb +3 -0
  33. data/lib/tasks/stachio_tasks.rake +4 -0
  34. data/script/rails +8 -0
  35. data/spec/controllers/stachio/templates_controller_spec.rb +167 -0
  36. data/spec/dummy/.rspec +1 -0
  37. data/spec/dummy/.ruby-version +1 -0
  38. data/spec/dummy/README.md +3 -0
  39. data/spec/dummy/Rakefile +7 -0
  40. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  41. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  42. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  43. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  44. data/spec/dummy/app/mailers/.gitkeep +0 -0
  45. data/spec/dummy/app/models/.gitkeep +0 -0
  46. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  47. data/spec/dummy/config.ru +4 -0
  48. data/spec/dummy/config/application.rb +66 -0
  49. data/spec/dummy/config/boot.rb +10 -0
  50. data/spec/dummy/config/database.yml +25 -0
  51. data/spec/dummy/config/environment.rb +5 -0
  52. data/spec/dummy/config/environments/development.rb +37 -0
  53. data/spec/dummy/config/environments/production.rb +67 -0
  54. data/spec/dummy/config/environments/test.rb +37 -0
  55. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  56. data/spec/dummy/config/initializers/inflections.rb +15 -0
  57. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  58. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  59. data/spec/dummy/config/initializers/session_store.rb +8 -0
  60. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/spec/dummy/config/locales/en.yml +5 -0
  62. data/spec/dummy/config/routes.rb +4 -0
  63. data/spec/dummy/db/schema.rb +23 -0
  64. data/spec/dummy/lib/assets/.gitkeep +0 -0
  65. data/spec/dummy/log/.gitkeep +0 -0
  66. data/spec/dummy/public/404.html +26 -0
  67. data/spec/dummy/public/422.html +26 -0
  68. data/spec/dummy/public/500.html +25 -0
  69. data/spec/dummy/public/favicon.ico +0 -0
  70. data/spec/dummy/script/rails +6 -0
  71. data/spec/helpers/stachio/templates_helper_spec.rb +17 -0
  72. data/spec/models/stachio/template_spec.rb +54 -0
  73. data/spec/requests/stachio/stachio_templates_spec.rb +11 -0
  74. data/spec/routing/stachio/templates_routing_spec.rb +37 -0
  75. data/spec/spec_helper.rb +50 -0
  76. data/stachio.gemspec +33 -0
  77. metadata +374 -0
@@ -0,0 +1,9 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/log/*.log
6
+ spec/dummy/tmp/
7
+ spec/dummy/.sass-cache
8
+ coverage/
9
+ *.swp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1 @@
1
+ 1.9.3-p194
@@ -0,0 +1,21 @@
1
+ unless ENV['COVERAGE'] == 'false'
2
+ require 'simplecov-rcov'
3
+
4
+ class SimpleCov::Formatter::MergedFormatter
5
+ def format(result)
6
+ SimpleCov::Formatter::HTMLFormatter.new.format(result)
7
+ SimpleCov::Formatter::RcovFormatter.new.format(result)
8
+ end
9
+ end
10
+
11
+ SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
12
+
13
+ SimpleCov.start('rails') do
14
+ add_filter "vendor/ruby/"
15
+ add_filter "spec/dummy"
16
+
17
+ add_group "Models", "app/models"
18
+ add_group "Views", "app/views"
19
+ add_group "Controllers", "app/controllers"
20
+ end
21
+ end
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,152 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ stachio (0.0.1)
5
+ handlebars
6
+ jquery-rails
7
+ lookup_by
8
+ mustache
9
+ rails (~> 3.2.13)
10
+ stache
11
+
12
+ GEM
13
+ remote: http://rubygems.org/
14
+ specs:
15
+ actionmailer (3.2.13)
16
+ actionpack (= 3.2.13)
17
+ mail (~> 2.5.3)
18
+ actionpack (3.2.13)
19
+ activemodel (= 3.2.13)
20
+ activesupport (= 3.2.13)
21
+ builder (~> 3.0.0)
22
+ erubis (~> 2.7.0)
23
+ journey (~> 1.0.4)
24
+ rack (~> 1.4.5)
25
+ rack-cache (~> 1.2)
26
+ rack-test (~> 0.6.1)
27
+ sprockets (~> 2.2.1)
28
+ activemodel (3.2.13)
29
+ activesupport (= 3.2.13)
30
+ builder (~> 3.0.0)
31
+ activerecord (3.2.13)
32
+ activemodel (= 3.2.13)
33
+ activesupport (= 3.2.13)
34
+ arel (~> 3.0.2)
35
+ tzinfo (~> 0.3.29)
36
+ activeresource (3.2.13)
37
+ activemodel (= 3.2.13)
38
+ activesupport (= 3.2.13)
39
+ activesupport (3.2.13)
40
+ i18n (= 0.6.1)
41
+ multi_json (~> 1.0)
42
+ arel (3.0.2)
43
+ builder (3.0.4)
44
+ coderay (1.0.9)
45
+ commonjs (0.2.6)
46
+ diff-lcs (1.2.4)
47
+ erubis (2.7.0)
48
+ handlebars (0.4.0)
49
+ commonjs (~> 0.2.3)
50
+ therubyracer (~> 0.11.1)
51
+ hike (1.2.2)
52
+ i18n (0.6.1)
53
+ journey (1.0.4)
54
+ jquery-rails (2.2.1)
55
+ railties (>= 3.0, < 5.0)
56
+ thor (>= 0.14, < 2.0)
57
+ json (1.7.7)
58
+ libv8 (3.11.8.17)
59
+ lookup_by (0.1.0)
60
+ rails (>= 3.0.0)
61
+ mail (2.5.3)
62
+ i18n (>= 0.4.0)
63
+ mime-types (~> 1.16)
64
+ treetop (~> 1.4.8)
65
+ method_source (0.8.1)
66
+ mime-types (1.23)
67
+ multi_json (1.7.3)
68
+ mustache (0.99.4)
69
+ polyglot (0.3.3)
70
+ pry (0.9.12.1)
71
+ coderay (~> 1.0.5)
72
+ method_source (~> 0.8)
73
+ slop (~> 3.4)
74
+ rack (1.4.5)
75
+ rack-cache (1.2)
76
+ rack (>= 0.4)
77
+ rack-ssl (1.3.3)
78
+ rack
79
+ rack-test (0.6.2)
80
+ rack (>= 1.0)
81
+ rails (3.2.13)
82
+ actionmailer (= 3.2.13)
83
+ actionpack (= 3.2.13)
84
+ activerecord (= 3.2.13)
85
+ activeresource (= 3.2.13)
86
+ activesupport (= 3.2.13)
87
+ bundler (~> 1.0)
88
+ railties (= 3.2.13)
89
+ railties (3.2.13)
90
+ actionpack (= 3.2.13)
91
+ activesupport (= 3.2.13)
92
+ rack-ssl (~> 1.3.2)
93
+ rake (>= 0.8.7)
94
+ rdoc (~> 3.4)
95
+ thor (>= 0.14.6, < 2.0)
96
+ rake (10.0.4)
97
+ rdoc (3.12.2)
98
+ json (~> 1.4)
99
+ ref (1.0.4)
100
+ rspec (2.13.0)
101
+ rspec-core (~> 2.13.0)
102
+ rspec-expectations (~> 2.13.0)
103
+ rspec-mocks (~> 2.13.0)
104
+ rspec-core (2.13.1)
105
+ rspec-expectations (2.13.0)
106
+ diff-lcs (>= 1.1.3, < 2.0)
107
+ rspec-fire (1.1.3)
108
+ rspec (~> 2.11)
109
+ rspec-mocks (2.13.1)
110
+ rspec-rails (2.13.1)
111
+ actionpack (>= 3.0)
112
+ activesupport (>= 3.0)
113
+ railties (>= 3.0)
114
+ rspec-core (~> 2.13.0)
115
+ rspec-expectations (~> 2.13.0)
116
+ rspec-mocks (~> 2.13.0)
117
+ simplecov (0.7.1)
118
+ multi_json (~> 1.0)
119
+ simplecov-html (~> 0.7.1)
120
+ simplecov-html (0.7.1)
121
+ simplecov-rcov (0.2.3)
122
+ simplecov (>= 0.4.1)
123
+ slop (3.4.4)
124
+ sprockets (2.2.2)
125
+ hike (~> 1.2)
126
+ multi_json (~> 1.0)
127
+ rack (~> 1.0)
128
+ tilt (~> 1.1, != 1.3.0)
129
+ sqlite3 (1.3.7)
130
+ stache (1.0.1)
131
+ therubyracer (0.11.4)
132
+ libv8 (~> 3.11.8.12)
133
+ ref
134
+ thor (0.18.1)
135
+ tilt (1.4.1)
136
+ treetop (1.4.12)
137
+ polyglot
138
+ polyglot (>= 0.3.1)
139
+ tzinfo (0.3.37)
140
+
141
+ PLATFORMS
142
+ ruby
143
+
144
+ DEPENDENCIES
145
+ pry
146
+ rspec
147
+ rspec-fire
148
+ rspec-rails
149
+ simplecov
150
+ simplecov-rcov
151
+ sqlite3
152
+ stachio!
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ Stash your Stache with *Stachio*
2
+ ==============================
3
+ Stachio is a rails engine which aims to facilitate the creation, retrieval, update, & deletion of mustache templates in a relational database.
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env rake
2
+
3
+ ###########
4
+ ## Bundler
5
+
6
+ begin
7
+ require 'bundler/setup'
8
+ rescue LoadError => e
9
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
10
+ raise e
11
+ end
12
+
13
+ ########
14
+ ## rdoc
15
+
16
+ begin
17
+ require 'rdoc/task'
18
+ rescue LoadError
19
+ require 'rdoc/rdoc'
20
+ require 'rake/rdoctask'
21
+ RDoc::Task = Rake::RDocTask
22
+ end
23
+
24
+ RDoc::Task.new(:rdoc) do |rdoc|
25
+ rdoc.rdoc_dir = 'rdoc'
26
+ rdoc.title = 'Stachio'
27
+ rdoc.options << '--line-numbers'
28
+ rdoc.rdoc_files.include('README.rdoc')
29
+ rdoc.rdoc_files.include('lib/**/*.rb')
30
+ end
31
+
32
+ #########
33
+ ## RSpec
34
+
35
+ begin
36
+ require 'rspec/core/rake_task'
37
+ RSpec::Core::RakeTask.new(:spec)
38
+ rescue LoadError => e
39
+ puts "Rspec couldn't be found, try running bundle install"
40
+ raise e
41
+ end
42
+
43
+ ###################
44
+ ## Everything else
45
+
46
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
47
+ load 'rails/tasks/engine.rake'
48
+
49
+ Bundler::GemHelper.install_tasks
50
+ task :default => [:spec]
File without changes
@@ -0,0 +1,15 @@
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
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,13 @@
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
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ module Stachio
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,87 @@
1
+ require_dependency "stachio/application_controller"
2
+
3
+ module Stachio
4
+ class TemplatesController < ApplicationController
5
+ # GET /templates
6
+ # GET /templates.json
7
+ def index
8
+ @templates = Template.all
9
+
10
+ respond_to do |format|
11
+ format.html # index.html.erb
12
+ format.json { render json: @templates }
13
+ end
14
+ end
15
+
16
+ # GET /templates/1
17
+ # GET /templates/1.json
18
+ def show
19
+ @template = Template.find(params[:id])
20
+
21
+ respond_to do |format|
22
+ format.html # show.html.erb
23
+ format.json { render json: @template }
24
+ end
25
+ end
26
+
27
+ # GET /templates/new
28
+ # GET /templates/new.json
29
+ def new
30
+ @template = Template.new
31
+
32
+ respond_to do |format|
33
+ format.html # new.html.erb
34
+ format.json { render json: @template }
35
+ end
36
+ end
37
+
38
+ # GET /templates/1/edit
39
+ def edit
40
+ @template = Template.find(params[:id])
41
+ end
42
+
43
+ # POST /templates
44
+ # POST /templates.json
45
+ def create
46
+ @template = Template.new(params[:template])
47
+
48
+ respond_to do |format|
49
+ if @template.save
50
+ format.html { redirect_to @template, notice: 'Template was successfully created.' }
51
+ format.json { render json: @template, status: :created, location: @template }
52
+ else
53
+ format.html { render action: "new" }
54
+ format.json { render json: @template.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # PUT /templates/1
60
+ # PUT /templates/1.json
61
+ def update
62
+ @template = Template.find(params[:id])
63
+
64
+ respond_to do |format|
65
+ if @template.update_attributes(params[:template])
66
+ format.html { redirect_to @template, notice: 'Template was successfully updated.' }
67
+ format.json { head :no_content }
68
+ else
69
+ format.html { render action: "edit" }
70
+ format.json { render json: @template.errors, status: :unprocessable_entity }
71
+ end
72
+ end
73
+ end
74
+
75
+ # DELETE /templates/1
76
+ # DELETE /templates/1.json
77
+ def destroy
78
+ @template = Template.find(params[:id])
79
+ @template.destroy
80
+
81
+ respond_to do |format|
82
+ format.html { redirect_to templates_url }
83
+ format.json { head :no_content }
84
+ end
85
+ end
86
+ end
87
+ end