lurker 0.6.6 → 0.6.7
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.
- checksums.yaml +4 -4
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +0 -0
 - data/.hound.yml +3 -0
 - data/.rubocop.yml +3 -0
 - data/.travis.yml +15 -5
 - data/Appraisals +20 -0
 - data/Gemfile +11 -7
 - data/README.md +46 -19
 - data/features/atom_persistent_within_the_same_type.feature +3 -2
 - data/features/controller_nested_schema_scaffolding.feature +2 -1
 - data/features/controller_schema_scaffolding.feature +2 -1
 - data/features/dereferencing_through_inlining.feature +2 -1
 - data/features/html_generation.feature +5 -4
 - data/features/minitest.feature +3 -2
 - data/features/multidomain_support.feature +5 -5
 - data/features/multitype_request_support.feature +3 -2
 - data/features/partials.feature +6 -5
 - data/features/request_nested_schema_scaffolding.feature +3 -3
 - data/features/request_schema_scaffolding.feature +3 -2
 - data/features/schema_suffixes.feature +2 -2
 - data/features/schema_updating_within_test_suite.feature +3 -2
 - data/features/step_definitions/additional_cli_steps.rb +7 -1
 - data/features/support/env.rb +13 -6
 - data/features/test_endpoint.feature +2 -30
 - data/gemfiles/rails_32.gemfile +27 -0
 - data/gemfiles/rails_40.gemfile +27 -0
 - data/gemfiles/rails_41.gemfile +27 -0
 - data/gemfiles/rails_42.gemfile +27 -0
 - data/lib/lurker.rb +1 -1
 - data/lib/lurker/cli.rb +29 -31
 - data/lib/lurker/server.rb +7 -6
 - data/lib/lurker/spec_helper/rails.rb +2 -0
 - data/lib/lurker/spy.rb +16 -2
 - data/lib/lurker/templates/public/application.css +1 -5
 - data/lib/lurker/templates/public/application.js +12 -12
 - data/lib/lurker/version.rb +1 -1
 - data/lurker-bw.svg +19 -0
 - data/lurker.gemspec +12 -6
 - data/tasks/deploy.rake +1 -1
 - data/tasks/generate.rake +13 -6
 - data/templates/generate_stuff.rb +15 -9
 - data/templates/lurker_app.rb +3 -0
 - metadata +35 -18
 - metadata.gz.sig +0 -0
 - data/gemfiles/Gemfile32.ci +0 -6
 - data/gemfiles/Gemfile40.ci +0 -6
 - data/gemfiles/Gemfile41.ci +0 -6
 - data/lib/lurker/engine.rb +0 -14
 - data/lib/lurker/templates/stylesheets/bootstrap.css +0 -5831
 
| 
         @@ -8,7 +8,6 @@ Feature: request nested schema scaffolding 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  require "spec_helper"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                  describe Api::V1::ReposController, :lurker do
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
11 
     | 
    
         
             
                    let!(:user) do
         
     | 
| 
       13 
12 
     | 
    
         
             
                      User.where(name: 'razum2um').first_or_create!.tap do |u|
         
     | 
| 
       14 
13 
     | 
    
         
             
                        u.repos.first_or_create!(name: 'lurker')
         
     | 
| 
         @@ -16,7 +15,7 @@ Feature: request nested schema scaffolding 
     | 
|
| 
       16 
15 
     | 
    
         
             
                    end
         
     | 
| 
       17 
16 
     | 
    
         | 
| 
       18 
17 
     | 
    
         
             
                    it "shows a user's repo" do
         
     | 
| 
       19 
     | 
    
         
            -
                      get "api/v1/users/#{user.id}/repos/#{user.repos.first.id}.json"
         
     | 
| 
      
 18 
     | 
    
         
            +
                      get "/api/v1/users/#{user.id}/repos/#{user.repos.first.id}.json"
         
     | 
| 
       20 
19 
     | 
    
         
             
                      expect(response).to be_success
         
     | 
| 
       21 
20 
     | 
    
         
             
                    end
         
     | 
| 
       22 
21 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -62,9 +61,10 @@ Feature: request nested schema scaffolding 
     | 
|
| 
       62 
61 
     | 
    
         
             
                  method: GET
         
     | 
| 
       63 
62 
     | 
    
         
             
                  path_info: "/api/v1/users/1/repos/1.json"
         
     | 
| 
       64 
63 
     | 
    
         
             
                  path_params:
         
     | 
| 
       65 
     | 
    
         
            -
                    action: show
         
     | 
| 
       66 
64 
     | 
    
         
             
                    controller: api/v1/repos
         
     | 
| 
      
 65 
     | 
    
         
            +
                    action: show
         
     | 
| 
       67 
66 
     | 
    
         
             
                    user_id: '1'
         
     | 
| 
       68 
67 
     | 
    
         
             
                    id: '1'
         
     | 
| 
       69 
68 
     | 
    
         | 
| 
       70 
