lurker 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.hound.yml +62 -0
  5. data/.rubocop.yml +62 -0
  6. data/Gemfile +1 -1
  7. data/Rakefile +2 -268
  8. data/features/atom_persistent_within_the_same_type.feature +0 -2
  9. data/features/controller_nested_schema_scaffolding.feature +0 -1
  10. data/features/controller_schema_scaffolding.feature +0 -1
  11. data/features/html_generation.feature +0 -1
  12. data/features/minitest.feature +0 -2
  13. data/features/multidomain_support.feature +0 -1
  14. data/features/multitype_request_support.feature +0 -2
  15. data/features/partials.feature +0 -1
  16. data/features/request_nested_schema_scaffolding.feature +0 -1
  17. data/features/request_schema_scaffolding.feature +0 -1
  18. data/features/schema_suffixes.feature +0 -1
  19. data/features/schema_updating_within_test_suite.feature +37 -2
  20. data/features/test_endpoint.feature +0 -1
  21. data/lib/lurker.rb +5 -1
  22. data/lib/lurker/endpoint.rb +121 -176
  23. data/lib/lurker/endpoint/http_parameters.rb +77 -0
  24. data/lib/lurker/endpoint/response_codes.rb +42 -0
  25. data/lib/lurker/erb_schema_context.rb +8 -6
  26. data/lib/lurker/jaml_descriptor.rb +8 -1
  27. data/lib/lurker/json_schema_hash.rb +48 -0
  28. data/lib/lurker/presenters/base_presenter.rb +1 -2
  29. data/lib/lurker/presenters/endpoint_presenter.rb +17 -10
  30. data/lib/lurker/presenters/json_presenter.rb +6 -6
  31. data/lib/lurker/presenters/schema_presenter.rb +15 -14
  32. data/lib/lurker/presenters/service_presenter.rb +5 -6
  33. data/lib/lurker/rendering_controller.rb +0 -1
  34. data/lib/lurker/request.rb +3 -1
  35. data/lib/lurker/sandbox.rb +0 -1
  36. data/lib/lurker/schema_modifier.rb +4 -2
  37. data/lib/lurker/schema_modifier/atom.rb +14 -5
  38. data/lib/lurker/server.rb +4 -5
  39. data/lib/lurker/service.rb +3 -4
  40. data/lib/lurker/spec_helper/rspec.rb +15 -57
  41. data/lib/lurker/spy.rb +9 -5
  42. data/lib/lurker/templates/layouts/_sidemenu.html.erb +1 -1
  43. data/lib/lurker/templates/lurker/rendering/show.html.erb +5 -1
  44. data/lib/lurker/templates/public/application.css +2 -2
  45. data/lib/lurker/templates/stylesheets/docs.css +0 -1
  46. data/lib/lurker/utils.rb +18 -0
  47. data/lib/lurker/validator.rb +3 -6
  48. data/lib/lurker/version.rb +1 -1
  49. data/tasks/build.rake +57 -0
  50. data/tasks/deploy.rake +139 -0
  51. data/tasks/generate.rake +78 -0
  52. data/templates/generate_stuff.rb +4 -4
  53. data/templates/lurker_app.rb +1 -1
  54. metadata +9 -2
  55. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a914bcb615ccfdd4b68d8596ddf908d406003045
4
- data.tar.gz: 0914a12a0879b48ee724accf0e574ee52c4de24c
3
+ metadata.gz: 434f91796b5945b641bb46e3c89a336a3e7e0393
4
+ data.tar.gz: b1fbb76bebd71b403470dd80dc31f350a53b364d
5
5
  SHA512:
