model_base_generators 0.1.2 → 0.2.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 (135) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -0
  3. data/Rakefile +13 -1
  4. data/example/.gitignore +2 -0
  5. data/example/.rspec +2 -0
  6. data/example/Gemfile +72 -0
  7. data/example/Gemfile.lock +304 -0
  8. data/example/Rakefile +6 -0
  9. data/example/app/assets/config/manifest.js +5 -0
  10. data/example/app/assets/images/.keep +0 -0
  11. data/example/app/assets/javascripts/application.js +13 -0
  12. data/example/app/assets/javascripts/cable.js +13 -0
  13. data/example/app/assets/javascripts/channels/.keep +0 -0
  14. data/example/app/assets/stylesheets/application.css +15 -0
  15. data/example/app/channels/application_cable/channel.rb +4 -0
  16. data/example/app/channels/application_cable/connection.rb +4 -0
  17. data/example/app/controllers/application_controller.rb +3 -0
  18. data/example/app/controllers/concerns/.keep +0 -0
  19. data/example/app/controllers/concerns/authentication.rb +12 -0
  20. data/{examples → example}/app/controllers/issues_controller.rb +1 -1
  21. data/example/app/controllers/projects_controller.rb +62 -0
  22. data/example/app/helpers/application_helper.rb +2 -0
  23. data/example/app/helpers/issues_helper.rb +2 -0
  24. data/example/app/helpers/projects_helper.rb +2 -0
  25. data/example/app/jobs/application_job.rb +2 -0
  26. data/example/app/mailers/application_mailer.rb +4 -0
  27. data/example/app/models/ability.rb +35 -0
  28. data/example/app/models/application_record.rb +3 -0
  29. data/example/app/models/concerns/.keep +0 -0
  30. data/example/app/models/issue.rb +16 -0
  31. data/example/app/models/project.rb +6 -0
  32. data/example/app/models/user.rb +25 -0
  33. data/example/app/validations/ar_internal_metadatum_validation.rb +8 -0
  34. data/example/app/validations/issue_validation.rb +9 -0
  35. data/example/app/validations/project_validation.rb +8 -0
  36. data/example/app/validations/user_validation.rb +10 -0
  37. data/{examples → example}/app/views/issues/_form.html.erb +8 -1
  38. data/{examples/app/views/issues/index.html.erb → example/app/views/issues/_table.html.erb} +2 -7
  39. data/{examples → example}/app/views/issues/edit.html.erb +0 -0
  40. data/example/app/views/issues/index.html.erb +9 -0
  41. data/{examples → example}/app/views/issues/new.html.erb +0 -0
  42. data/{examples → example}/app/views/issues/show.html.erb +6 -0
  43. data/example/app/views/layouts/application.html.erb +14 -0
  44. data/example/app/views/layouts/mailer.html.erb +13 -0
  45. data/example/app/views/layouts/mailer.text.erb +1 -0
  46. data/{examples → example}/app/views/projects/_form.html.erb +7 -0
  47. data/{examples/app/views/projects/index.html.erb → example/app/views/projects/_table.html.erb} +2 -9
  48. data/{examples → example}/app/views/projects/edit.html.erb +0 -0
  49. data/example/app/views/projects/index.html.erb +9 -0
  50. data/{examples → example}/app/views/projects/new.html.erb +0 -0
  51. data/{examples → example}/app/views/projects/show.html.erb +2 -0
  52. data/example/bin/bundle +3 -0
  53. data/example/bin/rails +4 -0
  54. data/example/bin/rake +4 -0
  55. data/example/bin/setup +34 -0
  56. data/example/bin/update +29 -0
  57. data/example/config/application.rb +20 -0
  58. data/example/config/boot.rb +5 -0
  59. data/example/config/cable.yml +9 -0
  60. data/example/config/database.yml +25 -0
  61. data/example/config/environment.rb +5 -0
  62. data/example/config/environments/development.rb +56 -0
  63. data/example/config/environments/production.rb +86 -0
  64. data/example/config/environments/test.rb +42 -0
  65. data/example/config/initializers/application_controller_renderer.rb +6 -0
  66. data/example/config/initializers/assets.rb +11 -0
  67. data/example/config/initializers/backtrace_silencers.rb +7 -0
  68. data/example/config/initializers/cookies_serializer.rb +5 -0
  69. data/example/config/initializers/devise.rb +274 -0
  70. data/example/config/initializers/filter_parameter_logging.rb +4 -0
  71. data/example/config/initializers/inflections.rb +16 -0
  72. data/example/config/initializers/mime_types.rb +4 -0
  73. data/example/config/initializers/new_framework_defaults.rb +24 -0
  74. data/example/config/initializers/pretty_validation.rb +5 -0
  75. data/example/config/initializers/session_store.rb +3 -0
  76. data/example/config/initializers/wrap_parameters.rb +14 -0
  77. data/example/config/locales/devise.en.yml +62 -0
  78. data/example/config/locales/en.yml +23 -0
  79. data/example/config/puma.rb +47 -0
  80. data/example/config/routes.rb +6 -0
  81. data/example/config/secrets.yml +22 -0
  82. data/example/config/spring.rb +6 -0
  83. data/example/config.ru +5 -0
  84. data/example/db/schema.rb +34 -0
  85. data/example/lib/assets/.keep +0 -0
  86. data/example/log/.keep +0 -0
  87. data/example/public/404.html +67 -0
  88. data/example/public/422.html +67 -0
  89. data/example/public/500.html +66 -0
  90. data/example/public/apple-touch-icon-precomposed.png +0 -0
  91. data/example/public/apple-touch-icon.png +0 -0
  92. data/example/public/favicon.ico +0 -0
  93. data/{examples → example}/spec/controllers/issues_controller_spec.rb +6 -6
  94. data/{examples → example}/spec/controllers/projects_controller_spec.rb +4 -4
  95. data/example/spec/factories/issues.rb +8 -0
  96. data/example/spec/factories/projects.rb +6 -0
  97. data/example/spec/factories/users.rb +8 -0
  98. data/example/spec/rails_helper.rb +57 -0
  99. data/{examples → example}/spec/routing/issues_routing_spec.rb +0 -0
  100. data/{examples → example}/spec/routing/projects_routing_spec.rb +0 -0
  101. data/example/spec/spec_helper.rb +99 -0
  102. data/example/spec/support/controller_macros.rb +18 -0
  103. data/example/spec/support/devise.rb +16 -0
  104. data/{examples → example}/spec/views/issues/edit.html.erb_spec.rb +4 -1
  105. data/example/spec/views/issues/index.html.erb_spec.rb +21 -0
  106. data/{examples → example}/spec/views/issues/new.html.erb_spec.rb +4 -1
  107. data/example/spec/views/issues/show.html.erb_spec.rb +17 -0
  108. data/{examples → example}/spec/views/projects/edit.html.erb_spec.rb +3 -1
  109. data/example/spec/views/projects/index.html.erb_spec.rb +18 -0
  110. data/{examples → example}/spec/views/projects/new.html.erb_spec.rb +3 -1
  111. data/example/spec/views/projects/show.html.erb_spec.rb +14 -0
  112. data/example/tmp/.keep +0 -0
  113. data/lib/model_base/column_attribute.rb +63 -2
  114. data/lib/model_base/config.rb +13 -2
  115. data/lib/model_base/generators/erb/scaffold.rb +23 -0
  116. data/lib/model_base/generators/factory_girl/model.rb +37 -0
  117. data/lib/model_base/meta_model.rb +77 -13
  118. data/lib/model_base/version.rb +1 -1
  119. data/lib/model_base.rb +4 -0
  120. data/lib/templates/controller.rb +1 -1
  121. data/lib/templates/erb/scaffold/_form.html.erb +1 -1
  122. data/lib/templates/erb/scaffold/_table.html.erb +39 -0
  123. data/lib/templates/erb/scaffold/index.html.erb +1 -38
  124. data/lib/templates/erb/scaffold/show.html.erb +3 -1
  125. data/lib/templates/factory_girl/factory.rb +11 -0
  126. data/lib/templates/rspec/scaffold/controller_spec.rb +8 -13
  127. data/lib/templates/rspec/scaffold/edit_spec.rb +3 -3
  128. data/lib/templates/rspec/scaffold/index_spec.rb +13 -3
  129. data/lib/templates/rspec/scaffold/new_spec.rb +3 -2
  130. data/lib/templates/rspec/scaffold/show_spec.rb +4 -4
  131. metadata +115 -25
  132. data/examples/spec/views/issues/index.html.erb_spec.rb +0 -17
  133. data/examples/spec/views/issues/show.html.erb_spec.rb +0 -14
  134. data/examples/spec/views/projects/index.html.erb_spec.rb +0 -15
  135. data/examples/spec/views/projects/show.html.erb_spec.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb84b8f69e4c5c2e1a2250905a19c610f8e192d3