69 
     | 
    
         
             
                """
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
         @@ -19,7 +19,7 @@ Feature: request schema scaffolding 
     | 
|
| 
       19 
19 
     | 
    
         
             
                    end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                    it "lists all the users" do
         
     | 
| 
       22 
     | 
    
         
            -
                      get "api/v1/users.json?limit=1"
         
     | 
| 
      
 22 
     | 
    
         
            +
                      get "/api/v1/users.json?limit=1"
         
     | 
| 
       23 
23 
     | 
    
         
             
                      expect(response).to be_success
         
     | 
| 
       24 
24 
     | 
    
         
             
                      expect(JSON.parse(response.body).size).to eq 1
         
     | 
| 
       25 
25 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -72,9 +72,10 @@ Feature: request schema scaffolding 
     | 
|
| 
       72 
72 
     | 
    
         
             
                  method: GET
         
     | 
| 
       73 
73 
     | 
    
         
             
                  path_info: "/api/v1/users.json"
         
     | 
| 
       74 
74 
     | 
    
         
             
                  path_params:
         
     | 
| 
       75 
     | 
    
         
            -
                    action: index
         
     | 
| 
       76 
75 
     | 
    
         
             
                    controller: api/v1/users
         
     | 
| 
      
 76 
     | 
    
         
            +
                    action: index
         
     | 
| 
       77 
77 
     | 
    
         
             
                  query_params:
         
     | 
| 
       78 
78 
     | 
    
         
             
                    limit: '1'
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
80 
     | 
    
         
             
                """
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
         @@ -49,8 +49,8 @@ Feature: schema suffixes 
     | 
|
| 
       49 
49 
     | 
    
         
             
                    path_info: "/api/v1/users/razum2um/repos/lurker.json"
         
     | 
| 
       50 
50 
     | 
    
         
             
                    method: PATCH
         
     | 
| 
       51 
51 
     | 
    
         
             
                    path_params:
         
     | 
| 
       52 
     | 
    
         
            -
                      action: update
         
     | 
| 
       53 
52 
     | 
    
         
             
                      controller: api/v1/repos
         
     | 
| 
      
 53 
     | 
    
         
            +
                      action: update
         
     | 
| 
       54 
54 
     | 
    
         
             
                      user_id: razum2um
         
     | 
| 
       55 
55 
     | 
    
         
             
                      id: lurker
         
     | 
| 
       56 
56 
     | 
    
         
             
                  """
         
     | 
| 
         @@ -120,8 +120,8 @@ Feature: schema suffixes 
     | 
|
| 
       120 
120 
     | 
    
         
             
                    method: PATCH
         
     | 
| 
       121 
121 
     | 
    
         
             
                    suffix: 'failed'
         
     | 
| 
       122 
122 
     | 
    
         
             
                    path_params:
         
     | 
| 
       123 
     | 
    
         
            -
                      action: update
         
     | 
| 
       124 
123 
     | 
    
         
             
                      controller: api/v1/repos
         
     | 
| 
      
 124 
     | 
    
         
            +
                      action: update
         
     | 
| 
       125 
125 
     | 
    
         
             
                      user_id: razum2um
         
     | 
| 
       126 
126 
     | 
    
         
             
                      id: lurker
         
     | 
| 
       127 
127 
     | 
    
         
             
                  """
         
     | 
| 
         @@ -54,9 +54,9 @@ Feature: schema updating within test suite 
     | 
|
| 
       54 
54 
     | 
    
         
             
                  method: PATCH
         
     | 
| 
       55 
55 
     | 
    
         
             
                  path_info: "/api/v2/users/1"
         
     | 
| 
       56 
56 
     | 
    
         
             
                  path_params:
         
     | 
| 
       57 
     | 
    
         
            -
                    id: '1'
         
     | 
| 
       58 
57 
     | 
    
         
             
                    controller: api/v2/users
         
     | 
| 
       59 
58 
     | 
    
         
             
                    action: update
         
     | 
| 
      
 59 
     | 
    
         
            +
                    id: '1'
         
     | 
| 
       60 
60 
     | 
    
         
             
                """
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
62 
     | 
    
         
             
              Scenario: json schema tests response parameters and request parameters and show errors from both using "users/update"
         
     | 
| 
         @@ -166,8 +166,9 @@ Feature: schema updating within test suite 
     | 
|
| 
       166 
166 
     | 
    
         
             
                  method: PATCH
         
     | 
| 
       167 
167 
     | 
    
         
             
                  path_info: "/api/v2/users/1"
         
     | 
| 
       168 
168 
     | 
    
         
             
                  path_params:
         
     | 
| 
       169 
     | 
    
         
            -
                    id: '1'
         
     | 
| 
       170 
169 
     | 
    
         
             
                    controller: api/v2/users
         
     | 
| 
       171 
170 
     | 
    
         
             
                    action: update
         
     | 
| 
      
 171 
     | 
    
         
            +
                    id: '1'
         
     | 
| 
       172 
172 
     | 
    
         | 
| 
       173 
173 
     | 
    
         
             
                """
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
         @@ -6,10 +6,16 @@ Given /^a checked file "([^"]*)" with:$/ do |file_name, file_content| 
     | 
