recycle 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6035bfbe3af5452338b241075bfbd3659fa00f8c
4
- data.tar.gz: 2976a7ef492b2f9a3dea696f631e885fb8d39ae8
3
+ metadata.gz: 1e9452c32400a758d6045326cd82277fc509f049
4
+ data.tar.gz: 84f72dacd21aec6fdfba693b5635b2baa773704a
5
5
  SHA512:
6
- metadata.gz: 903741adfa3c0a0bcd8fb38623805483c0585babfd8f11b8092886a14d2d000adcab4764c82a9fb520c3c529129b3867df861154f66fc5fad78663be7648dc19
7
- data.tar.gz: ae44b7c82499686c8d30353e5cf205ceffb66fb9e4a91ad0f50fcb65ddd1b40c554b1343432ed06fd61821e078f2b37f186371c80b212d2423e0a7a5ed11666c
6
+ metadata.gz: cf57b906f7bb75fc6cd1d6338aeb97ed30595ff1dabd6136b569e3b8c834b918a003e6c398d68f8325d69a7b0852e627a0d5c610fcae8ff7484a684b6e21f304
7
+ data.tar.gz: 23cfacea2122379a6c42d2f2b53e7d42dfb0ca6b6916d26201bec398e1d35ac1139d121dbf99bc606d655ab3264185ec48d1295f4d93aba1c4931718963f62c3
@@ -1,3 +1,6 @@
1
+ script:
2
+ - "bundle exec rake test"
3
+ - "bundle exec cucumber"
1
4
  sudo: false
2
5
  language: ruby
3
6
  rvm:
@@ -0,0 +1,84 @@
1
+ # Contributing
2
+
3
+ When contributing to this repository, please first discuss the change you wish to make via issue,
4
+ email, or any other method with the owners of this repository before making a change.
5
+
6
+ Please note we have a code of conduct, please follow it in all your interactions with the project.
7
+
8
+ ## Pull Request Process
9
+
10
+ 1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11
+ build.
12
+ 2. Update the README.md with details of changes to the interface, this includes new environment
13
+ variables, exposed ports, useful file locations and container parameters.
14
+ 3. Increase the version numbers in any examples files and the README.md to the new version that this
15
+ Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
16
+ 4. You may merge the Pull Request in once you have the sign-off of one other developer, or if you
17
+ do not have permission to do that, you may request the other reviewer to merge it for you.
18
+
19
+ ## Code of Conduct
20
+
21
+ ### Our Pledge
22
+
23
+ In the interest of fostering an open and welcoming environment, we as
24
+ contributors and maintainers pledge to making participation in our project and
25
+ our community a harassment-free experience for everyone, regardless of age, body
26
+ size, disability, ethnicity, gender identity and expression, level of experience,
27
+ nationality, personal appearance, race, religion, or sexual identity and
28
+ orientation.
29
+
30
+ ### Our Standards
31
+
32
+ Examples of behavior that contributes to creating a positive environment
33
+ include:
34
+
35
+ * Using welcoming and inclusive language
36
+ * Being respectful of differing viewpoints and experiences
37
+ * Gracefully accepting constructive criticism
38
+ * Focusing on what is best for the community
39
+ * Showing empathy towards other community members
40
+
41
+ Examples of unacceptable behavior by participants include:
42
+
43
+ * The use of sexualized language or imagery and unwelcome sexual attention or
44
+ advances
45
+ * Trolling, insulting/derogatory comments, and personal or political attacks
46
+ * Public or private harassment
47
+ * Publishing others' private information, such as a physical or electronic
48
+ address, without explicit permission
49
+ * Other conduct which could reasonably be considered inappropriate in a
50
+ professional setting
51
+
52
+ ### Our Responsibilities
53
+
54
+ Project maintainers are responsible for clarifying the standards of acceptable
55
+ behavior and are expected to take appropriate and fair corrective action in
56
+ response to any instances of unacceptable behavior.
57
+
58
+ Project maintainers have the right and responsibility to remove, edit, or
59
+ reject comments, commits, code, wiki edits, issues, and other contributions
60
+ that are not aligned to this Code of Conduct, or to ban temporarily or
61
+ permanently any contributor for other behaviors that they deem inappropriate,
62
+ threatening, offensive, or harmful.
63
+
64
+ ### Scope
65
+
66
+ This Code of Conduct applies both within project spaces and in public spaces
67
+ when an individual is representing the project or its community. Examples of
68
+ representing a project or community include using an official project e-mail
69
+ address, posting via an official social media account, or acting as an appointed
70
+ representative at an online or offline event. Representation of a project may be
71
+ further defined and clarified by project maintainers.
72
+
73
+ ### Enforcement
74
+
75
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
76
+ reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
77
+ complaints will be reviewed and investigated and will result in a response that
78
+ is deemed necessary and appropriate to the circumstances. The project team is
79
+ obligated to maintain confidentiality with regard to the reporter of an incident.
80
+ Further details of specific enforcement policies may be posted separately.
81
+
82
+ Project maintainers who do not follow or enforce the Code of Conduct in good
83
+ faith may face temporary or permanent repercussions as determined by other
84
+ members of the project's leadership.
data/README.md CHANGED
@@ -5,7 +5,7 @@ functions. Often dot files can be frustrating to manage, this aims to remove
5
5
  some of the frustration by adding an easy way of adding directory shortcuts
