diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..ef538c2 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.1.2 diff --git a/Gemfile b/Gemfile index 9b5052f..25fd24c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ -source 'https://rubygems.org' -gem 'sinatra' - -gem 'githubchart' +source 'http://rubygems.org' +ruby ">= 2.7" +gem 'sinatra', '~> 1.4.6' +gem 'githubchart', '>= 4.0.0' +gem 'webrick' diff --git a/Gemfile.lock b/Gemfile.lock index b1b69d8..449b903 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,18 +1,20 @@ GEM - remote: https://rubygems.org/ + remote: http://rubygems.org/ specs: basiccache (1.0.0) - curb (0.8.8) - githubchart (1.0.1) - githubstats (~> 1.1.0) - svgplot (~> 0.2.0) - githubstats (1.1.0) + githubchart (4.0.0) + githubstats (~> 4.0.1) + matrix (~> 0.4.2) + svgplot (~> 1.0.0) + githubstats (4.0.1) basiccache (~> 1.0.0) - curb (~> 0.8.6) - nokogiri (~> 1.6.5) - mini_portile (0.6.2) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) + nokogiri (~> 1.15.3) + matrix (0.4.2) + mini_portile2 (2.8.4) + nokogiri (1.15.3) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + racc (1.7.1) rack (1.6.4) rack-protection (1.5.3) rack @@ -20,15 +22,20 @@ GEM rack (~> 1.4) rack-protection (~> 1.4) tilt (>= 1.3, < 3) - svgplot (0.2.0) + svgplot (1.0.0) tilt (2.0.1) + webrick (1.8.1) PLATFORMS ruby DEPENDENCIES - githubchart - sinatra + githubchart (>= 4.0.0) + sinatra (~> 1.4.6) + webrick + +RUBY VERSION + ruby 3.1.2p20 BUNDLED WITH - 1.10.6 + 1.17.3 diff --git a/README.md b/README.md index 733eeb2..ecb300a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# [Github Chart API](http://ghchart.rshah.org) +# [Github Chart API](https://ghchart.rshah.org) Make this: -![2016rshah's Github chart](http://ghchart.rshah.org/2016rshah) +![2016rshah's Github chart](https://ghchart.rshah.org/2016rshah) with this: - 2016rshah's Github chart + 2016rshah's Github chart Of course you can replace `2016rshah` with your own github username. @@ -14,25 +14,29 @@ Of course you can replace `2016rshah` with your own github username. Being able to look back through the year and see how productive you've been is a great feeling, and that little green calendar is honestly one of my favorite data visualizations. But there's no reason it should be constrained to only living on the github website, you should be able to put it anywhere you want! -For example, I personally think it would really spiff up a [personal website](http://www.rshah.org/). +For example, I personally think it would really spiff up a [personal website](https://www.rshah.org/). # Color Schemes -We also support custom color schemes! You can provide any base color and we will make shades for the chart. Just visit `http://ghchart.rshah.org//2016rshah` and replace `` with your hex color code, not including the leading hashtag. For example if you want a blue-themed chart that is based around the hex color `#409ba5`, you can visit the following route: +We also support custom color schemes! You can provide any base color and we will make shades for the chart. Just visit `https://ghchart.rshah.org//2016rshah` and replace `` with your hex color code, not including the leading hashtag. For example if you want a blue-themed chart that is based around the hex color `#409ba5`, you can visit the following route: - 2016rshah's Blue Github Chart + 2016rshah's Blue Github Chart -![2016rshah's Blue Github Chart](http://ghchart.rshah.org/409ba5/2016rshah) +![2016rshah's Blue Github Chart](https://ghchart.rshah.org/409ba5/2016rshah) # Contributing If you see anything that can be improved send in an issue/PR. +To get the code up and running, make sure ruby, etc. is properly installed, then run `bundle install`, then run `ruby app.rb` and visit `localhost:4567` in your browser. + +To deploy, make sure heroku cli is installed, login, add the heroku remote, and run `git push heroku master`. + # See also The [github repo](https://github.com/2016rshah/githubchart-api) -The [actual site](http://ghchart.rshah.org) +The [actual site](https://ghchart.rshah.org) This [ruby gem](https://github.com/akerl/githubchart) diff --git a/app.rb b/app.rb index 84b9f0c..dd7fbdd 100644 --- a/app.rb +++ b/app.rb @@ -18,7 +18,7 @@ headers 'Cache-Control' => "max-age=#{60*60*24}" username = params[:username].chomp('.svg') #Chomp off the .svg extension to be backwards compatible - svg = GithubChart.new(user: username).svg + svg = GithubChart.new(user: username).render('svg') stream do |out| out << svg end @@ -39,7 +39,7 @@ scheme = ['#EEEEEE', lighten_color(base_color, 0.3), lighten_color(base_color, 0.2), base_color, darken_color(base_color, 0.8)] end - svg = GithubChart.new(user: username, colors: scheme).svg + svg = GithubChart.new(user: username, colors: scheme).render('svg') stream do |out| out << svg end