|
| 
       6 
6 
     | 
    
         
             
            end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            Given /^an empty directory named "([^"]*)"$/ do |dir_name|
         
     | 
| 
       9 
     | 
    
         
            -
               
     | 
| 
      
 9 
     | 
    
         
            +
              in_current_dir { _rm_rf(dir_name) }
         
     | 
| 
       10 
10 
     | 
    
         
             
              create_dir(dir_name)
         
     | 
| 
       11 
11 
     | 
    
         
             
            end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
      
 13 
     | 
    
         
            +
            Given /^a service file with:$/ do |file_content|
         
     | 
| 
      
 14 
     | 
    
         
            +
              in_current_dir do
         
     | 
| 
      
 15 
     | 
    
         
            +
                write_file("#{Lurker::DEFAULT_SERVICE_PATH}/#{Rails.application.class.parent_name}#{Lurker::Service::SUFFIX}", file_content)
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       13 
19 
     | 
    
         
             
            When /^I go to "([^"]*)"$/ do |url|
         
     | 
| 
       14 
20 
     | 
    
         
             
              visit(url)
         
     | 
| 
       15 
21 
     | 
    
         
             
            end
         
     | 
    
        data/features/support/env.rb
    CHANGED
    
    | 
         @@ -6,6 +6,14 @@ SimpleCov.start do 
     | 
|
| 
       6 
6 
     | 
    
         
             
              end
         
     | 
| 
       7 
7 
     | 
    
         
             
            end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
            def example_path
         
     | 
| 
      
 10 
     | 
    
         
            +
              if rails_version = ENV['BUNDLE_GEMFILE'].to_s.match(/rails_\d\d/)
         
     | 
| 
      
 11 
     | 
    
         
            +
                File.expand_path("../../../tmp/lurker_app_#{rails_version}", __FILE__)
         
     | 
| 
      
 12 
     | 
    
         
            +
              else
         
     | 
| 
      
 13 
     | 
    
         
            +
                raise "Use `appraisal rails-XY cucumber ...` or export BUNDLE_GEMFILE=gemfiles/... explicitly"
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
       9 
17 
     | 
    
         
             
            require 'fileutils'
         
     | 
| 
       10 
18 
     | 
    
         
             
            require 'aruba/cucumber'
         
     | 
| 
       11 
19 
     | 
    
         | 
| 
         @@ -16,7 +24,7 @@ require 'capybara' 
     | 
|
| 
       16 
24 
     | 
    
         
             
            require 'capybara/dsl'
         
     | 
| 
       17 
25 
     | 
    
         
             
            require 'capybara/cucumber'
         
     | 
| 
       18 
26 
     | 
    
         
             
            require 'capybara/poltergeist'
         
     | 
| 
       19 
     | 
    
         
            -
            require  
     | 
| 
      
 27 
     | 
    
         
            +
            require "#{example_path}/config/environment"
         
     | 
| 
       20 
28 
     | 
    
         
             
            require 'database_cleaner'
         
     | 
| 
       21 
29 
     | 
    
         
             
            require 'database_cleaner/cucumber'
         
     | 
| 
       22 
30 
     | 
    
         | 
| 
         @@ -34,15 +42,14 @@ Aruba.configure do |config| 
     | 
|
| 
       34 
42 
     | 
    
         
             
            end
         
     | 
| 
       35 
43 
     | 
    
         | 
| 
       36 
44 
     | 
    
         
             
            Before do
         
     | 