6
6
  (through aliases) and helper functions for commands.
7
7
 
8
- To use:
8
+ # Usage
9
9
 
10
10
  * install the gem
11
11
  * run the command `recycle init`
@@ -37,5 +37,14 @@ recycle add -d h "\$HOME"
37
37
  *note* You may have to escape reserved shell terms like shown above, since you
38
38
  may not want it to resolve until a later time.
39
39
 
40
+ # Code status
41
+ [![Build Status](https://travis-ci.org/jeremywrowe/recycle.svg?branch=master)](https://travis-ci.org/jeremywrowe/recycle)
42
+
43
+ # Contributing
44
+
40
45
  This is still very much a work in progress, but give it a shot and open up pull
41
46
  requests as you see fit.
47
+
48
+ # License
49
+
50
+ Recycle is released under the [MIT License](http://www.opensource.org/licenses/MIT).
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'recycle'
3
- require 'recycle/list'
4
-
5
3
  require 'fileutils'
6
4
  require 'rubygems'
7
5
  require 'yaml'
8
6
  require 'commander/import'
9
7
 
8
+ require_relative '../lib/recycle/util'
9
+ require_relative '../lib/recycle/list'
10
+
10
11
  program :name, 'Recycle'
11
12
  program :version, Recycle::VERSION
12
13
  program :description, 'A command for storing frequently used commands.'
@@ -43,19 +44,23 @@ command :list do |cmd|
43
44
  show_all = !options.cmd && !options.dir
44
45
  show_commands = (options.cmd || show_all) && commands.length.positive?
45
46
  show_directories = (options.dir || show_all) && directories.length.positive?
47
+ data = []
46
48
 
47
- puts Recycle::List.render_section('Commands', commands) if show_commands
48
- puts Recycle::List.render_section('Directories', directories) if show_directories
49
49
 
50
- unless show_commands || show_directories
50
+ data << Recycle::List.render_section('Commands', commands) if show_commands
51
+ data << Recycle::List.render_section('Directories', directories) if show_directories
52
+
53
+ if show_commands || show_directories
54
+ puts data.join("\n")
55
+ else
51
56
  output << <<~DOC
52
57
  There are currently no commands or directories in your configuration.
53
58
  To add a command or directory checkout:
54
59
 
55
60
  recycle add -h
56
61
  DOC
62
+ puts output
57
63
  end
58
- puts output
59
64
  end
60
65
  end
61
66
 
@@ -68,12 +73,9 @@ command :add do |cmd|
68
73
  cmd.action do |args, options|
69
74
  if !options.dir && !options.cmd
70
75
  puts <<~DOC
71
- ================================================================================
72
- #{"Usage".center(80).rstrip}
73
- ================================================================================
74
-
75
- recycle add -c IDENTIFIER "value here" - adds the command named IDENTIFIER with the value provided in quotes
76
- recycle add -d IDENTIFIER "value here" - adds the command named IDENTIFIER with the value provided in quotes
76
+ #{Recycle::Util.header('Usage')}
77
+ recycle add -c IDENTIFIER "value here" - adds the command named IDENTIFIER with the value provided in quotes
78
+ recycle add -d IDENTIFIER "value here" - adds the command named IDENTIFIER with the value provided in quotes
77
79
  DOC
78
80
  exit 1
79
81
  end
@@ -101,12 +103,9 @@ command :remove do |cmd|
101
103
  cmd.action do |args, options|
102
104
  if !options.dir && !options.cmd
103
105
  puts <<~DOC
104
- ================================================================================
105
- #{"Usage".center(80).rstrip}
106
- ================================================================================
107
-
108
- recycle remove -c IDENTIFIER - removes the command named IDENTIFIER
109
- recycle remove -d IDENTIFIER - removes the command named IDENTIFIER
106
+ #{Recycle::Util.header('Usage')}
107
+ recycle remove -c IDENTIFIER - removes the command named IDENTIFIER
108
+ recycle remove -d IDENTIFIER - removes the command named IDENTIFIER
110
109
  DOC
111
110
  exit 1
112
111
  end
@@ -1,4 +1,3 @@
1
1
  require 'recycle/version'
2
-
3
- module Recycle
4
- end
2
+ require 'recycle/util'
3
+ require 'recycle/list'
@@ -1,28 +1,17 @@
1
- require 'erb'
2
-
3
1
  module Recycle
4
2
  class List < BasicObject
5
- TMPL = <<-DATA.freeze
6
- <%= "=" * 80 %>
7
- <%= title.center(80).rstrip %>
8
- <%= "=" * 80 %>
9
- <% sorted_content.each do |content| %>
10
- <%= render_row(key_width, content.first, content.last) -%>
11
- <% end %>
12
-
13
- DATA
14
-
15
3
  class << self
16
4
  def render_section(title, content)
17
5
  key_width = content.keys.map(&:length).max
18
6
  sorted_content = content.sort_by { |key, _value| key }
19
- ::ERB.new(TMPL, nil, '-').result(binding)
20
- end
21
-
22
- private
7
+ entries = sorted_content.map do |content|
8
+ "#{content.first.ljust(key_width)} => #{content.last}"
9
+ end.join("\n")
23
10
 
24
- def render_row(key_width, key, value)
25
- "#{key.ljust(key_width)} => #{value}"
11
+ <<~OUTPUT
12
+ #{Util.header(title)}
13
+ #{entries}
14
+ OUTPUT
26
15
  end
27
16
  end
28
17
  end
@@ -0,0 +1,14 @@
1
+ module Recycle
2
+ class Util < BasicObject
3
+ class << self
4
+ def header(label, padding: 80, token: "=")
5
+ divider = token * padding
6
+ <<~HEADER
7
+ #{divider}
8
+ #{label.center(padding).rstrip}
9
+ #{divider}
10
+ HEADER
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Recycle
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recycle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy W. Rowe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-09 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -149,6 +149,7 @@ files:
149
149
  - ".gitignore"
150
150
  - ".travis.yml"
151
151
  - CODE_OF_CONDUCT.md
152
+ - CONTRIBUTING.md
152
153
  - Gemfile
153
154
  - Guardfile
154
155
  - LICENSE.txt
@@ -161,6 +162,7 @@ files:
161
162
  - exe/recycle
162
163
  - lib/recycle.rb
163
164
  - lib/recycle/list.rb
165
+ - lib/recycle/util.rb
164
166
  - lib/recycle/version.rb
165
167
  - recycle-list.png
166
168
  - recycle.gemspec