octokitchen 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 765c58c9e2e427934a184640588e7233356bd76e
4
+ data.tar.gz: d1fc6b027fdd21e1fed014585aca7d70c41f2def
5
+ SHA512:
6
+ metadata.gz: d1c03beb73edb468452ddc3c35250b2f00073d47a4173601ce2e7a2672ff7767140886a3c2ff7355e64c3933b2e71f7d3dab71b9ab8263e6d44824eaa61fd0b1
7
+ data.tar.gz: f7c1fb72efc7e92e94acedf4fa5c318a9e3ed0c5772e341e03971055c1ef4160af70d5b8d90abbab50dd517229db64694b3ff464ef8e43c5c3d75428cd0e1f55
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in octokitchen.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Kyle Macey
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Octokitchen
2
+
3
+ Octokitchen is a nifty little utility for writing small scripts for GitHub!
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'octokitchen'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install octokitchen
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kylemacey/octokitchen. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
34
+
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "octokitchen"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/octokitchen ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "octokitchen"
5
+
6
+ Octokitchen::Generator.start(ARGV, banner: 'octokitchen')
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,80 @@
1
+ require 'thor'
2
+ require 'pry'
3
+
4
+ module Octokitchen
5
+ class Generator < Thor::Group
6
+ include Thor::Actions
7
+
8
+
9
+ def self.banner; 'octokitchen [OPTIONS] <NAME> [<DIRECTORY>]'; end
10
+
11
+ argument :name, default: ""
12
+ argument :path, default: ""
13
+ class_option :gemfile, type: "boolean", default: false, desc: "Whether or not the script should use a Gemfile, defaults to `no-gemfile`", aliases: "-g"
14
+ class_option :dependencies, desc: "comma-separated list of dependencies"
15
+ class_option :command, desc: "What the name of the command/filename should be. Defaults to an underscored version of the script name."
16
+
17
+
18
+ desc "Generate a new GitHub script"
19
+
20
+ def setup
21
+ unless name[/\w+/]
22
+ Generator.help(shell)
23
+ exit
24
+ end
25
+ @directory = directory
26
+ @filename = [(options[:command] || underscore(name)), 'rb'].join('.')
27
+ @dependencies = options[:dependencies].to_s.split(',').unshift('octokit')
28
+ @git_info = git_info
29
+ end
30
+
31
+ def new_script
32
+ template('templates/new_script.tt', "#{@directory}/#{@filename}")
33
+ end
34
+
35
+ def new_readme
36
+ template('templates/new_readme.tt', "#{@directory}/README.md")
37
+ end
38
+
39
+ def new_gemfile
40
+ if options[:gemfile]
41
+ template('templates/new_gemfile.tt', "#{@directory}/Gemfile")
42
+ end
43
+ end
44
+
45
+ private
46
+
47
+ def directory
48
+ path[/\w+/] ? path : underscore(name)
49
+ end
50
+
51
+ def self.source_root
52
+ File.dirname(__FILE__)
53
+ end
54
+
55
+ def underscore(str)
56
+ str.gsub(/\W/, '_').downcase
57
+ end
58
+
59
+ def git_info
60
+ if use_git?
61
+ {
62
+ git_path: git_path,
63
+ git_origin_url: git_origin_url
64
+ }
65
+ end
66
+ end
67
+
68
+ def use_git?
69
+ system('which git && git rev-parse')
70
+ end
71
+
72
+ def git_path
73
+ `git rev-parse --show-prefix`.strip
74
+ end
75
+
76
+ def git_origin_url
77
+ `git config --get remote.origin.url`.strip
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ <%= @dependencies.map { |d| "gem \"#{d}\"\n" }.join %>
@@ -0,0 +1,46 @@
1
+ # <%= name %>
2
+
3
+ TODO: Add a summary of the script
4
+
5
+ ## Installation
6
+
7
+ <% if @git_info %>
8
+ ### Clone this repository
9
+
10
+ ```shell
11
+ git clone <%= @git_info[:git_origin_url] %>
12
+ cd <%= [@git_info[:git_path], @directory].join %>
13
+ ```
14
+ <% else %>
15
+ ### Enter into the command directory
16
+
17
+ ```shell
18
+ cd <%= @directory %>
19
+ ```
20
+ <% end %>
21
+
22
+ ### Install dependencies
23
+ <% if options[:gemfile] %>
24
+ ```shell
25
+ bundle install
26
+ ```
27
+ <% else %>
28
+ ```shell
29
+ gem install <%= @dependencies.join(' ') %>
30
+ ```
31
+ <% end %>
32
+
33
+ ## Usage
34
+
35
+ ### Configure Octokit
36
+
37
+ ```shell
38
+ export OCTOKIT_API_ENDPOINT="https://github.example.com/api/v3" # Default: "https://api.github.com"
39
+ export OCTOKIT_ACCESS_TOKEN=00000000000000000000000
40
+ ```
41
+
42
+ ### Execute
43
+
44
+ ```shell
45
+ ruby <%= @filename %>
46
+ ```
@@ -0,0 +1,5 @@
1
+ # <%= name %> - Generated with Octokitchen https://github.com/kylemacey/octokitchen
2
+ <% unless options[:gemfile] %>
3
+ # Dependencies
4
+ <%= @dependencies.map { |d| "require \"#{d}\"\n" }.join %>
5
+ <% end %>
@@ -0,0 +1,3 @@
1
+ module Octokitchen
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "octokitchen/version"
2
+ require "octokitchen/generator"
3
+
4
+ module Octokitchen
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'octokitchen/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "octokitchen"
8
+ spec.version = Octokitchen::VERSION
9
+ spec.authors = ["Kyle Macey"]
10
+ spec.email = ["kylemacey@github.com"]
11
+
12
+ spec.summary = %q{A utility to help write scripts for GitHub}
13
+ spec.description = %q{A utility to help write scripts for GitHub}
14
+ spec.homepage = "https://github.com/kylemacey/octokitchen"
15
+ spec.license = "MIT"
16
+
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "bin"
20
+ spec.executables = ["octokitchen"]
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_dependency "octokit", "~> 4.0"
26
+ spec.add_dependency "thor", "~> 0.19.1"
27
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octokitchen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kyle Macey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: octokit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.19.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.19.1
69
+ description: A utility to help write scripts for GitHub
70
+ email:
71
+ - kylemacey@github.com
72
+ executables:
73
+ - octokitchen
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - CODE_OF_CONDUCT.md
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/octokitchen
85
+ - bin/setup
86
+ - lib/octokitchen.rb
87
+ - lib/octokitchen/generator.rb
88
+ - lib/octokitchen/templates/new_gemfile.tt
89
+ - lib/octokitchen/templates/new_readme.tt
90
+ - lib/octokitchen/templates/new_script.tt
91
+ - lib/octokitchen/version.rb
92
+ - octokitchen.gemspec
93
+ homepage: https://github.com/kylemacey/octokitchen
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.4.6
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: A utility to help write scripts for GitHub
117
+ test_files: []