| 
       37 
     | 
    
         
            -
              @dirs = [ 
     | 
| 
      
 45 
     | 
    
         
            +
              @dirs = [example_path]
         
     | 
| 
       38 
46 
     | 
    
         
             
              @aruba_timeout_seconds = 30
         
     | 
| 
       39 
47 
     | 
    
         
             
              DatabaseCleaner.start
         
     | 
| 
       40 
48 
     | 
    
         
             
              if ENV['CLEAN']
         
     | 
| 
       41 
49 
     | 
    
         
             
                system "bin/spring stop"
         
     | 
| 
       42 
     | 
    
         
            -
                 
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                 
     | 
| 
       45 
     | 
    
         
            -
                FileUtils.rm_rf File.expand_path('../../../tmp/lurker_app/spec/controllers', __FILE__)
         
     | 
| 
      
 50 
     | 
    
         
            +
                %w[lurker html public/lurker spec/requests spec/controllers].each do |dir_name|
         
     | 
| 
      
 51 
     | 
    
         
            +
                  in_current_dir { _rm_rf(dir_name) }
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
       46 
53 
     | 
    
         
             
              end
         
     | 
| 
       47 
54 
     | 
    
         
             
            end
         
     | 
| 
       48 
55 
     | 
    
         | 
| 
         @@ -48,8 +48,8 @@ Feature: test endpoint 
     | 
|
| 
       48 
48 
     | 
    
         
             
                    path_info: "/api/v1/users/1"
         
     | 
| 
       49 
49 
     | 
    
         
             
                    method: PATCH
         
     | 
| 
       50 
50 
     | 
    
         
             
                    path_params:
         
     | 
| 
       51 
     | 
    
         
            -
                      action: update
         
     | 
| 
       52 
51 
     | 
    
         
             
                      controller: api/v1/users
         
     | 
| 
      
 52 
     | 
    
         
            +
                      action: update
         
     | 
| 
       53 
53 
     | 
    
         
             
                      id: 1
         
     | 
| 
       54 
54 
     | 
    
         
             
                  """
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
         @@ -75,35 +75,6 @@ Feature: test endpoint 
     | 
|
| 
       75 
75 
     | 
    
         
             
              When I run `bin/rspec spec/controllers/api/v1/users_controller_spec.rb`
         
     | 
| 
       76 
76 
     | 
    
         
             
              Then the example should pass
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
              Scenario: json schema tests request parameters and tell what fails using "users/update"
         
     | 
| 
       79 
     | 
    
         
            -
                Given a file named "spec/controllers/api/v1/users_controller_spec.rb" with:
         
     | 
| 
       80 
     | 
    
         
            -
                  """ruby
         
     | 
| 
       81 
     | 
    
         
            -
                  require "spec_helper"
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                  describe Api::V1::UsersController, :lurker do
         
     | 
| 
       84 
     | 
    
         
            -
                    render_views
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                    let(:user) do
         
     | 
| 
       87 
     | 
    
         
            -
                      User.where(name: 'razum2um').first_or_create!
         
     | 
| 
       88 
     | 
    
         
            -
                    end
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                    it "updates a user" do
         
     | 
| 
       91 
     | 
    
         
            -
                      patch :update, id: user.id, user: { name: 1 }, format: 'json'
         
     | 
| 
       92 
     | 
    
         
            -
                      expect(response).to be_success
         
     | 
| 
       93 
     | 
    
         
            -
                    end
         
     | 
| 
       94 
     | 
    
         
            -
                  end
         
     | 
| 
       95 
     | 
    
         
            -
                  """
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
              When I run `bin/rspec spec/controllers/api/v1/users_controller_spec.rb`
         
     | 
| 
       98 
     | 
    
         
            -
              Then the output should contain failures:
         
     | 
| 
       99 
     | 
    
         
            -
                """
         
     | 
| 
       100 
     | 
    
         
            -
                Lurker::ValidationError:
         
     | 
| 
       101 
     | 
    
         
            -
                  Response
         
     | 
| 
       102 
     | 
    
         
            -
                    The property '#/name' of type Fixnum did not match the following type: string
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
                1 example, 1 failure
         
     | 
| 
       105 
     | 
    
         
            -
                """
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
78 
     | 
    
         
             
              Scenario: json schema tests response parameters and tell what fails using "users/update"
         
     | 
| 
       108 
79 
     | 
    
         
             
                Given a file named "spec/controllers/api/v1/users_controller_blank_spec.rb" with:
         
     | 
| 
       109 
80 
     | 
    
         
             
                  """ruby
         
     | 
| 
         @@ -132,3 +103,4 @@ Feature: test endpoint 
     | 
|
| 
       132 
103 
     | 
    
         | 
| 
       133 
104 
     | 
    
         
             
                1 example, 1 failure
         
     | 
| 
       134 
105 
     | 
    
         
             
                """
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # This file was generated by Appraisal
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            source "https://rubygems.org"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            gem "rails", "~> 3.2.21"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            group :development do
         
     | 
| 
      
 8 
     | 
    
         
            +
              gem "pry-byebug", :platforms => [:mri_20, :mri_21, :mri_22]
         
     | 
| 
      
 9 
     | 
    
         
            +
              gem "pry-debugger", :platforms => :mri_19
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem "pry-stack_explorer", :platform => :mri
         
     | 
| 
      
 11 
     | 
    
         
            +
              gem "pry-session", :platform => :mri
         
     | 
| 
      
 12 
     | 
    
         
            +
              gem "fuubar"
         
     | 
| 
      
 13 
     | 
    
         
            +
              gem "fuubar-cucumber"
         
     | 
| 
      
 14 
     | 
    
         
            +
              gem "selenium-webdriver"
         
     | 
| 
      
 15 
     | 
    
         
            +
              gem "highline"
         
     | 
| 
      
 16 
     | 
    
         
            +
              gem "appraisal", :github => "razum2um/appraisal", :branch => "master"
         
     | 
| 
      
 17 
     | 
    
         
            +
              gem "sprockets"
         
     | 
| 
      
 18 
     | 
    
         
            +
              gem "uglifier"
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem "sass-rails"
         
     | 
| 
      
 20 
     | 
    
         
            +
              gem "coffee-rails"
         
     | 
| 
      
 21 
     | 
    
         
            +
              gem "bootstrap-sass", "~> 3.3.3"
         
     | 
| 
      
 22 
     | 
    
         
            +
              gem "jquery-rails"
         
     | 
| 
      
 23 
     | 
    
         
            +
              gem "remotipart"
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem "launchy"
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            gemspec :path => "../"
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # This file was generated by Appraisal
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            source "https://rubygems.org"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            gem "rails", "~> 4.0.13"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            group :development do
         
     | 
| 
      
 8 
     | 
    
         
            +
              gem "pry-byebug", :platforms => [:mri_20, :mri_21, :mri_22]
         
     | 
| 
      
 9 
     | 
    
         
            +
              gem "pry-debugger", :platforms => :mri_19
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem "pry-stack_explorer", :platform => :mri
         
     | 
| 
      
 11 
     | 
    
         
            +
              gem "pry-session", :platform => :mri
         
     | 
| 
      
 12 
     | 
    
         
            +
              gem "fuubar"
         
     | 
| 
      
 13 
     | 
    
         
            +
              gem "fuubar-cucumber"
         
     | 
| 
      
 14 
     | 
    
         
            +
              gem "selenium-webdriver"
         
     | 
| 
      
 15 
     | 
    
         
            +
              gem "highline"
         
     | 
| 
      
 16 
     | 
    
         
            +
              gem "appraisal", :github => "razum2um/appraisal", :branch => "master"
         
     | 
| 
      
 17 
     | 
    
         
            +
              gem "sprockets"
         
     | 
| 
      
 18 
     | 
    
         
            +
              gem "uglifier"
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem "sass-rails"
         
     | 
| 
      
 20 
     | 
    
         
            +
              gem "coffee-rails"
         
     | 
| 
      
 21 
     | 
    
         
            +
              gem "bootstrap-sass", "~> 3.3.3"
         
     | 
| 
      
 22 
     | 
    
         
            +
              gem "jquery-rails"
         
     | 
| 
      
 23 
     | 
    
         
            +
              gem "remotipart"
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem "launchy"
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            gemspec :path => "../"
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # This file was generated by Appraisal
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            source "https://rubygems.org"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            gem "rails", "~> 4.1.9"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            group :development do
         
     | 
| 
      
 8 
     | 
    
         
            +
              gem "pry-byebug", :platforms => [:mri_20, :mri_21, :mri_22]
         
     | 
| 
      
 9 
     | 
    
         
            +
              gem "pry-debugger", :platforms => :mri_19
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem "pry-stack_explorer", :platform => :mri
         
     | 
| 
      
 11 
     | 
    
         
            +
              gem "pry-session", :platform => :mri
         
     | 
| 
      
 12 
     | 
    
         
            +
              gem "fuubar"
         
     | 
| 
      
 13 
     | 
    
         
            +
              gem "fuubar-cucumber"
         
     | 
| 
      
 14 
     | 
    
         
            +
              gem "selenium-webdriver"
         
     | 
| 
      
 15 
     | 
    
         
            +
              gem "highline"
         
     | 
| 
      
 16 
     | 
    
         
            +
              gem "appraisal", :github => "razum2um/appraisal", :branch => "master"
         
     | 
| 
      
 17 
     | 
    
         
            +
              gem "sprockets"
         
     | 
| 
      
 18 
     | 
    
         
            +
              gem "uglifier"
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem "sass-rails"
         
     | 
| 
      
 20 
     | 
    
         
            +
              gem "coffee-rails"
         
     | 
| 
      
 21 
     | 
    
         
            +
              gem "bootstrap-sass", "~> 3.3.3"
         
     | 
| 
      
 22 
     | 
    
         
            +
              gem "jquery-rails"
         
     | 
| 
      
 23 
     | 
    
         
            +
              gem "remotipart"
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem "launchy"
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            gemspec :path => "../"
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # This file was generated by Appraisal
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            source "https://rubygems.org"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            gem "rails", "~> 4.2.0"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            group :development do
         
     | 
| 
      
 8 
     | 
    
         
            +
              gem "pry-byebug", :platforms => [:mri_20, :mri_21, :mri_22]
         
     | 
| 
      
 9 
     | 
    
         
            +
              gem "pry-debugger", :platforms => :mri_19
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem "pry-stack_explorer", :platform => :mri
         
     | 
| 
      
 11 
     | 
    
         
            +
              gem "pry-session", :platform => :mri
         
     | 
| 
      
 12 
     | 
    
         
            +
              gem "fuubar"
         
     | 
| 
      
 13 
     | 
    
         
            +
              gem "fuubar-cucumber"
         
     | 
| 
      
 14 
     | 
    
         
            +
              gem "selenium-webdriver"
         
     | 
| 
      
 15 
     | 
    
         
            +
              gem "highline"
         
     | 
| 
      
 16 
     | 
    
         
            +
              gem "appraisal", :github => "razum2um/appraisal", :branch => "master"
         
     | 
| 
      
 17 
     | 
    
         
            +
              gem "sprockets"
         
     | 
| 
      
 18 
     | 
    
         
            +
              gem "uglifier"
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem "sass-rails"
         
     | 
| 
      
 20 
     | 
    
         
            +
              gem "coffee-rails"
         
     | 
| 
      
 21 
     | 
    
         
            +
              gem "bootstrap-sass", "~> 3.3.3"
         
     | 
| 
      
 22 
     | 
    
         
            +
              gem "jquery-rails"
         
     | 
| 
      
 23 
     | 
    
         
            +
              gem "remotipart"
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem "launchy"
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            gemspec :path => "../"
         
     | 
    
        data/lib/lurker.rb
    CHANGED
    
    | 
         @@ -85,10 +85,10 @@ require 'lurker/json/schema/extensions' 
     | 
|
| 
       85 
85 
     | 
    
         
             
            require 'lurker/json/schema/response_codes'
         
     | 
| 
       86 
86 
     | 
    
         
             
            require 'lurker/json/schema/reference'
         
     | 
| 
       87 
87 
     | 
    
         
             
            require 'lurker/spy'
         
     | 
| 
      
 88 
     | 
    
         
            +
            require 'lurker/server'
         
     | 
| 
       88 
89 
     | 
    
         
             
            require 'lurker/request'
         
     | 
| 
       89 
90 
     | 
    
         
             
            require 'lurker/response'
         
     | 
| 
       90 
91 
     | 
    
         | 
| 
       91 
92 
     | 
    
         
             
            if defined? Rails
         
     | 
| 
       92 
     | 
    
         
            -
              require 'lurker/engine'
         
     | 
| 
       93 
93 
     | 
    
         
             
              require 'lurker/sandbox'
         
     | 
| 
       94 
94 
     | 
    
         
             
            end
         
     | 
    
        data/lib/lurker/cli.rb
    CHANGED
    
    | 
         @@ -1,15 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'thor'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'execjs'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'digest/sha1'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'lurker 
     | 
| 
      
 4 
     | 
    
         
            +
            require 'lurker'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'active_support/inflector'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            module Lurker
         
     | 
| 
       7 
8 
     | 
    
         
             
              # A Thor::Error to be thrown when an lurker directory is not found
         
     | 
| 
       8 
9 
     | 
    
         
             
              class NotFound < Thor::Error; end
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              # A Thor::Error to be thrown when an lurker output destination is unavailable
         
     | 
| 
       11 
     | 
    
         
            -
              class NotADirectory < Thor::Error; end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
11 
     | 
    
         
             
              # A Thor definition for an lurker to HTML conversion operation
         
     | 
| 
       14 
12 
     | 
    
         
             
              class Cli < Thor
         
     | 
| 
       15 
13 
     | 
    
         
             
                include Thor::Actions
         
     | 
| 
         @@ -28,8 +26,8 @@ module Lurker 
     | 
|
| 
       28 
26 
     | 
    
         
             
                method_option :rails, :type => :boolean, :desc => "Includes Rails environment"
         
     | 
| 
       29 
27 
     | 
    
         
             
                method_option :exclude, :aliases => "-e", :desc => "Select endpoints by given regexp, if NOT matching prefix"
         
     | 
| 
       30 
28 
     | 
    
         
             
                method_option :select, :aliases => "-s", :desc => "Select endpoints by given regexp, matching prefix"
         
     | 
| 
       31 
     | 
    
         
            -
                method_option :output, :aliases => "-o", :desc => "Output path"
         
     | 
| 
       32 
     | 
    
         
            -
                method_option :url_base_path, :aliases => "-u", :desc => "URL base path"
         
     | 
| 
      
 29 
     | 
    
         
            +
                method_option :output, :aliases => "-o", :desc => "Output path", :default => "public"
         
     | 
| 
      
 30 
     | 
    
         
            +
                method_option :url_base_path, :aliases => "-u", :desc => "URL base path", :default => Lurker::DEFAULT_URL_BASE
         
     | 
| 
       33 
31 
     | 
    
         
             
                method_option :format, :aliases => "-f", :desc => "Format in html or pdf, defaults to html", :default => "html"
         
     | 
| 
       34 
32 
     | 
    
         
             
                method_option :templates, :aliases => "-t", :desc => "Template overrides path"
         
     | 
| 
       35 
33 
     | 
    
         
             
                method_option :content, :aliases => "-c", :desc => "Content to be rendered into html-docs main page"
         
     | 
| 
         @@ -41,8 +39,7 @@ module Lurker 
     | 
|
| 
       41 
39 
     | 
    
         
             
                  raise Lurker::NotFound.new(origin_path) unless has_valid_origin?
         
     | 
| 
       42 
40 
     | 
    
         
             
                  say_status :using, lurker_path
         
     | 
| 
       43 
41 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                   
     | 
| 
       45 
     | 
    
         
            -
                  raise Lurker::NotADirectory.new(output_path) unless has_valid_destination?
         
     | 
| 
      
 42 
     | 
    
         
            +
                  FileUtils.mkdir_p(output_path)
         
     | 
| 
       46 
43 
     | 
    
         
             
                  say_status :inside, output_path
         
     | 
| 
       47 
44 
     | 
    
         | 
| 
       48 
45 
     | 
    
         
             
                  if options[:rails]
         
     | 
| 
         @@ -60,7 +57,7 @@ module Lurker 
     | 
|
| 
       60 
57 
     | 
    
         
             
                  def convert_to_pdf
         
     | 
| 
       61 
58 
     | 
    
         
             
                    Lurker.safe_require('pdfkit')
         
     | 
| 
       62 
59 
     | 
    
         
             
                    css = File.expand_path('application.css', self.class.precompiled_static_root)
         
     | 
| 
       63 
     | 
    
         
            -
                     
     | 
| 
      
 60 
     | 
    
         
            +
                    inside(output_path) do
         
     | 
| 
       64 
61 
     | 
    
         
             
                      service_presenters.each do |service_presenter|
         
     | 
| 
       65 
62 
     | 
    
         
             
                        html = "<html><body>"
         
     | 
| 
       66 
63 
     | 
    
         
             
                        service_presenter.endpoints.each do |endpoint_prefix_group|
         
     | 
| 
         @@ -71,13 +68,14 @@ module Lurker 
     | 
|
| 
       71 
68 
     | 
    
         
             
                        html << "</body></html>"
         
     | 
| 
       72 
69 
     | 
    
         
             
                        kit = PDFKit.new(html, :page_size => 'Letter')
         
     | 
| 
       73 
70 
     | 
    
         
             
                        kit.stylesheets << css
         
     | 
| 
       74 
     | 
    
         
            -
                         
     | 
| 
      
 71 
     | 
    
         
            +
                        url_name = ActiveSupport::Inflector.parameterize(service_presenter.name, '_')
         
     | 
| 
      
 72 
     | 
    
         
            +
                        create_file("#{url_name}.pdf", kit.to_pdf, force: true)
         
     | 
| 
       75 
73 
     | 
    
         
             
                      end
         
     | 
| 
       76 
74 
     | 
    
         
             
                    end
         
     | 
| 
       77 
75 
     | 
    
         
             
                  end
         
     | 
| 
       78 
76 
     | 
    
         | 
| 
       79 
77 
     | 
    
         
             
                  def convert_to_html
         
     | 
| 
       80 
     | 
    
         
            -
                     
     | 
| 
      
 78 
     | 
    
         
            +
                    inside(output_path) do
         
     | 
| 
       81 
79 
     | 
    
         
             
                      # js, css, fonts
         
     | 
| 
       82 
80 
     | 
    
         
             
                      static = []
         
     | 
| 
       83 
81 
     | 
    
         
             
                      Dir["#{self.class.precompiled_static_root}/*"].each do |fname|
         
     | 
| 
         @@ -85,11 +83,10 @@ module Lurker 
     | 
|
| 
       85 
83 
     | 
    
         
             
                          sha1 = Digest::SHA1.hexdigest(open(fname).read)
         
     | 
| 
       86 
84 
     | 
    
         
             
                          html_options.merge! match[1] => sha1
         
     | 
| 
       87 
85 
     | 
    
         
             
                          static << (new_name = "application-#{sha1}.#{match[1]}")
         
     | 
| 
       88 
     | 
    
         
            -
                           
     | 
| 
       89 
     | 
    
         
            -
                           
     | 
| 
       90 
     | 
    
         
            -
                          spawn "cat #{to} | gzip -9 > #{to}.gz"
         
     | 
| 
      
 86 
     | 
    
         
            +
                          FileUtils.cp_r fname, new_name
         
     | 
| 
      
 87 
     | 
    
         
            +
                          spawn "cat #{new_name} | gzip -9 > #{new_name}.gz"
         
     | 
| 
       91 
88 
     | 
    
         
             
                        else
         
     | 
| 
       92 
     | 
    
         
            -
                          FileUtils.cp_r fname,  
     | 
| 
      
 89 
     | 
    
         
            +
                          FileUtils.cp_r fname, Pathname.new(fname).basename.to_s
         
     | 
| 
       93 
90 
     | 
    
         
             
                        end
         
     | 
| 
       94 
91 
     | 
    
         
             
                      end
         
     | 
| 
       95 
92 
     | 
    
         | 
| 
         @@ -117,12 +114,17 @@ module Lurker 
     | 
|
| 
       117 
114 
     | 
    
         
             
                  end
         
     | 
| 
       118 
115 
     | 
    
         | 
| 
       119 
116 
     | 
    
         
             
                  def output_path
         
     | 
| 
       120 
     | 
    
         
            -
                     
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
                       
     | 
| 
      
 117 
     | 
    
         
            +
                    "#{output_prefix}/#{url_base_path}"
         
     | 
| 
      
 118 
     | 
    
         
            +
                  end
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                  def output_prefix
         
     | 
| 
      
 121 
     | 
    
         
            +
                    if explicit = options[:output]
         
     | 
| 
      
 122 
     | 
    
         
            +
                      explicit.sub(/\/?#{url_base_path}\/?$/, '')
         
     | 
| 
      
 123 
     | 
    
         
            +
                    elsif File.exists? "public"
         
     | 
| 
      
 124 
     | 
    
         
            +
                      "public"
         
     | 
| 
      
 125 
     | 
    
         
            +
                    else
         
     | 
| 
      
 126 
     | 
    
         
            +
                      raise "Please, run it from `Rails.root` or pass `-o` option"
         
     | 
| 
      
 127 
     | 
    
         
            +
                    end
         
     | 
| 
       126 
128 
     | 
    
         
             
                  end
         
     | 
| 
       127 
129 
     | 
    
         | 
| 
       128 
130 
     | 
    
         
             
                  def template_path
         
     | 
| 
         @@ -138,10 +140,6 @@ module Lurker 
     | 
|
| 
       138 
140 
     | 
    
         
             
                    origin.directory?
         
     | 
| 
       139 
141 
     | 
    
         
             
                  end
         
     | 
| 
       140 
142 
     | 
    
         | 
| 
       141 
     | 
    
         
            -
                  def has_valid_destination?
         
     | 
| 
       142 
     | 
    
         
            -
                    !destination.exist? || destination.directory?
         
     | 
| 
       143 
     | 
    
         
            -
                  end
         
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
143 
     | 
    
         
             
                  def service_presenters
         
     | 
| 
       146 
144 
     | 
    
         
             
                    @service_presenters ||= services.map do |service|
         
     | 
| 
       147 
145 
     | 
    
         
             
                      Lurker::ServicePresenter.new(service, html_options, &filtering_block)
         
     | 
| 
         @@ -170,9 +168,9 @@ module Lurker 
     | 
|
| 
       170 
168 
     | 
    
         
             
                  def html_options
         
     | 
| 
       171 
169 
     | 
    
         
             
                    @html_options ||= {
         
     | 
| 
       172 
170 
     | 
    
         
             
                      :static_html => true,
         
     | 
| 
       173 
     | 
    
         
            -
                      :url_base_path =>  
     | 
| 
      
 171 
     | 
    
         
            +
                      :url_base_path => url_base_path.prepend('/'),
         
     | 
| 
       174 
172 
     | 
    
         
             
                      :template_directory => template_path,
         
     | 
| 
       175 
     | 
    
         
            -
                      :html_directory =>  
     | 
| 
      
 173 
     | 
    
         
            +
                      :html_directory => output_path,
         
     | 
| 
       176 
174 
     | 
    
         
             
                      :content => self.content,
         
     | 
| 
       177 
175 
     | 
    
         
             
                      :footer => (`git rev-parse --short HEAD`.to_s.strip rescue ""),
         
     | 
| 
       178 
176 
     | 
    
         
             
                      :lurker => gem_info
         
     | 
| 
         @@ -182,6 +180,10 @@ module Lurker 
     | 
|
| 
       182 
180 
     | 
    
         | 
| 
       183 
181 
     | 
    
         
             
                private
         
     | 
| 
       184 
182 
     | 
    
         | 
| 
      
 183 
     | 
    
         
            +
                def url_base_path
         
     | 
| 
      
 184 
     | 
    
         
            +
                  options[:url_base_path].presence.try(:strip).try(:sub, /^\/+/, '') || Lurker::DEFAULT_URL_BASE
         
     | 
| 
      
 185 
     | 
    
         
            +
                end
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
       185 
187 
     | 
    
         
             
                def gem_info
         
     | 
| 
       186 
188 
     | 
    
         
             
                  spec = if Bundler.respond_to? :locked_gems
         
     | 
| 
       187 
189 
     | 
    
         
             
                    Bundler.locked_gems.specs.select { |s| s.name == 'lurker' } .first # 1.6
         
     | 
| 
         @@ -217,9 +219,5 @@ module Lurker 
     | 
|
| 
       217 
219 
     | 
    
         
             
                def origin
         
     | 
| 
       218 
220 
     | 
    
         
             
                  Pathname.new(origin_path)
         
     | 
| 
       219 
221 
     | 
    
         
             
                end
         
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
                def destination
         
     | 
| 
       222 
     | 
    
         
            -
                  Pathname.new(destination_root)
         
     | 
| 
       223 
     | 
    
         
            -
                end
         
     | 
| 
       224 
222 
     | 
    
         
             
              end
         
     | 
| 
       225 
223 
     | 
    
         
             
            end
         
     |