4
- data.tar.gz: 11d43d65609f8e5e52dc9806dda0a32539fad7de
3
+ metadata.gz: c53033fec333226f20bbcf75ae02b4da95a1b5b2
4
+ data.tar.gz: 81090f4cfcd9fe923bcaa6249f75c4787bff9959
5
5
  SHA512:
6
- metadata.gz: 7eda2a0b8df381f193a27e02d75882acca1b68f7653319af3affa4e3649aa12133dcb51b23f415874cce131a345bfb40ad77674523dbda3e0205c8e4ea7c3d6c
7
- data.tar.gz: cb4eb57b0bc73b04125ba9aecf0debc5ac0156983f8004637608c0ab0e0f5c5d6bb2992069070fd67b3031d1bf3ace9ba83bca3fc54dafc142ecaee9f2f67518
6
+ metadata.gz: 7db5951847a6ad2d167b669409ca2fa749f4da4858442af7b89398fb9eb5faae6c34bf4ae4aaaa667f020d855995d74da05c5ecb9abea8fa4d2b60043504c2b3
7
+ data.tar.gz: 6f5410fa88de13cc0081cd40807bf96bded9105ae87f02812ce3d33ca75b15d851bcdba57284c5e13ce29f35ccf60129e9e432e892bdf4690183d57ccc1b3b02
data/Gemfile CHANGED
@@ -7,4 +7,10 @@ group :test do
7
7
  gem 'enumerize'