6
- metadata.gz: 0a2e411348e7c483a2d9984dabd476a6136bfcad6c9cef8b42afa7288149f447505e86d0fe77fbb578f70bd414a65057c6a8a1f1b5cd23871393d70b88cd8a06
7
- data.tar.gz: 81e866b271eb19fd2550865e4b6998c20f3717237060ca24b55343b90adc4e65e1e1ea445cad32dd32b20e020fd1b4b1b5cc4a1c4806c52d7846aef88f5b110d
6
+ metadata.gz: c23242ced7fa8084458d50cc4b8f405c0fa72f5111ff26a7c695a4901d301515199cdebf086fb3a30acf4f32e4f03ae540ec31192fb5f62bcead79e57249d8cb
7
+ data.tar.gz: ae52d6101d2093832c6b8c1fa44391218589460e0deb98bc9526c900bcf4796660c35f1838c1da51ce70bfd708117841234f1934a457d9cef79293ce804baa4b
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.hound.yml CHANGED
@@ -1,3 +1,8 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'tmp/**/*'
4
+ - 'templates/rails32_http_patch_support.rb'
5
+
1
6
  StringLiterals:
2
7
  Enabled: false
3
8
 
@@ -13,3 +18,60 @@ MultilineTernaryOperator:
13
18
  LineLength:
14
19
  Enabled: false
15
20
 
21
+ RedundantSelf:
22
+ Enabled: false
23
+
24
+ GuardClause:
25
+ Enabled: false
26
+
27
+ Next:
28
+ Enabled: false
29
+
30
+ SpaceAroundEqualsInParameterDefault:
31
+ Enabled: false
32
+
33
+ AssignmentInCondition:
34
+ Enabled: false
35
+
36
+ Documentation:
37
+ Enabled: false
38
+
39
+ HashSyntax:
40
+ Enabled: false
41
+
42
+ PercentLiteralDelimiters:
43
+ Enabled: false
44
+
45
+ UnneededPercentQ:
46
+ Enabled: false
47
+
48
+ Blocks:
49
+ Enabled: false
50
+
51
+ DoubleNegation:
52
+ Enabled: false
53
+
54
+ CaseEquality:
55
+ Enabled: false
56
+
57
+ SpecialGlobalVars:
58
+ Enabled: false
59
+
60
+ UnusedMethodArgument:
61
+ Enabled: false
62
+
63
+ UnusedBlockArgument:
64
+ Enabled: false
65
+
66
+ CollectionMethods:
67
+ Enabled: false
68
+
69
+ TrivialAccessors:
70
+ Enabled: false
71
+
72
+ IndentationWidth:
73
+ Enabled: false
74
+
75
+ IndentHash:
76
+ Enabled: false
77
+
@@ -1,3 +1,8 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'tmp/**/*'
4
+ - 'templates/rails32_http_patch_support.rb'
5
+
1
6
  StringLiterals:
2
7
  Enabled: false
3
8
 
@@ -13,3 +18,60 @@ MultilineTernaryOperator:
13
18
  LineLength:
14
19
  Enabled: false
15
20
 
21
+ RedundantSelf:
22
+ Enabled: false
23
+
24
+ GuardClause:
25
+ Enabled: false
26
+
27
+ Next:
28
+ Enabled: false
29
+
30
+ SpaceAroundEqualsInParameterDefault:
31
+ Enabled: false
32
+
33
+ AssignmentInCondition:
34
+ Enabled: false
35
+
36
+ Documentation:
37
+ Enabled: false
38
+
39
+ HashSyntax:
40
+ Enabled: false
41
+
42
+ PercentLiteralDelimiters:
43
+ Enabled: false
44
+
45
+ UnneededPercentQ:
46
+ Enabled: false
47
+
48
+ Blocks:
49
+ Enabled: false
50
+
51
+ DoubleNegation:
52
+ Enabled: false
53
+
54
+ CaseEquality:
55
+ Enabled: false
56
+
57
+ SpecialGlobalVars:
58
+ Enabled: false
59
+
60
+ UnusedMethodArgument:
61
+ Enabled: false
62
+
63
+ UnusedBlockArgument:
64
+ Enabled: false
65
+
66
+ CollectionMethods:
67
+ Enabled: false
68
+
69
+ TrivialAccessors:
70
+ Enabled: false
71
+
72
+ IndentationWidth:
73
+ Enabled: false
74
+
75
+ IndentHash:
76
+ Enabled: false
77
+
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ gemspec
4
4
  # Add any gems and groups that you don't want to keep local
5
5
  group :development do
