Skip to content

Commit

Permalink
first push, already a working package!
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeason committed Mar 30, 2020
0 parents commit e58f9b7
Show file tree
Hide file tree
Showing 17 changed files with 492 additions and 0 deletions.
1 change: 1 addition & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
24 changes: 24 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CompatHelper

on:
schedule:
- cron: '00 00 * * *'

jobs:
CompatHelper:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.2.0]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
11 changes: 11 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
/deps/deps.jl
/docs/build
Manifest.toml
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Documentation: http://docs.travis-ci.com/user/languages/julia/
language: julia
dist: xenial
os:
- linux
- osx
julia:
- 1.0
- 1.3
- 1.4
- nightly
notifications:
email: false
git:
depth: 99999999

jobs:
## uncomment following lines to deploy documentation
include:
- stage: "Documentation"
julia: 1.3
os: linux
script:
- julia --project=docs -e 'using Pkg; Pkg.instantiate(); Pkg.develop(PackageSpec(path=pwd()))'
- julia --project=docs --color=yes docs/make.jl
after_success: skip
allow_failures:
- julia: nightly
after_success:
- julia --project=test/coverage -e 'using Pkg; Pkg.instantiate()'
- julia --project=test/coverage test/coverage/coverage.jl
22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The Bitly.jl package is licensed under the MIT "Expat" License:

> Copyright (c) 2020: Tyler Beason.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
>
21 changes: 21 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name = "Bitly"
uuid = "d31eeb2a-31cb-4547-bb55-7986690be42f"
authors = ["Tyler Beason <[email protected]>"]
version = "0.1.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[compat]
HTTP = ">=0.8, <1"
JSON = ">=0.18, <1"
julia = "^1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Bitly.jl

![Lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)<!--
![Lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)
![Lifecycle](https://img.shields.io/badge/lifecycle-stable-green.svg)
![Lifecycle](https://img.shields.io/badge/lifecycle-retired-orange.svg)
![Lifecycle](https://img.shields.io/badge/lifecycle-archived-red.svg)
![Lifecycle](https://img.shields.io/badge/lifecycle-dormant-blue.svg) -->
[![Build Status](https://travis-ci.com/tbeason/Bitly.jl.svg?branch=master)](https://travis-ci.com/tbeason/Bitly.jl)
[![codecov.io](http://codecov.io/github/tbeason/Bitly.jl/coverage.svg?branch=master)](http://codecov.io/github/tbeason/Bitly.jl?branch=master)
[![Documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://tbeason.github.io/Bitly.jl/stable)
[![Documentation](https://img.shields.io/badge/docs-dev-blue.svg)](https://tbeason.github.io/Bitly.jl/dev)



[Bitly.jl](https://github.com/tbeason/Bitly.jl) is a Julia package for accessing the [Bitly API](https://dev.bitly.com). [Bitly](https://bitly.com) is a popular link shortening service.


## Preview

Right now the package implements only basic methods associated with the service:
- obtaining token via `requestBitlyToken`
- link shortening via `shorten`
- link expansion via `expand`
- click statistics via `clicks`

I am open to pull requests that extend or improve existing features.
3 changes: 3 additions & 0 deletions docs/Bitly/docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
Bitly = "d31eeb2a-31cb-4547-bb55-7986690be42f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
5 changes: 5 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Documenter = "~0.24"
17 changes: 17 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Documenter, Bitly

makedocs(
modules = [Bitly],
format = Documenter.HTML(; prettyurls = get(ENV, "CI", nothing) == "true"),
authors = "Tyler Beason",
sitename = "Bitly.jl",
pages = Any["Main" => "index.md"]
# strict = true,
# clean = true,
# checkdocs = :exports,
)

deploydocs(
repo = "github.com/tbeason/Bitly.jl.git",
push_preview = true
)
79 changes: 79 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Bitly.jl

[Bitly.jl](https://github.com/tbeason/Bitly.jl) is a Julia package for accessing the [Bitly API](https://dev.bitly.com). [Bitly](https://bitly.com) is a popular link shortening service.


## Example

```julia
b = BitlyToken() # loads API Key
S = shorten(b,"https://docs.julialang.org/en/v1/")
S.link # is http://bit.ly/2Us5Vl7
```

## API Key

Accessing the API requires obtaining a Generic Access Token.

1. You can log on to your Bitly account to generate a Generic Access Token.
2. You can use the `requestBitlyToken(username,password)` function to do the same.

```@docs
requestBitlyToken
```

### Saving the Access Token

The access token does not automatically persist across sessions. You need to save it (using one of two methods) if you would like it to do so.

#### ENV variable

From the Julia REPL, just do
```julia
ENV["BITLY_ACCESS_TOKEN"] = "yourbitlykey"
```

#### Key file

In the file `~/.bitlyrc`, store the key by itself.

```julia
keyfile = "~/.bitlyrc"
open(keyfile,"w") do file
println(file,"yourbitlykey")
end
```


### Using the Access Token

Create an instance of `BitlyToken` either by passing the key in as an argument or it will look for it in the appropriate environment variable or file.

```@docs
BitlyToken
```

## Link Shortening

You have an ugly long link and want a short one?

```@docs
shorten
```

## Link Expansion

You have a short uninformative link and want the long one?

```@docs
expand
```

## Link Clicks

Let's be real. Nobody is clicking your links. Here is how to prove it.

```@docs
clicks
```

Loading

0 comments on commit e58f9b7

Please sign in to comment.