8
8
  gem 'simplecov'
9
9
  gem 'sqlite3'
10
+ gem 'devise'
11
+ gem 'pretty_validation', git: 'https://github.com/akm/pretty_validation.git'
12
+ gem 'factory_girl_rails'
13
+ # gem 'cancancan'
14
+ # gem 'kaminari'
15
+ # gem 'twitter-bootstrap-rails'
10
16
  end
data/Rakefile CHANGED
@@ -3,4 +3,16 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ namespace :example do
7
+ desc "Run spec in example"
8
+ task :spec do
9
+ Bundler.with_clean_env do
10
+ cmd = 'cd example && bundle && bundle exec rake spec'
11
+ unless system(cmd)
12
+ raise "Failure: #{cmd}"
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ task :default => [:spec, :'example:spec']
@@ -0,0 +1,2 @@
1
+ /db/*.sqlite3
2
+ /log/*.log
data/example/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/example/Gemfile ADDED
@@ -0,0 +1,72 @@
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
+ gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
6
+ # Use sqlite3 as the database for Active Record
7
+ gem 'sqlite3'
8
+ # Use Puma as the app server
9
+ gem 'puma', '~> 3.0'
10
+ # Use SCSS for stylesheets
11
+ gem 'sass-rails', '~> 5.0'
12
+ # Use Uglifier as compressor for JavaScript assets
13
+ gem 'uglifier', '>= 1.3.0'
14
+ # Use CoffeeScript for .coffee assets and views
15
+ gem 'coffee-rails', '~> 4.2'
16
+ # See https://github.com/rails/execjs#readme for more supported runtimes
17
+ # gem 'therubyracer', platforms: :ruby
18
+
19
+ # Use jquery as the JavaScript library
20
+ gem 'jquery-rails'
21
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
22
+ gem 'turbolinks', '~> 5'
23
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
24
+ gem 'jbuilder', '~> 2.5'
25
+ # Use Redis adapter to run Action Cable in production
26
+ # gem 'redis', '~> 3.0'
27
+ # Use ActiveModel has_secure_password
28
+ # gem 'bcrypt', '~> 3.1.7'
29
+
30
+ # Use Capistrano for deployment
31
+ # gem 'capistrano-rails', group: :development
32
+
33
+ group :development, :test do
34
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
35
+ gem 'byebug', platform: :mri
36
+ end
37
+
38
+ group :development do
39
+ # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
40
+ gem 'web-console'
41
+ gem 'listen', '~> 3.0.5'
42
+ end
43
+
44
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
45
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
46
+
47
+ gem 'twitter-bootstrap-rails'
48
+ gem 'devise'
49
+ gem 'cancancan'
50
+ gem 'enumerize'
51
+ gem 'kaminari'
52
+ gem 'pretty_validation', git: 'https://github.com/akm/pretty_validation.git'
53
+
54
+ group :development, :test do
55
+ gem 'rspec'
56
+ gem 'rspec-rails'
57
+ gem 'simplecov', require: false
58
+ gem 'simplecov-rcov', require: false
59
+ gem 'pry-rails'
60
+ gem 'pry-byebug'
61
+ gem 'pry-stack_explorer'
62
+ gem 'fuubar'
63
+ gem 'factory_girl'
64
+ gem 'factory_girl_rails'
65
+ gem 'annotate'
66
+ gem 'rails_best_practices'
67
+ gem 'bullet'
68
+ end
69
+
70
+ group :test do
71
+ gem 'rails-controller-testing'
72
+ end
@@ -0,0 +1,304 @@
1
+ GIT
2
+ remote: https://github.com/akm/pretty_validation.git
3
+ revision: f279345cfbca76ed6f606f0a9c80db129980c833
4
+ specs:
5
+ pretty_validation (0.3.0)
6
+ rails (>= 4.0.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (5.0.0.1)
12
+ actionpack (= 5.0.0.1)
13
+ nio4r (~> 1.2)
14
+ websocket-driver (~> 0.6.1)
15
+ actionmailer (5.0.0.1)
16
+ actionpack (= 5.0.0.1)
17
+ actionview (= 5.0.0.1)
18
+ activejob (= 5.0.0.1)
19
+ mail (~> 2.5, >= 2.5.4)
20
+ rails-dom-testing (~> 2.0)
21
+ actionpack (5.0.0.1)
22
+ actionview (= 5.0.0.1)
23
+ activesupport (= 5.0.0.1)
24
+ rack (~> 2.0)
25
+ rack-test (~> 0.6.3)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ actionview (5.0.0.1)
29
+ activesupport (= 5.0.0.1)
30
+ builder (~> 3.1)
31
+ erubis (~> 2.7.0)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
34
+ activejob (5.0.0.1)
35
+ activesupport (= 5.0.0.1)
36
+ globalid (>= 0.3.6)
37
+ activemodel (5.0.0.1)
38
+ activesupport (= 5.0.0.1)
39
+ activerecord (5.0.0.1)
40
+ activemodel (= 5.0.0.1)
41
+ activesupport (= 5.0.0.1)
42
+ arel (~> 7.0)
43
+ activesupport (5.0.0.1)
44
+ concurrent-ruby (~> 1.0, >= 1.0.2)
45
+ i18n (~> 0.7)
46
+ minitest (~> 5.1)
47
+ tzinfo (~> 1.1)
48
+ annotate (2.7.1)
49
+ activerecord (>= 3.2, < 6.0)
50
+ rake (>= 10.4, < 12.0)
51
+ arel (7.1.4)
52
+ bcrypt (3.1.11)
53
+ binding_of_caller (0.7.2)
54
+ debug_inspector (>= 0.0.1)
55
+ builder (3.2.2)
56
+ bullet (5.4.2)
57
+ activesupport (>= 3.0.0)
58
+ uniform_notifier (~> 1.10.0)
59
+ byebug (9.0.6)
60
+ cancancan (1.15.0)
61
+ code_analyzer (0.4.7)
62
+ sexp_processor
63
+ coderay (1.1.1)
64
+ coffee-rails (4.2.1)
65
+ coffee-script (>= 2.2.0)
66
+ railties (>= 4.0.0, < 5.2.x)
67
+ coffee-script (2.4.1)
68
+ coffee-script-source
69
+ execjs
70
+ coffee-script-source (1.10.0)
71
+ commonjs (0.2.7)
72
+ concurrent-ruby (1.0.2)
73
+ debug_inspector (0.0.2)
74
+ devise (4.2.0)
75
+ bcrypt (~> 3.0)
76
+ orm_adapter (~> 0.1)
77
+ railties (>= 4.1.0, < 5.1)
78
+ responders
79
+ warden (~> 1.2.3)
80
+ diff-lcs (1.2.5)
81
+ docile (1.1.5)
82
+ enumerize (2.0.1)
83
+ activesupport (>= 3.2)
84
+ erubis (2.7.0)
85
+ execjs (2.7.0)
86
+ factory_girl (4.7.0)
87
+ activesupport (>= 3.0.0)
88
+ factory_girl_rails (4.7.0)
89
+ factory_girl (~> 4.7.0)
90
+ railties (>= 3.0.0)
91
+ ffi (1.9.14)
92
+ fuubar (2.2.0)
93
+ rspec-core (~> 3.0)
94
+ ruby-progressbar (~> 1.4)
95
+ globalid (0.3.7)
96
+ activesupport (>= 4.1.0)
97
+ i18n (0.7.0)
98
+ jbuilder (2.6.0)
99
+ activesupport (>= 3.0.0, < 5.1)
100
+ multi_json (~> 1.2)
101
+ jquery-rails (4.2.1)
102
+ rails-dom-testing (>= 1, < 3)
103
+ railties (>= 4.2.0)
104
+ thor (>= 0.14, < 2.0)
105
+ json (2.0.2)
106
+ kaminari (0.17.0)
107
+ actionpack (>= 3.0.0)
108
+ activesupport (>= 3.0.0)
109
+ less (2.6.0)
110
+ commonjs (~> 0.2.7)
111
+ less-rails (2.8.0)
112
+ actionpack (>= 4.0)
113
+ less (~> 2.6.0)
114
+ sprockets (> 2, < 4)
115
+ tilt
116
+ listen (3.0.8)
117
+ rb-fsevent (~> 0.9, >= 0.9.4)
118
+ rb-inotify (~> 0.9, >= 0.9.7)
119
+ loofah (2.0.3)
120
+ nokogiri (>= 1.5.9)
121
+ mail (2.6.4)
122
+ mime-types (>= 1.16, < 4)
123
+ method_source (0.8.2)
124
+ mime-types (3.1)
125
+ mime-types-data (~> 3.2015)
126
+ mime-types-data (3.2016.0521)
127
+ mini_portile2 (2.1.0)
128
+ minitest (5.9.1)
129
+ multi_json (1.12.1)
130
+ nio4r (1.2.1)
131
+ nokogiri (1.6.8.1)
132
+ mini_portile2 (~> 2.1.0)
133
+ orm_adapter (0.5.0)
134
+ pry (0.10.4)
135
+ coderay (~> 1.1.0)
136
+ method_source (~> 0.8.1)
137
+ slop (~> 3.4)
138
+ pry-byebug (3.4.0)
139
+ byebug (~> 9.0)
140
+ pry (~> 0.10)
141
+ pry-rails (0.3.4)
142
+ pry (>= 0.9.10)
143
+ pry-stack_explorer (0.4.9.2)
144
+ binding_of_caller (>= 0.7)
145
+ pry (>= 0.9.11)
146
+ puma (3.6.0)
147
+ rack (2.0.1)
148
+ rack-test (0.6.3)
149
+ rack (>= 1.0)
150
+ rails (5.0.0.1)
151
+ actioncable (= 5.0.0.1)
152
+ actionmailer (= 5.0.0.1)
153
+ actionpack (= 5.0.0.1)
154
+ actionview (= 5.0.0.1)
155
+ activejob (= 5.0.0.1)
156
+ activemodel (= 5.0.0.1)
157
+ activerecord (= 5.0.0.1)
158
+ activesupport (= 5.0.0.1)
159
+ bundler (>= 1.3.0, < 2.0)
160
+ railties (= 5.0.0.1)
161
+ sprockets-rails (>= 2.0.0)
162
+ rails-controller-testing (1.0.1)
163
+ actionpack (~> 5.x)
164
+ actionview (~> 5.x)
165
+ activesupport (~> 5.x)
166
+ rails-dom-testing (2.0.1)
167
+ activesupport (>= 4.2.0, < 6.0)
168
+ nokogiri (~> 1.6.0)
169
+ rails-html-sanitizer (1.0.3)
170
+ loofah (~> 2.0)
171
+ rails_best_practices (1.17.0)
172
+ activesupport
173
+ code_analyzer (>= 0.4.3)
174
+ erubis
175
+ i18n
176
+ json
177
+ require_all
178
+ ruby-progressbar
179
+ railties (5.0.0.1)
180
+ actionpack (= 5.0.0.1)
181
+ activesupport (= 5.0.0.1)
182
+ method_source
183
+ rake (>= 0.8.7)
184
+ thor (>= 0.18.1, < 2.0)
185
+ rake (11.3.0)
186
+ rb-fsevent (0.9.7)
187
+ rb-inotify (0.9.7)
188
+ ffi (>= 0.5.0)
189
+ require_all (1.3.3)
190
+ responders (2.3.0)
191
+ railties (>= 4.2.0, < 5.1)
192
+ rspec (3.5.0)
193
+ rspec-core (~> 3.5.0)
194
+ rspec-expectations (~> 3.5.0)
195
+ rspec-mocks (~> 3.5.0)
196
+ rspec-core (3.5.4)
197
+ rspec-support (~> 3.5.0)
198
+ rspec-expectations (3.5.0)
199
+ diff-lcs (>= 1.2.0, < 2.0)
200
+ rspec-support (~> 3.5.0)
201
+ rspec-mocks (3.5.0)
202
+ diff-lcs (>= 1.2.0, < 2.0)
203
+ rspec-support (~> 3.5.0)
204
+ rspec-rails (3.5.2)
205
+ actionpack (>= 3.0)
206
+ activesupport (>= 3.0)
207
+ railties (>= 3.0)
208
+ rspec-core (~> 3.5.0)
209
+ rspec-expectations (~> 3.5.0)
210
+ rspec-mocks (~> 3.5.0)
211
+ rspec-support (~> 3.5.0)
212
+ rspec-support (3.5.0)
213
+ ruby-progressbar (1.8.1)
214
+ sass (3.4.22)
215
+ sass-rails (5.0.6)
216
+ railties (>= 4.0.0, < 6)
217
+ sass (~> 3.1)
218
+ sprockets (>= 2.8, < 4.0)
219
+ sprockets-rails (>= 2.0, < 4.0)
220
+ tilt (>= 1.1, < 3)
221
+ sexp_processor (4.7.0)
222
+ simplecov (0.12.0)
223
+ docile (~> 1.1.0)
224
+ json (>= 1.8, < 3)
225
+ simplecov-html (~> 0.10.0)
226
+ simplecov-html (0.10.0)
227
+ simplecov-rcov (0.2.3)
228
+ simplecov (>= 0.4.1)
229
+ slop (3.6.0)
230
+ sprockets (3.7.0)
231
+ concurrent-ruby (~> 1.0)
232
+ rack (> 1, < 3)
233
+ sprockets-rails (3.2.0)
234
+ actionpack (>= 4.0)
235
+ activesupport (>= 4.0)
236
+ sprockets (>= 3.0.0)
237
+ sqlite3 (1.3.12)
238
+ thor (0.19.1)
239
+ thread_safe (0.3.5)
240
+ tilt (2.0.5)
241
+ turbolinks (5.0.1)
242
+ turbolinks-source (~> 5)
243
+ turbolinks-source (5.0.0)
244
+ twitter-bootstrap-rails (3.2.2)
245
+ actionpack (>= 3.1)
246
+ execjs (>= 2.2.2, >= 2.2)
247
+ less-rails (>= 2.5.0)
248
+ railties (>= 3.1)
249
+ tzinfo (1.2.2)
250
+ thread_safe (~> 0.1)
251
+ uglifier (3.0.2)
252
+ execjs (>= 0.3.0, < 3)
253
+ uniform_notifier (1.10.0)
254
+ warden (1.2.6)
255
+ rack (>= 1.0)
256
+ web-console (3.3.1)
257
+ actionview (>= 5.0)
258
+ activemodel (>= 5.0)
259
+ debug_inspector
260
+ railties (>= 5.0)
261
+ websocket-driver (0.6.4)
262
+ websocket-extensions (>= 0.1.0)
263
+ websocket-extensions (0.1.2)
264
+
265
+ PLATFORMS
266
+ ruby
267
+
268
+ DEPENDENCIES
269
+ annotate
270
+ bullet
271
+ byebug
272
+ cancancan
273
+ coffee-rails (~> 4.2)
274
+ devise
275
+ enumerize
276
+ factory_girl
277
+ factory_girl_rails
278
+ fuubar
279
+ jbuilder (~> 2.5)
280
+ jquery-rails
281
+ kaminari
282
+ listen (~> 3.0.5)
283
+ pretty_validation!
284
+ pry-byebug
285
+ pry-rails
286
+ pry-stack_explorer
287
+ puma (~> 3.0)
288
+ rails (~> 5.0.0, >= 5.0.0.1)
289
+ rails-controller-testing
290
+ rails_best_practices
291
+ rspec
292
+ rspec-rails
293
+ sass-rails (~> 5.0)
294
+ simplecov
295
+ simplecov-rcov
296
+ sqlite3
297
+ turbolinks (~> 5)
298
+ twitter-bootstrap-rails
299
+ tzinfo-data
300
+ uglifier (>= 1.3.0)
301
+ web-console
302
+
303
+ BUNDLED WITH
304
+ 1.13.2
data/example/Rakefile ADDED
@@ -0,0 +1,6 @@
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_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,5 @@
1
+
2
+ //= link_tree ../images
3
+ //= link_directory ../javascripts .js
4
+ //= link_directory ../stylesheets .css
5
+ //= link plugin1_manifest.js
File without changes
@@ -0,0 +1,13 @@
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 any plugin's vendor/assets/javascripts directory 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. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the rails generate channel command.
3
+ //
4
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
File without changes
@@ -0,0 +1,15 @@
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
3
+ end
File without changes
@@ -0,0 +1,12 @@
1
+ module Authentication
2
+ def self.included(klass)
3
+ klass.class_eval do
4
+ before_action :authenticate_user!
5
+ around_action :set_current_user
6
+ end
7
+ end
8
+
9
+ def set_current_user(&block)
10
+ User.current(current_user, &block)
11
+ end
12
+ end
@@ -57,6 +57,6 @@ class IssuesController < ApplicationController
57
57
 
58
58
  # Only allow a trusted parameter "white list" through.
59
59
  def issue_params
60
- params.require(:issue).permit(:project_id, :title, :status)
60
+ params.require(:issue).permit(:project_id, :title, :status, :creator_id)
61
61
  end
62
62
  end
@@ -0,0 +1,62 @@
1
+ class ProjectsController < ApplicationController
2
+ include Authentication
3
+ load_and_authorize_resource except: [:index]
4
+
5
+ before_action :set_project, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /projects
8
+ def index
9
+ @projects = Project.all
10
+ end
11
+
12
+ # GET /projects/1
13
+ def show
14
+ end
15
+
16
+ # GET /projects/new
17
+ def new
18
+ @project = Project.new
19
+ end
20
+
21
+ # GET /projects/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /projects
26
+ def create
27
+ @project = Project.new(project_params)
28
+
29
+ if @project.save
30
+ redirect_to @project, notice: 'Project was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /projects/1
37
+ def update
38
+ if @project.update(project_params)
39
+ redirect_to @project, notice: 'Project was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /projects/1
46
+ def destroy
47
+ @project.destroy
48
+ redirect_to projects_url, notice: 'Project was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+
53
+ # Use callbacks to share common setup or constraints between actions.
54
+ def set_project
55
+ @project = Project.find(params[:id])
56
+ end
57
+
58
+ # Only allow a trusted parameter "white list" through.
59
+ def project_params
60
+ params.require(:project).permit(:owner_id, :name)
61
+ end
62
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module IssuesHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module ProjectsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,35 @@
1
+ class Ability
2
+ include CanCan::Ability
3
+
4
+ def initialize(user)
5
+ # Define abilities for the passed in user here. For example:
6
+ #
7
+ # user ||= User.new # guest user (not logged in)
8
+ # if user.admin?
9
+ # can :manage, :all
10
+ # else
11
+ # can :read, :all
12
+ # end
13
+ #
14
+ # The first argument to `can` is the action you are giving the user
15
+ # permission to do.
16
+ # If you pass :manage it will apply to every action. Other common actions
17
+ # here are :read, :create, :update and :destroy.
18
+ #
19
+ # The second argument is the resource the user can perform the action on.
20
+ # If you pass :all it will apply to every resource. Otherwise pass a Ruby
21
+ # class of the resource.
22
+ #
23
+ # The third argument is an optional hash of conditions to further filter the
24
+ # objects.
25
+ # For example, here the user can only update published articles.
26
+ #
27
+ # can :update, Article, :published => true
28
+ #
29
+ # See the wiki for details:
30
+ # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities
31
+
32
+ can :manage, :all
33
+
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
File without changes
@@ -0,0 +1,16 @@
1
+ class Issue < ApplicationRecord
2
+ extend Enumerize
3
+
4
+ belongs_to :project
5
+ belongs_to :creator, class_name: 'User'
6
+
7
+ validates :title, presence: true
8
+
9
+ STATUS_MAP = {
10
+ draft: 0,
11
+ opened: 1,
12
+ closed: 2,
13
+ }.freeze
14
+ enumerize :status, in: STATUS_MAP
15
+
16
+ end