6
6
  # tools
7
- gem 'pry-debugger'
7
+ gem 'pry-byebug'
8
8
  gem 'pry-stack_explorer'
9
9
  # rspec --format fuubar
10
10
  gem 'fuubar'
data/Rakefile CHANGED
@@ -4,6 +4,8 @@ require 'rspec/core/rake_task'
4
4
  require 'cucumber/rake/task'
5
5
  require 'coveralls/rake/task'
6
6
 
7
+ Dir["#{File.expand_path('..', __FILE__)}/tasks/**/*.rake"].each { |f| load f }
8
+
7
9
  desc 'pry console for gem'
8
10
  task :c do
9
11
  require 'pry'
@@ -13,65 +15,6 @@ task :c do
13
15
  Pry.start
14
16
  end
15
17
 
16
- namespace :assets do
17
- desc 'compiles static css & js for web'
18
- task :precompile do
19
- require 'pathname'
20
- require 'logger'
21
- require 'fileutils'
22
-
23
- require 'lurker/cli'
24
-
25
- require_with_help 'sprockets'
26
- require_with_help 'sass'
27
-
28
- ROOT = Pathname(File.dirname(__FILE__))
29
- LOGGER = Logger.new(STDOUT)
30
- BUNDLES = %w( application.css application.js )
31
- BUILD_DIR = Pathname.new Lurker::Cli.precompiled_static_root
32
- SOURCE_DIR = Pathname.new Lurker::Cli.source_root
33
-
34
- FileUtils.rm_rf(BUILD_DIR)
35
- FileUtils.mkdir_p(BUILD_DIR)
36
-
37
- # raw copy
38
- %w[fonts bootstrap.css.map].each do |subdir|
39
- FileUtils.cp_r(SOURCE_DIR.join(subdir), BUILD_DIR)
40
- end
41
-
42
- sprockets = Sprockets::Environment.new(ROOT) do |env|
43
- env.logger = LOGGER
44
- end
45
-
46
- sprockets.context_class.class_eval do
47
- def asset_path(path, options = {})
48
- '/'
49
- end
50
- end
51
-
52
- sprockets.append_path(SOURCE_DIR.join('javascripts').to_s)
53
- sprockets.append_path(SOURCE_DIR.join('stylesheets').to_s)
54
-
55
- %w[jquery-rails bootstrap-sass remotipart].each do |gem|
56
- gem_path = Pathname.new(Bundler.rubygems.find_name(gem).first.full_gem_path)
57
- %w[javascripts stylesheets].each do |prefix|
58
- sprockets.append_path(gem_path.join('vendor', 'assets', prefix).to_s)
59
- end
60
- end
61
-
62
- sprockets.js_compressor = :uglify
63
- sprockets.css_compressor = :scss
64
-
65
- BUNDLES.each do |bundle|
66
- assets = sprockets.find_asset(bundle)
67
- realname = (assets.pathname.basename.to_s.split(".").take_while { |s| !s.match /^(js|css)$/ } + [$~.to_s]).join(".")
68
- assets.write_to(BUILD_DIR.join(realname))
69
- end
70
- end
71
- end
72
-
73
- # testing
74
-
75
18
  ENV['COVERALLS_NOISY'] = '1'
76
19
  Coveralls::RakeTask.new
77
20
 
@@ -83,216 +26,8 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
83
26
  t.cucumber_opts = "features --format progress --tags ~@wip"
84
27
  end
85
28
 
