jekyll-auth 1.0.3 → 2.0.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.
- checksums.yaml +4 -4
- data/.travis.yml +5 -1
- data/README.md +11 -3
- data/bin/jekyll-auth +3 -3
- data/jekyll-auth.gemspec +4 -4
- data/lib/jekyll_auth/auth_site.rb +1 -1
- data/lib/jekyll_auth/commands.rb +1 -1
- data/lib/jekyll_auth/helpers.rb +1 -1
- data/lib/jekyll_auth/version.rb +1 -1
- data/spec/jekyll_auth_auth_site_spec.rb +4 -4
- data/spec/jekyll_auth_bin_spec.rb +1 -1
- data/spec/jekyll_auth_helpers_spec.rb +2 -2
- metadata +10 -9
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: b2bc3f1b5a01a023ce6a06707d67be186171eb2c
         | 
| 4 | 
            +
              data.tar.gz: 944440d4dc8586bb5ce652bfcae1d98135169411
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 035f53918722a1a28072452343193a39269dab8785e0592965cce0b24c099119fd2518c2f4fce6de27225d19254b20484c8aa337a181e4da85313ef7f33b6ba7
         | 
| 7 | 
            +
              data.tar.gz: 975a8e9ffb1a8c64aa6d2ba2fd30bdfe29dc9dcdf73ade840f5e882ac9f519b0a135e561438245ccb8bad7b9ebb4558e92c429a34c223ff15421921373657269
         | 
    
        data/.travis.yml
    CHANGED
    
    | @@ -1,4 +1,8 @@ | |
| 1 1 | 
             
            language: ruby
         | 
| 2 | 
            +
            rvm:
         | 
| 3 | 
            +
              - 2.0
         | 
| 4 | 
            +
              - 2.1
         | 
| 5 | 
            +
              - 2.2
         | 
| 2 6 | 
             
            script: "./script/cibuild"
         | 
| 3 7 |  | 
| 4 8 | 
             
            before_script:
         | 
| @@ -12,4 +16,4 @@ env: | |
| 12 16 | 
             
              global:
         | 
| 13 17 | 
             
                - GITHUB_CLIENT_ID=FOO
         | 
| 14 18 | 
             
                - GITHUB_CLIENT_SECRET=BAR
         | 
| 15 | 
            -
                -  | 
| 19 | 
            +
                - GITHUB_ORG_NAME="balter-test-org"
         | 
    
        data/README.md
    CHANGED
    
    | @@ -47,7 +47,7 @@ Remember the 'my-site' part for later on when using `heroku create`. Also, my-si | |
| 47 47 |  | 
| 48 48 | 
             
            #### Automatically
         | 
| 49 49 |  | 
| 50 | 
            -
            Run `bundle exec jekyll-auth setup --client_id XXX --client_secret XXX -- | 
| 50 | 
            +
            Run `bundle exec jekyll-auth setup --client_id XXX --client_secret XXX --org_name XXX`
         | 
| 51 51 |  | 
| 52 52 | 
             
            (or `--team_id XXX`)
         | 
| 53 53 |  | 
| @@ -56,10 +56,18 @@ Run `bundle exec jekyll-auth setup --client_id XXX --client_secret XXX --org_id | |
| 56 56 | 
             
            1. You may need to add and commit the files generated by `jekyll-auth new` to Git before continuing
         | 
