{"id":15512291,"url":"https://github.com/siteleaf/siteleaf-gem","last_synced_at":"2025-04-07T09:23:34.181Z","repository":{"id":8513724,"uuid":"10126355","full_name":"siteleaf/siteleaf-gem","owner":"siteleaf","description":"Command-line interface (CLI) and Ruby interface for the Siteleaf API","archived":false,"fork":false,"pushed_at":"2023-11-21T13:55:23.000Z","size":140,"stargazers_count":77,"open_issues_count":1,"forks_count":12,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-24T17:06:11.389Z","etag":null,"topics":["api-client","cli","gem","ruby","ruby-gem","siteleaf","siteleaf-api"],"latest_commit_sha":null,"homepage":"http://siteleaf.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/siteleaf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-05-17T15:30:35.000Z","updated_at":"2024-06-20T18:57:21.437Z","dependencies_parsed_at":"2024-06-20T18:57:17.448Z","dependency_job_id":null,"html_url":"https://github.com/siteleaf/siteleaf-gem","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siteleaf%2Fsiteleaf-gem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siteleaf%2Fsiteleaf-gem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siteleaf%2Fsiteleaf-gem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siteleaf%2Fsiteleaf-gem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siteleaf","download_url":"https://codeload.github.com/siteleaf/siteleaf-gem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247623517,"owners_count":20968697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","cli","gem","ruby","ruby-gem","siteleaf","siteleaf-api"],"created_at":"2024-10-02T09:53:34.509Z","updated_at":"2025-04-07T09:23:34.148Z","avatar_url":"https://github.com/siteleaf.png","language":"Ruby","readme":"\u003cimg alt=\"Siteleaf\" src=\"https://learn.siteleaf.com/assets/images/logo.svg\" width=\"10%\"\u003e\n\nSiteleaf v2 Gem \u0026 CLI\n=====================\n\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Using the CLI](#using-the-cli)\n- [Using this gem in your application](#using-this-gem-in-your-application)\n- [Using the API](#using-the-api)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n\n\nPrerequisites\n-------------\n\nInstall Ruby and RubyGems: https://jekyllrb.com/docs/installation/\n\n\nInstallation\n------------\n\nThe [Siteleaf](https://www.siteleaf.com) gem is available for installation on [RubyGems](https://rubygems.org/gems/siteleaf). To install run:\n\n    gem install siteleaf\n    \n**Note:** the v2 gem only works with v2 sites. For documentation on v1 see: https://github.com/siteleaf/siteleaf-gem/tree/v1\n\nIf maintaining sites with multiple versions, we recommend using a [Gemfile](#using-this-gem-in-your-application).\n\n\nUsing the CLI\n-------------\n\nImportant: if using a Gemfile, make sure to prepend all commands with `bundle exec` (e.g. `bundle exec siteleaf auth`).\n\n**Authorize your account:**\n\n    siteleaf auth\n    \nThis will create an authorization file located at `~/.siteleaf.yml`. \n\nAlternatively, you can also use environment variables: `SITELEAF_API_KEY=xxx SITELEAF_API_SECRET=yyy siteleaf command`\n\nYou can also include use a `.siteleaf.yml` file in the root of your project:\n\n```yaml\n---\napi_key: xxx\napi_secret: yyy\nsite_id: zzz\n```\n\n**Set up a new site locally:**\n\n    siteleaf new yoursite.com\n\nThis will create a new theme folder called `yoursite.com` in the directory where you ran this command. It will also create the site for you in your Siteleaf account. If you prefer not to create a new directory, run `siteleaf new yoursite.com .` instead.\n\n**Configure an existing site:**\n\n    siteleaf config yoursite.com\n\n**Upload your files:**\n\nTo upload your theme to Siteleaf, run the following command:\n\n    siteleaf push\n    \n**Download your files:**\n\nTo download your theme (or the default theme for new sites) from Siteleaf, run the following command:\n\n    siteleaf pull\n    \n**Publish your site:**\n\nTo publish your site changes to your hosting provider, run the following command:\n\n    siteleaf publish\n\n**Clean unused uploads:**\n\nTo check for unused uploads and tidy up disk space (runs locally using [The Silver Searcher](https://geoff.greer.fm/ag/) if available):\n\n    siteleaf clean _uploads\n    \n**For a full list of commands, run:**\n\n    siteleaf help\n\n\nUsing this gem in your application\n----------------------------------\n    \nTo use this gem in your application, add the following to your Gemfile:\n\n    gem 'siteleaf', '~\u003e2'\n\n\nUsing the API\n-------------\n\nThis gem also allows you to interact with the [Siteleaf API](https://github.com/siteleaf/siteleaf-api).\n\n```ruby\nrequire 'siteleaf'\n\n# authentication\nSiteleaf.api_key    = 'KEY'\nSiteleaf.api_secret = 'SECRET'\n\n# get authenticated user\nme = Siteleaf::User.find('me')\n\n# get all sites\nsites = Siteleaf::Site.all\n\n# create new site\nsite = Siteleaf::Site.create({\n  :title    =\u003e 'My Website',\n  :domain   =\u003e 'mywebsite.com'\n})\n\n# get site by id\nsite = Siteleaf::Site.find('5196f137cc8591956b000001')\n\n# update site\nsite.title = 'New Title'\nsite.save\n\n# publish site\nsite.publish\n\n# delete site\nsite.delete\n\n# get all pages in site\npages = site.pages\n\n# create new page in site\npage = Siteleaf::Page.create({\n  :title    =\u003e 'My Page',\n  :body     =\u003e 'This is my first page.',\n  :site_id  =\u003e site.id\n})\n\n# get page by id\npage = Siteleaf::Page.find('519719ddcc85910626000001')\n\n# delete page by id\nSiteleaf::Page.delete('519719ddcc85910626000001')\n\n# get posts\nposts = site.posts # or Collection.new(path: 'posts', site_id: site.id).documents\n\n# create new post\npost = Siteleaf::Documents.create({\n  :title            =\u003e 'My Post',\n  :body             =\u003e 'This is my first post.',\n  :collection_path  =\u003e 'posts',\n  :site_id          =\u003e site.id\n})\n\n# update post, add metadata\npost.title = 'New Title'\npost.metadata = {'foo' =\u003e 'bar'}\npost.save\n\n# delete post\npost.delete\n\n# get files in \"uploads\" collection\nfiles = site.uploads # or Collection.new(path: 'uploads', site_id: site.id).files\n\n# upload image into \"uploads\" collection\nfile = Siteleaf::File.create({\n  :file             =\u003e File.new('~/image.png'), \n  :path             =\u003e 'image.png'\n  :collection_path  =\u003e 'uploads',\n  :site_id          =\u003e site.id\n})\n\n# get source files\nfiles = site.source_files\n\n# upload source file\nfile = Siteleaf::SourceFile.create({\n  :file     =\u003e File.new('~/foo.html'), \n  :name     =\u003e '_includes/foo.html',\n  :site_id  =\u003e site.id\n})\n\n# delete file\nfile.delete\n\n# delete file by name\nSiteleaf::SourceFile.new(name: '_includes/foo.html', site_id: site.id).delete\n\n```\n\nTroubleshooting\n------------\n\n**I can't install the Gem**\n\nTry running:\n\n    sudo gem install siteleaf\n\n\nContributing\n------------\n\nHelp us improve this gem:\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiteleaf%2Fsiteleaf-gem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiteleaf%2Fsiteleaf-gem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiteleaf%2Fsiteleaf-gem/lists"}