86
- EXAMPLE_APP = 'tmp/lurker_app'
87
- GH_PAGES = 'gh-pages'
88
- EXAMPLE_PATH = File.expand_path("../#{EXAMPLE_APP}", __FILE__)
89
-
90
- namespace :clobber do
91
- desc "clobber coverage"
92
- task :coverage do
93
- rm_rf File.expand_path('../coverage', __FILE__)
94
- end
95
-
96
- desc "clobber the generated app"
97
- task :app do
98
- FileUtils.mkdir_p EXAMPLE_PATH
99
- in_lurker_app "bin/spring stop" rescue nil
100
- Dir.chdir EXAMPLE_PATH do
101
- Dir.glob("*", File::FNM_DOTMATCH).each do |fname|
102
- next if fname == '.' || fname == '..' || fname == '.git' || fname == '.bundle'
103
- FileUtils.rm_rf fname
104
- end
105
- end
106
- end
107
- end
108
-
109
- namespace :generate do
110
- desc "generate a fresh app with rspec installed"
111
- task :app do |t|
112
- if needs_generation?
113
- sh "bundle exec rails new #{EXAMPLE_APP} -d postgresql -m #{File.expand_path '../templates/lurker_app.rb', __FILE__} --skip-javascript --skip-git --skip-test-unit --skip-keeps --skip-bundle --quiet"
114
- in_lurker_app "bundle config --local local.lurker $PWD/../.." unless ENV['TRAVIS']
115
- in_lurker_app "bundle install"
116
- %w[rake rspec-core spring].each do |gem|
117
- in_lurker_app "bundle binstubs #{gem}"
118
- end
119
- end
120
- end
121
-
122
- desc "generate a bunch of stuff with generators"
123
- task :stuff do
124
- in_lurker_app "LOCATION='../../templates/generate_stuff.rb' bin/rake rails:template --quiet --silent"
125
-
126
- unless ENV['TRAVIS']
127
- in_lurker_app 'bin/rake db:setup'
128
- in_lurker_app 'bin/rake db:import'
129
- end
130
- in_lurker_app 'bin/rake RAILS_ENV=test db:setup'
131
- end
132
- end
133
-
134
- def in_lurker_app(command)
135
- Dir.chdir(EXAMPLE_PATH) do
136
- Bundler.with_clean_env do
137
- sh command
138
- end
139
- end
140
- end
141
-
142
- def in_gh_pages(command)
143
- Dir.chdir(GH_PAGES) do
144
- Bundler.with_clean_env do
145
- sh command
146
- end
147
- end
148
- end
149
-
150
- def on_razum2um_me(command)
151
- puts "About to run: #{command}"
152
- system %Q{ssh lurker@razum2um.me 'bash -l -c "source ~/.bashrc; cd ~/lurker; rvm use 2.1.1; #{command}"'}
153
- end
154
-
155
- def needs_generation?
156
- !File.exists?("#{EXAMPLE_PATH}/Gemfile")
157
- end
158
-
159
- def require_with_help(name)
160
- begin
161
- require name
162
- rescue LoadError
163
- puts "Incorrect Gemfile, run: `bundle --gemfile Gemfile.local` and"
164
- puts "BUNDLE_GEMFILE=$PWD/Gemfile.local #{$0}"
165
- raise
166
- end
167
- end
168
-
169
- desc 'destroys & recreates new test app'
170
- task :regenerate => ["clobber:coverage", "clobber:app", "generate:app", "generate:stuff"]
171
-
172
- desc 'run cucumber in a fresh env'
173
- task :features => [:regenerate, :cucumber]
174
-
175
- desc 'convert docs for example app, prepages gh-pages'
176
- task :build_example_docs => :features do
177
- if File.exists?(readme = File.expand_path('../README.md', __FILE__))
178
- in_lurker_app "bin/lurker convert -c #{readme}"
179
- else
180
- in_lurker_app "bin/lurker convert"
181
- end
182
-
183
- in_lurker_app "bin/lurker convert -f pdf -o html"
184
-
185
- if File.exists?(pages = File.expand_path('../gh-pages', __FILE__))
186
- in_lurker_app "cp -R html/* #{pages}"
187
- end
188
- end
189
-
190
- def ask_for_deploy(name, callback)
191
- if ENV['FORCE_DEPLOY']
192
- puts "Deploy to #{name}"
193
- callback.call
194
- else
195
- require_with_help 'highline/import'
196
- choose do |menu|
197
- menu.prompt = "Commit & push & deploy to #{name}?"
198
- menu.choice(:yes) {
199
- ENV['FORCE_DEPLOY'] = '1'
200
- callback.call
201
- }
202
- menu.choice(:no) { say("Exit") }
203
- end
204
- end
205
- end
206
-
207
- namespace :heroku do
208
- desc 'pushes example lurker_app to heroku'
209
- task :push => :predeploy do
210
- do_deploy = Proc.new {
211
- in_lurker_app "git commit -a -m 'auto commit: #{`git log --oneline -n 1`.strip}'" rescue nil
212
- in_lurker_app "git push origin master"
213
- in_lurker_app "heroku run rake db:import --app lurker-app"
214
- }
215
- ask_for_deploy("heroku", do_deploy)
216
- end
217
-
218
- desc 'rebuilds & pushes app to heroku'
219
- task :deploy => [:build_example_docs, 'heroku:push'] do
220
- end
221
- end
222
-
223
- namespace :razum2um do
224
- desc 'pushes example lurker_app to razum2um'
225
- task :push => :predeploy do
226
- do_deploy = Proc.new {
227
- in_lurker_app "git commit -a -m 'auto commit: #{`git log --oneline -n 1`.strip}'" rescue nil
228
- in_lurker_app "git push razum2um master"
229
- %w[database secrets].each do |fname|
230
- on_razum2um_me "cp ~/#{fname}.yml config/#{fname}.yml"
231
- end
232
- on_razum2um_me "bundle install"
233
- on_razum2um_me "RAILS_ENV=production bin/rake db:migrate"
234
- on_razum2um_me "RAILS_ENV=production bin/rake db:import"
235
- on_razum2um_me "touch tmp/restart.txt"
236
- }
237
- ask_for_deploy("razum2um.me", do_deploy)
238
- end
239
-
240
- desc 'rebuilds & pushes app to razum2um.me'
241
- task :deploy => [:build_example_docs, 'razum2um:push'] do
242
- end
243
- end
244
-
245
- namespace :github do
246
- desc 'pushes example lurker_app to gh-pages'
247
- task :push do
248
- do_deploy = Proc.new {
249
- in_gh_pages "git commit -a -m 'auto commit: #{`git log --oneline -n 1`.strip}'" rescue nil
250
- in_gh_pages "git push origin gh-pages"
251
- }
252
- in_gh_pages "git add -A"
253
- in_gh_pages "git status"
254
- ask_for_deploy("gh-pages", do_deploy)
255
- end
256
-
257
- desc 'rebuilds & pushes app to gh-pages'
258
- task :deploy => [:build_example_docs, 'github:push'] do
259
- end
260
- end
261
-
262
29
  task :default => ["clobber:coverage", :spec, :regenerate, :cucumber, 'coveralls:push']