| 57 57 | 
             
            2. Make sure you have [the Heroku toolbelt](https://toolbelt.heroku.com/) installed
         | 
| 58 58 | 
             
            3. Run `heroku create my-site` from your site's directory; make sure my-site matches what you specified in the Githup application registration above.
         | 
| 59 | 
            -
            4. `heroku config:set GITHUB_CLIENT_ID=XXX GITHUB_CLIENT_SECRET=XXX  | 
| 59 | 
            +
            4. `heroku config:set GITHUB_CLIENT_ID=XXX GITHUB_CLIENT_SECRET=XXX GITHUB_ORG_NAME=XXX` (or `GITHUB_TEAM_ID`)
         | 
| 60 60 | 
             
            5. `git push heroku`, or if you are maintaining the site in an orphaned branch of your github repo (say 'heroku-pages'), do `git push heroku heroku-pages:master`
         | 
| 61 61 | 
             
            6. `heroku open` to open the site in your browser
         | 
| 62 62 |  | 
| 63 | 
            +
            #### Find the organization ID (needed to find team ID)
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            If you need to find an organization's ID, you can use the following curl command:
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            ```
         | 
| 68 | 
            +
            curl https://api.github.com/orgs/{org_name}
         | 
| 69 | 
            +
            ```
         | 
| 70 | 
            +
             | 
| 63 71 | 
             
            #### Finding the team ID
         | 
| 64 72 |  | 
| 65 73 | 
             
            If you need help finding a team's numeric ID, you can use the `jekyll-auth team_id` command.
         | 
| @@ -121,7 +129,7 @@ Just run `jekyll serve` as you would normally | |
| 121 129 |  | 
| 122 130 | 
             
            1. `export GITHUB_CLIENT_ID=[your github app client id]`
         | 
| 123 131 | 
             
            2. `export GITHUB_CLIENT_SECRET=[your github app client secret]`
         | 
| 124 | 
            -
            3. `export  | 
| 132 | 
            +
            3. `export GITHUB_ORG_NAME=[org name]` or `export GITHUB_TEAM_ID=[team id]` or `export GITHUB_TEAM_IDS=1234,5678`
         | 
| 125 133 | 
             
            4. `jekyll-auth serve`
         | 
| 126 134 |  | 
| 127 135 | 
             
            *Pro-tip #1:* For sanity sake, and to avoid problems with your callback URL, you may want to have two apps, one with a local oauth callback, and one for production if you're going to be testing auth locally.
         | 
    
        data/bin/jekyll-auth
    CHANGED
    
    | @@ -52,7 +52,7 @@ Mercenary.program("jekyll-auth") do |p| | |
| 52 52 | 
             
                    exit 1
         | 
| 53 53 | 
             
                  end
         | 
| 54 54 |  | 
| 55 | 
            -
                  org = options["org"] || ENV[" | 
| 55 | 
            +
                  org = options["org"] || ENV["GITHUB_ORG_NAME"]
         | 
| 56 56 | 
             
                  team = options["team"]
         | 
| 57 57 |  | 
| 58 58 | 
             
                  if org.nil? || team.nil?
         | 
| @@ -79,7 +79,7 @@ Mercenary.program("jekyll-auth") do |p| | |
| 79 79 | 
             
                  # Ensure environmental variables are set
         | 
| 80 80 | 
             
                  unless ["GITHUB_CLIENT_ID", "GITHUB_CLIENT_SECRET"].all? { |v| JekyllAuth::Commands.env_var_set?(v) }
         | 
| 81 81 | 
             
                    puts "Whoops. Looks like you forgot to tell Jekyll Auth about your app".red
         | 
| 82 | 
            -
                    puts "Be sure to run export GITHUB_CLIENT_ID=[client id], export GITHUB_CLIENT_SECRET=[client secret], and export  | 
| 82 | 
            +
                    puts "Be sure to run export GITHUB_CLIENT_ID=[client id], export GITHUB_CLIENT_SECRET=[client secret], and export GITHUB_ORG_NAME=[org name] (or GITHUB_TEAM_ID)".red
         | 
| 83 83 | 
             
                    puts "See the readme for more information on where to find these".red
         | 
| 84 84 | 
             
                    exit 1
         | 
| 85 85 | 
             
                  end
         | 
| @@ -100,7 +100,7 @@ Mercenary.program("jekyll-auth") do |p| | |
| 100 100 | 
             
                c.option "client_id", "--client_id", "Your oauth app client id"
         | 
| 101 101 | 
             
                c.option "client_secret", "--client_secret", "Your oauth app client secret"
         | 
| 102 102 | 
             
                c.option "team_id", "--team_id", "The team to authenticate against"
         | 
| 103 | 
            -
                c.option " | 
| 103 | 
            +
                c.option "org_name", "--org_name", "An organization to authenticate against"
         | 
| 104 104 | 
             
                c.action do |args, options|
         | 
| 105 105 |  | 
| 106 106 | 
             
                  if find_executable("heroku").nil?
         | 
    
        data/jekyll-auth.gemspec
    CHANGED
    
    | @@ -3,8 +3,8 @@ require './lib/jekyll_auth/version' | |
| 3 3 | 
             
            Gem::Specification.new do |s|
         | 
| 4 4 | 
             
              s.name                  = "jekyll-auth"
         | 
| 5 5 | 
             
              s.version               = JekyllAuth::VERSION
         | 
| 6 | 
            -
              s.summary               = "A simple way to use  | 
| 7 | 
            -
              s.description           = "A simple way to use  | 
| 6 | 
            +
              s.summary               = "A simple way to use GitHub OAuth to serve a protected jekyll site to your GitHub organization"
         | 
| 7 | 
            +
              s.description           = "A simple way to use GitHub OAuth to serve a protected jekyll site to your GitHub organization."
         | 
| 8 8 | 
             
              s.authors               = "Ben Balter"
         | 
| 9 9 | 
             
              s.email                 = "ben@balter.com"
         | 
| 10 10 | 
             
              s.homepage              = "https://github.com/benbalter/jekyll-auth"
         | 
| @@ -14,11 +14,11 @@ Gem::Specification.new do |s| | |
| 14 14 | 
             
              s.executables           = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         | 
| 15 15 | 
             
              s.require_paths         = ["lib"]
         | 
| 16 16 |  | 
| 17 | 
            -
              s.add_dependency "jekyll", " | 
| 17 | 
            +
              s.add_dependency "jekyll", ">= 2.0"
         | 
| 18 18 | 
             
              s.add_dependency "sinatra-index", "~> 0.0"
         | 
| 19 19 | 
             
              s.add_dependency "sinatra_auth_github", "~> 1.1"
         | 
| 20 20 | 
             
              s.add_dependency "rack", "~> 1.6"
         | 
| 21 | 
            -
              s.add_dependency "dotenv", "~>  | 
| 21 | 
            +
              s.add_dependency "dotenv", "~> 2.0"
         | 
| 22 22 | 
             
              s.add_dependency "rake", "~> 10.3"
         | 
| 23 23 | 
             
              s.add_dependency "rack-ssl-enforcer", "~> 0.2"
         | 
| 24 24 | 
             
              s.add_dependency "mercenary", "~> 0.3"
         | 
| @@ -33,7 +33,7 @@ class JekyllAuth | |
| 33 33 | 
             
                  when :teams
         | 
| 34 34 | 
             
                    github_teams_authenticate! ENV['GITHUB_TEAM_IDS'].split(",")
         | 
| 35 35 | 
             
                  when :org
         | 
| 36 | 
            -
                    github_organization_authenticate! ENV[' | 
| 36 | 
            +
                    github_organization_authenticate! ENV['GITHUB_ORG_NAME']
         | 
| 37 37 | 
             
                  else
         | 
| 38 38 | 
             
                    raise JekyllAuth::ConfigError
         | 
| 39 39 | 
             
                  end
         | 
    
        data/lib/jekyll_auth/commands.rb
    CHANGED
    
    | @@ -2,7 +2,7 @@ class JekyllAuth | |
| 2 2 | 
             
              class Commands
         | 
| 3 3 |  | 
| 4 4 | 
             
                FILES = %w{Rakefile config.ru .gitignore .env}
         | 
| 5 | 
            -
                VARS  = %w{client_id client_secret team_id  | 
| 5 | 
            +
                VARS  = %w{client_id client_secret team_id org_name}
         | 
| 6 6 |  | 
| 7 7 | 
             
                def self.source
         | 
| 8 8 | 
             
                  @source ||= File.expand_path( "../../templates", File.dirname(__FILE__) )
         | 
    
        data/lib/jekyll_auth/helpers.rb
    CHANGED
    
    
    
        data/lib/jekyll_auth/version.rb
    CHANGED
    
    
| @@ -12,9 +12,9 @@ describe "logged in user" do | |
| 12 12 | 
             
                @user = make_user('login' => 'benbaltertest')
         | 
| 13 13 | 
             
                login_as @user
         | 
| 14 14 |  | 
| 15 | 
            -
                ENV[' | 
| 15 | 
            +
                ENV['GITHUB_ORG_NAME'] = "balter-test-org"
         | 
| 16 16 |  | 
| 17 | 
            -
                stub_request(:get, "https://api.github.com/orgs/#{ENV[" | 
| 17 | 
            +
                stub_request(:get, "https://api.github.com/orgs/#{ENV["GITHUB_ORG_NAME"]}/members/benbaltertest").
         | 
| 18 18 | 
             
                to_return(:status => 200)
         | 
| 19 19 | 
             
              end
         | 
| 20 20 |  | 
| @@ -44,7 +44,7 @@ describe "logged out user" do | |
| 44 44 | 
             
              end
         | 
| 45 45 |  | 
| 46 46 | 
             
              before do
         | 
| 47 | 
            -
                ENV[' | 
| 47 | 
            +
                ENV['GITHUB_ORG_NAME'] = "balter-test-org"
         | 
| 48 48 | 
             
              end
         | 
| 49 49 |  | 
| 50 50 | 
             
              it "doesn't let you view indexes" do
         | 
| @@ -68,7 +68,7 @@ describe "logged out user" do | |
| 68 68 | 
             
              end
         | 
| 69 69 |  | 
| 70 70 | 
             
              it "refuses to serve the site without an authentication strategy" do
         | 
| 71 | 
            -
                ENV[" | 
| 71 | 
            +
                ENV["GITHUB_ORG_NAME"] = nil
         | 
| 72 72 | 
             
                ENV["GITHUB_TEAM_ID"] = nil
         | 
| 73 73 | 
             
                ENV["GITHUB_TEAMS_ID"] = nil
         | 
| 74 74 | 
             
                expect{get "/"}.to raise_error(JekyllAuth::ConfigError)
         | 
| @@ -19,7 +19,7 @@ describe "bin" do | |
| 19 19 | 
             
                  with_message(/prefix the jekyll-auth command with GITHUB_TOKEN/)
         | 
| 20 20 | 
             
                end
         | 
| 21 21 |  | 
| 22 | 
            -
                it "errors if no team_id or  | 
| 22 | 
            +
                it "errors if no team_id or org_name is given" do
         | 
| 23 23 | 
             
                  env = { "GITHUB_TOKEN" => "1234"}
         | 
| 24 24 | 
             
                  expect{execute_bin(env, "team_id")}.to raise_error(RuntimeError).
         | 
| 25 25 | 
             
                  with_message(/An org name and team ID are required/)
         | 
| @@ -17,7 +17,7 @@ describe "strategies" do | |
| 17 17 | 
             
              before(:each) do
         | 
| 18 18 | 
             
                JekyllAuth.instance_variable_set("@config", nil)
         | 
| 19 19 | 
             
                @helper = TestHelper.new
         | 
| 20 | 
            -
                ENV[" | 
| 20 | 
            +
                ENV["GITHUB_ORG_NAME"] = nil
         | 
| 21 21 | 
             
                ENV["GITHUB_TEAM_ID"] = nil
         | 
| 22 22 | 
             
                ENV["GITHUB_TEAMS_ID"] = nil
         | 
| 23 23 | 
             
              end
         | 
| @@ -27,7 +27,7 @@ describe "strategies" do | |
| 27 27 | 
             
              end
         | 
| 28 28 |  | 
| 29 29 | 
             
              it "should detect the org strategy" do
         | 
| 30 | 
            -
                with_env(" | 
| 30 | 
            +
                with_env("GITHUB_ORG_NAME", "some_org") do
         | 
| 31 31 | 
             
                  expect(@helper.authentication_strategy).to eql(:org)
         | 
| 32 32 | 
             
                end
         | 
| 33 33 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,27 +1,27 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jekyll-auth
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 2.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ben Balter
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015- | 
| 11 | 
            +
            date: 2015-11-11 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: jekyll
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - - " | 
| 17 | 
            +
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 19 | 
             
                    version: '2.0'
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 | 
            -
                - - " | 
| 24 | 
            +
                - - ">="
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: '2.0'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| @@ -72,14 +72,14 @@ dependencies: | |
| 72 72 | 
             
                requirements:
         | 
| 73 73 | 
             
                - - "~>"
         | 
| 74 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version: ' | 
| 75 | 
            +
                    version: '2.0'
         | 
| 76 76 | 
             
              type: :runtime
         | 
| 77 77 | 
             
              prerelease: false
         | 
| 78 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 79 | 
             
                requirements:
         | 
| 80 80 | 
             
                - - "~>"
         | 
| 81 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version: ' | 
| 82 | 
            +
                    version: '2.0'
         | 
| 83 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 84 | 
             
              name: rake
         | 
| 85 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -206,7 +206,7 @@ dependencies: | |
| 206 206 | 
             
                - - "~>"
         | 
| 207 207 | 
             
                  - !ruby/object:Gem::Version
         | 
| 208 208 | 
             
                    version: '0.10'
         | 
| 209 | 
            -
            description: A simple way to use  | 
| 209 | 
            +
            description: A simple way to use GitHub OAuth to serve a protected jekyll site to
         | 
| 210 210 | 
             
              your GitHub organization.
         | 
| 211 211 | 
             
            email: ben@balter.com
         | 
| 212 212 | 
             
            executables:
         | 
| @@ -268,10 +268,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 268 268 | 
             
                  version: '0'
         | 
| 269 269 | 
             
            requirements: []
         | 
| 270 270 | 
             
            rubyforge_project: 
         | 
| 271 | 
            -
            rubygems_version: 2. | 
| 271 | 
            +
            rubygems_version: 2.5.0
         | 
| 272 272 | 
             
            signing_key: 
         | 
| 273 273 | 
             
            specification_version: 4
         | 
| 274 | 
            -
            summary: A simple way to use  | 
| 274 | 
            +
            summary: A simple way to use GitHub OAuth to serve a protected jekyll site to your
         | 
| 275 275 | 
             
              GitHub organization
         | 
| 276 276 | 
             
            test_files:
         | 
| 277 277 | 
             
            - spec/jekyll_auth_auth_site_spec.rb
         | 
| @@ -281,3 +281,4 @@ test_files: | |
| 281 281 | 
             
            - spec/jekyll_auth_jekyll_site_spec.rb
         | 
| 282 282 | 
             
            - spec/jekyll_auth_spec.rb
         | 
| 283 283 | 
             
            - spec/spec_helper.rb
         | 
| 284 | 
            +
            has_rdoc: 
         |