nutrella 0.4.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 +7 -0
- data/.codeclimate.yml +21 -0
- data/.envrc +2 -0
- data/.gitignore +6 -0
- data/.rspec +4 -0
- data/.rubocop.yml +25 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/NOTES.md +9 -0
- data/README.md +70 -0
- data/Rakefile +15 -0
- data/bin/console +14 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/rubocop +16 -0
- data/bin/setup +8 -0
- data/exe/nutrella +7 -0
- data/lib/nutrella.rb +16 -0
- data/lib/nutrella/cache.rb +45 -0
- data/lib/nutrella/command.rb +36 -0
- data/lib/nutrella/configuration.rb +69 -0
- data/lib/nutrella/developer_keys.rb +16 -0
- data/lib/nutrella/task_board.rb +45 -0
- data/lib/nutrella/task_board_name.rb +14 -0
- data/lib/nutrella/version.rb +3 -0
- data/nutrella.gemspec +34 -0
- metadata +213 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f7804d1e8d55d622cb20a10c89a4e35e85435945
|
4
|
+
data.tar.gz: ec18465953f54a78208d74927764bfaa285d54a8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2e80675f71b18ee89a56d1f8b3805899bb1bf86e63020c1da09994a9d674605aee629df0acb97876f7b6a698267b5963884c1a1019e77a10fb8c854d93f6691b
|
7
|
+
data.tar.gz: 0680c605e01040ccadff4909ffd9d677cac4d069863509c8d5de368c975db26e5c7a8b9f5867bca4b82c574974eb6b55dcf178b997e541fef50795a999b0f9f7
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
engines:
|
3
|
+
duplication:
|
4
|
+
enabled: true
|
5
|
+
config:
|
6
|
+
languages:
|
7
|
+
- ruby
|
8
|
+
fixme:
|
9
|
+
enabled: true
|
10
|
+
rubocop:
|
11
|
+
enabled: true
|
12
|
+
checks:
|
13
|
+
Rubocop/Rails/Output:
|
14
|
+
enabled: false
|
15
|
+
reek:
|
16
|
+
enabled: true
|
17
|
+
ratings:
|
18
|
+
paths:
|
19
|
+
- "**.rb"
|
20
|
+
exclude_paths:
|
21
|
+
- spec/**/*
|
data/.envrc
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.1
|
3
|
+
|
4
|
+
Exclude:
|
5
|
+
- 'bin/**/*'
|
6
|
+
|
7
|
+
Metrics/LineLength:
|
8
|
+
Max: 120
|
9
|
+
|
10
|
+
# We like to use the hash rocket in rake files.
|
11
|
+
Style/HashSyntax:
|
12
|
+
Exclude:
|
13
|
+
- 'Rakefile'
|
14
|
+
|
15
|
+
# We'll just use double quotes everywhere.
|
16
|
+
Style/StringLiterals:
|
17
|
+
EnforcedStyle: double_quotes
|
18
|
+
|
19
|
+
# We are not going to optimize by freezing strings.
|
20
|
+
Style/MutableConstant:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
# We are not going to distinguish between fail and raise.
|
24
|
+
Style/SignalException:
|
25
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.4
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at alistairm@nulogy.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Alistair McKinnell
|
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/NOTES.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Nutrella
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/nutrella)
|
4
|
+
[](https://codeclimate.com/github/amckinnell/nutrella)
|
5
|
+
|
6
|
+
A command line tool for creating a Trello board based on the current git branch.
|
7
|
+
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
**Step 1**: Install gem
|
12
|
+
|
13
|
+
$ gem install nutrella
|
14
|
+
|
15
|
+
**Step 2**: Create configuration file
|
16
|
+
|
17
|
+
$ nutrella
|
18
|
+
|
19
|
+
**Step 3**: Get key and secret
|
20
|
+
|
21
|
+
$ irb -rubygems
|
22
|
+
irb> require 'nutrella'
|
23
|
+
irb> Nutrella.open_public_key_url
|
24
|
+
|
25
|
+
Insert your `key` and `secret` into your `~/.nutrella.yml` file.
|
26
|
+
|
27
|
+
**Step 4**: Get token
|
28
|
+
|
29
|
+
irb> Nutrella.open_authorization_url key: '<your_public_key_from_step_3>'
|
30
|
+
|
31
|
+
Insert your `token` into your `~/.nutrella.yml` file.
|
32
|
+
|
33
|
+
**Step 5**: Update configuration file
|
34
|
+
|
35
|
+
If your haven't already done so, insert your `key`, `secret`, and `token` into your `~/.nutrella.yml` file.
|
36
|
+
|
37
|
+
The configuration file should look like the following (don't use the keys below, they won't work) :
|
38
|
+
|
39
|
+
# Trello Developer API Keys
|
40
|
+
key: c2fc703429da08b6e7dcb0a878e35564
|
41
|
+
secret: 7fd865f372891afa93aabdb6b836254bcda10c8a320def2b3207e2ffb425bc0a
|
42
|
+
token: 4c13558cbafdcb4765103a195e05b0476f3b3f7f3efc83f2a810fb769f4ae2d6
|
43
|
+
|
44
|
+
# Optional Configuration
|
45
|
+
organization: 542d76ac2fad4697c3e80448
|
46
|
+
|
47
|
+
|
48
|
+
## Usage
|
49
|
+
|
50
|
+
Create or open a Trello board based on the name of the current git branch:
|
51
|
+
|
52
|
+
$ nutrella
|
53
|
+
|
54
|
+
|
55
|
+
## Origin of Name
|
56
|
+
|
57
|
+
Nutrella is a [portmanteau](https://en.wikipedia.org/wiki/Portmanteau) that combines these three words:
|
58
|
+
[Nulogy](http://nulogy.com/), [Trello](http://trello.com/), and [Nutella](http://www.nutella.com/).
|
59
|
+
|
60
|
+
|
61
|
+
## Contributing
|
62
|
+
|
63
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/amckinnell/nutrella.
|
64
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are
|
65
|
+
expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
66
|
+
|
67
|
+
|
68
|
+
## License
|
69
|
+
|
70
|
+
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,15 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require "rubocop/rake_task"
|
4
|
+
|
5
|
+
RuboCop::RakeTask.new
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task(:backup_configuration) { system "cp ~/.nutrella.yml ~/.nutrella.yml.bak" }
|
9
|
+
task(:restore_configuration) { system "cp ~/.nutrella.yml.bak ~/.nutrella.yml" }
|
10
|
+
|
11
|
+
task(:remove_cache) { system "rm ~/.nutrella.cache.yml" }
|
12
|
+
task(:remove_configuration) { system "rm ~/.nutrella.yml" }
|
13
|
+
task(:local_install) { system "gem uninstall nutrella -ax && rubocop -a && rake install" }
|
14
|
+
|
15
|
+
task :default => [:rubocop, :spec]
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "nutrella"
|
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/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
|
+
|
16
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
|
+
|
16
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/rubocop
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rubocop' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
|
+
|
16
|
+
load Gem.bin_path("rubocop", "rubocop")
|
data/bin/setup
ADDED
data/exe/nutrella
ADDED
data/lib/nutrella.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "active_support/core_ext/string"
|
2
|
+
|
3
|
+
require "nutrella/cache"
|
4
|
+
require "nutrella/command"
|
5
|
+
require "nutrella/configuration"
|
6
|
+
require "nutrella/developer_keys"
|
7
|
+
require "nutrella/task_board"
|
8
|
+
require "nutrella/task_board_name"
|
9
|
+
require "nutrella/version"
|
10
|
+
|
11
|
+
#
|
12
|
+
# A command line tool for creating a Trello Board based on the current git branch.
|
13
|
+
#
|
14
|
+
module Nutrella
|
15
|
+
extend DeveloperKeys
|
16
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
module Nutrella
|
4
|
+
#
|
5
|
+
# Provides a cache of the most recently used items.
|
6
|
+
#
|
7
|
+
class Cache
|
8
|
+
attr_reader :capacity, :path
|
9
|
+
|
10
|
+
def initialize(path, capacity)
|
11
|
+
@path = path
|
12
|
+
@capacity = capacity
|
13
|
+
end
|
14
|
+
|
15
|
+
def fetch(key)
|
16
|
+
value = lookup(key) || yield
|
17
|
+
write(key, value)
|
18
|
+
value
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def lookup(key)
|
24
|
+
cache_contents.find { |k, _v| k == key }.last
|
25
|
+
rescue
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def write(key, value)
|
30
|
+
File.write(path, cached_entries(key, value).to_yaml)
|
31
|
+
end
|
32
|
+
|
33
|
+
def cached_entries(key, value)
|
34
|
+
entries = cache_contents.reject { |k, _v| k == key }
|
35
|
+
|
36
|
+
[[key, value]].concat(entries).take(capacity)
|
37
|
+
rescue
|
38
|
+
[[key, value]]
|
39
|
+
end
|
40
|
+
|
41
|
+
def cache_contents
|
42
|
+
@cache_contents ||= YAML.load_file(path)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Nutrella
|
2
|
+
#
|
3
|
+
# This is the top-level class for the gem.
|
4
|
+
#
|
5
|
+
class Command
|
6
|
+
attr_reader :cache_filename, :configuration_filename
|
7
|
+
|
8
|
+
def initialize(configuration_directory, board_name)
|
9
|
+
@board_name = board_name
|
10
|
+
@cache_filename = File.join(configuration_directory, ".nutrella.cache.yml")
|
11
|
+
@configuration_filename = File.join(configuration_directory, ".nutrella.yml")
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
open board_url
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def board_url
|
21
|
+
url_cache.fetch(@board_name) { task_board.lookup_or_create(@board_name).url }
|
22
|
+
end
|
23
|
+
|
24
|
+
def open(url)
|
25
|
+
system("open #{url}")
|
26
|
+
end
|
27
|
+
|
28
|
+
def task_board
|
29
|
+
TaskBoard.new(Configuration.values(configuration_filename))
|
30
|
+
end
|
31
|
+
|
32
|
+
def url_cache
|
33
|
+
Cache.new(cache_filename, 5)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
module Nutrella
|
4
|
+
#
|
5
|
+
# Knows the location and format of the configuration.
|
6
|
+
#
|
7
|
+
class Configuration
|
8
|
+
NULOGY_ORGANIZATION_ID = "542d76ac2fad4697c3e80448"
|
9
|
+
|
10
|
+
INITIAL_CONFIGURATION = <<-YAML.strip_heredoc
|
11
|
+
# Trello Developer API Keys
|
12
|
+
key: <your developer key>
|
13
|
+
secret: <your developer secret>
|
14
|
+
token: <your developer token>
|
15
|
+
|
16
|
+
# Optional Configuration
|
17
|
+
organization: #{NULOGY_ORGANIZATION_ID}
|
18
|
+
YAML
|
19
|
+
|
20
|
+
attr_reader :path, :values
|
21
|
+
|
22
|
+
def self.values(path)
|
23
|
+
new(path).values
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(path)
|
27
|
+
@path = path
|
28
|
+
|
29
|
+
load_configuration unless configuration_missing?
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def load_configuration
|
35
|
+
configuration = YAML.load_file(path)
|
36
|
+
|
37
|
+
@values = {
|
38
|
+
key: configuration.fetch("key"),
|
39
|
+
secret: configuration.fetch("secret"),
|
40
|
+
token: configuration.fetch("token"),
|
41
|
+
organization: configuration.fetch("organization", NULOGY_ORGANIZATION_ID)
|
42
|
+
}
|
43
|
+
rescue => e
|
44
|
+
abort "#{path} #{e}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def configuration_missing?
|
48
|
+
return false if File.exist?(path)
|
49
|
+
|
50
|
+
write_initial_configuration
|
51
|
+
abort configuration_missing_message
|
52
|
+
end
|
53
|
+
|
54
|
+
def write_initial_configuration
|
55
|
+
File.write(path, INITIAL_CONFIGURATION)
|
56
|
+
end
|
57
|
+
|
58
|
+
def configuration_missing_message
|
59
|
+
<<-TEXT.strip_heredoc
|
60
|
+
I see that you don't have a config file '#{path}'.
|
61
|
+
So, I created one for you.
|
62
|
+
|
63
|
+
You still need to enter your Trello API keys into the config file.
|
64
|
+
|
65
|
+
See https://github.com/amckinnell/nutrella for instructions.
|
66
|
+
TEXT
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "trello"
|
2
|
+
|
3
|
+
module Nutrella
|
4
|
+
#
|
5
|
+
# Utilities to allow a user to obtain their Trello API developer keys.
|
6
|
+
#
|
7
|
+
module DeveloperKeys
|
8
|
+
def open_public_key_url
|
9
|
+
Trello.open_public_key_url
|
10
|
+
end
|
11
|
+
|
12
|
+
def open_authorization_url(options = {})
|
13
|
+
Trello.open_authorization_url(options.merge(name: "Nutrella"))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require "trello"
|
2
|
+
|
3
|
+
module Nutrella
|
4
|
+
#
|
5
|
+
# Knows how to use the Trello API to create and lookup task boards.
|
6
|
+
#
|
7
|
+
class TaskBoard
|
8
|
+
def initialize(configuration)
|
9
|
+
Trello.configure do |trello_client|
|
10
|
+
trello_client.consumer_key = configuration.fetch(:key)
|
11
|
+
trello_client.consumer_secret = configuration.fetch(:secret)
|
12
|
+
trello_client.oauth_token = configuration.fetch(:token)
|
13
|
+
trello_client.oauth_token_secret = configuration.fetch(:secret)
|
14
|
+
end
|
15
|
+
|
16
|
+
@organization = configuration.fetch(:organization)
|
17
|
+
end
|
18
|
+
|
19
|
+
def lookup_or_create(board_name)
|
20
|
+
lookup(board_name) || create(board_name)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def lookup(board_name)
|
26
|
+
matching_boards(board_name).find { |board| board.name == board_name }
|
27
|
+
end
|
28
|
+
|
29
|
+
def matching_boards(board_name)
|
30
|
+
Trello::Action.search(board_name, modelTypes: "boards", board_fields: "all").fetch("boards", [])
|
31
|
+
end
|
32
|
+
|
33
|
+
def create(board_name)
|
34
|
+
create_board(board_name).tap { |board| make_team_visible(board) }
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_board(board_name)
|
38
|
+
Trello::Board.create(name: board_name, organization_id: @organization)
|
39
|
+
end
|
40
|
+
|
41
|
+
def make_team_visible(board)
|
42
|
+
Trello.client.put("/boards/#{board.id}", "prefs/permissionLevel=org")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "git"
|
2
|
+
|
3
|
+
module Nutrella
|
4
|
+
#
|
5
|
+
# Knows the name of the task board associated with the current git branch.
|
6
|
+
#
|
7
|
+
module TaskBoardName
|
8
|
+
def self.from_git_branch(working_dir = ".")
|
9
|
+
Git.open(working_dir).current_branch.titleize
|
10
|
+
rescue
|
11
|
+
abort "Sorry. Can't find an associated git branch here."
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/nutrella.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "nutrella/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "nutrella"
|
8
|
+
spec.version = Nutrella::VERSION
|
9
|
+
spec.authors = ["Alistair McKinnell"]
|
10
|
+
spec.email = ["alistair.mckinnell@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "A command line tool for creating a Trello Board based on the current git branch."
|
13
|
+
spec.homepage = "https://github.com/amckinnell/nutrella"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.required_ruby_version = "~> 2.1"
|
22
|
+
|
23
|
+
spec.add_runtime_dependency "activesupport", "~> 4.2.5"
|
24
|
+
spec.add_runtime_dependency "git", "~> 1.2"
|
25
|
+
spec.add_runtime_dependency "ruby-trello", "~> 1.4"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
28
|
+
spec.add_development_dependency "httplog", "~> 0.3"
|
29
|
+
spec.add_development_dependency "mutant-rspec", "~> 0.8"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
spec.add_development_dependency "rubocop", "~> 0.37"
|
33
|
+
spec.add_development_dependency "simplecov", "~> 0.11"
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nutrella
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alistair McKinnell
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: git
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby-trello
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.11'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.11'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: httplog
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mutant-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.8'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.8'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.37'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.37'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.11'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.11'
|
153
|
+
description:
|
154
|
+
email:
|
155
|
+
- alistair.mckinnell@gmail.com
|
156
|
+
executables:
|
157
|
+
- nutrella
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".codeclimate.yml"
|
162
|
+
- ".envrc"
|
163
|
+
- ".gitignore"
|
164
|
+
- ".rspec"
|
165
|
+
- ".rubocop.yml"
|
166
|
+
- ".ruby-version"
|
167
|
+
- CODE_OF_CONDUCT.md
|
168
|
+
- Gemfile
|
169
|
+
- LICENSE.txt
|
170
|
+
- NOTES.md
|
171
|
+
- README.md
|
172
|
+
- Rakefile
|
173
|
+
- bin/console
|
174
|
+
- bin/rake
|
175
|
+
- bin/rspec
|
176
|
+
- bin/rubocop
|
177
|
+
- bin/setup
|
178
|
+
- exe/nutrella
|
179
|
+
- lib/nutrella.rb
|
180
|
+
- lib/nutrella/cache.rb
|
181
|
+
- lib/nutrella/command.rb
|
182
|
+
- lib/nutrella/configuration.rb
|
183
|
+
- lib/nutrella/developer_keys.rb
|
184
|
+
- lib/nutrella/task_board.rb
|
185
|
+
- lib/nutrella/task_board_name.rb
|
186
|
+
- lib/nutrella/version.rb
|
187
|
+
- nutrella.gemspec
|
188
|
+
homepage: https://github.com/amckinnell/nutrella
|
189
|
+
licenses:
|
190
|
+
- MIT
|
191
|
+
metadata: {}
|
192
|
+
post_install_message:
|
193
|
+
rdoc_options: []
|
194
|
+
require_paths:
|
195
|
+
- lib
|
196
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - "~>"
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '2.1'
|
201
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
requirements: []
|
207
|
+
rubyforge_project:
|
208
|
+
rubygems_version: 2.4.8
|
209
|
+
signing_key:
|
210
|
+
specification_version: 4
|
211
|
+
summary: A command line tool for creating a Trello Board based on the current git
|
212
|
+
branch.
|
213
|
+
test_files: []
|