263
30
 
264
- desc 'commits lurker app'
265
- task :predeploy do
266
- do_predeploy = Proc.new {
267
- in_lurker_app "echo 'bin/lurker' > .gitignore"
268
- in_lurker_app "echo 'log' >> .gitignore"
269
- # commit migration and deploy by hand first time
270
- in_lurker_app "echo 'db/*' >> .gitignore"
271
- in_lurker_app "echo 'tmp/*log' >> .gitignore"
272
- in_lurker_app "echo '.bundle/*' >> .gitignore"
273
-
274
- in_lurker_app "git add -A"
275
- in_lurker_app "git status"
276
- }
277
-
278
- if (stage = `git log @{u}..`).lines.size > 0
279
- puts stage
280
- do_push_and_predeploy = Proc.new {
281
- sh "git push origin master"
282
- do_predeploy.call
283
- }
284
- ask_for_deploy("push master", do_push_and_predeploy)
285
- else
286
- do_predeploy.call
287
- end
288
- end
289
-
290
- desc 'deploys everything'
291
- task :deploy => ["razum2um:deploy", "heroku:deploy", "github:deploy"]
292
-
293
- desc 'pushes everything'
294
- task :push => ["razum2um:push", "heroku:push", "github:push"]
295
-
296
31
  desc 'releases gem & updates docs'
297
32
  task :publish do
298
33
  require 'lurker'
@@ -307,4 +42,3 @@ task :publish do
307
42
  system "gem push lurker-#{version}.gem"
308
43
  end
309
44
  end
310
-