aid 0.1.3 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 364445296a94aa6258e1a9d4460cd5102d5f23e2
4
- data.tar.gz: c6cc1caf09b1ecab073e930c6d71a2d904ba6da5
2
+ SHA256:
3
+ metadata.gz: 993f88f2e0e6fa2b82b2e0f0282ce3f59d60d7ad49f236dd11ba1a8aa4f75aeb
4
+ data.tar.gz: 93fdf4f041e88d9906af88b01521f9e04b4a48715a9652a03a0dce330b9e4b7c
5
5
  SHA512:
6
- metadata.gz: 84bae2584c00206dbbd3debd1f446d43208f2514e3928863ccf60e9a5ddb37d3d87c95c8f5aa9adc6977788ba1b0553918b8c6c02b72e7aee40ab7a5d14860c0
7
- data.tar.gz: 9dde22ee384ba50a8d2a383cdf1437bba2e500f2ce7710564ab2351340b3bbb6c3da22f97db421dd68c6890d2b57b2227a2b51163f26114e348aaa7fc1ea065f
6
+ metadata.gz: 7663785bb164b3f775505aec9cd288d57347dfcff6be51ba1fab309030ed49cd913ee7e1b2473b4734ef11c33c5eded71d4c8e37207f7ae9fd490654c067d898
7
+ data.tar.gz: b585a2dbea6e35a8de76c38a3aea699d4fc24125c4b931206c652a4c90b228988b05ff6792000fe4310083167ca45365382637d21570c7e56663b4cd2d742479
@@ -0,0 +1,25 @@
1
+ require: []
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.5
5
+ Exclude:
6
+ - 'examples/*.rb'
7
+ - 'spec/plugins/**/*'
8
+
9
+ Layout/AlignHash:
10
+ Enabled: false
11
+
12
+ Metrics/AbcSize:
13
+ Enabled: false
14
+
15
+ Metrics/BlockLength:
16
+ Enabled: false
17
+
18
+ Metrics/MethodLength:
19
+ Enabled: false
20
+
21
+ Style/Documentation:
22
+ Enabled: false
23
+
24
+ Style/FormatStringToken:
25
+ Enabled: false
@@ -0,0 +1,18 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ exclude:
5
+ - spec/**/*
6
+ - test/**/*
7
+ - vendor/**/*
8
+ - ".bundle/**/*"
9
+ require: []
10
+ domains: []
11
+ reporters:
12
+ - rubocop
13
+ - require_not_found
14
+ plugins:
15
+ - runtime
16
+ require_paths:
17
+ - spec
18
+ max_files: 7000
@@ -1,5 +1,12 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.15.3
4
+ - 2.6.3
5
+
6
+ before_install:
7
+ - gem update --system
8
+ - gem install bundler
9
+
10
+ script:
11
+ - bundle exec rubocop
12
+ - bundle exec rspec spec
@@ -1,8 +1,16 @@
1
- [0.1.3](https://github.com/dbalatero/aid/tag/0.1.3)
1
+ [0.2.0](https://github.com/dbalatero/aid/tag/0.2.0)
2
2
 
3
3
  #### New features:
4
- * Added `$project_root/.aid` to the load path so aid loads top-level scripts while in subdirectories
5
- * Added `within_dir` convenience method to `Aid::Script`
4
+ * Sorted the list of commands in the `aid help` output
5
+ * Will auto-load an `.aid/config.rb` file last if present
6
+ * Added auto-fixing support to `aid doctor`
7
+ * Added plugin loading support for gems prefixed with `aid-`
8
+
9
+ ### Dev changes:
10
+ * Added Rubocop config
11
+ * Changed Travis CI to build on Ruby 2.6
12
+ * Configured solargraph
13
+ * Added CI build badge
6
14
 
7
15
  [0.1.2](https://github.com/dbalatero/aid/tag/0.1.2)
8
16
 
data/Gemfile CHANGED
@@ -1,8 +1,16 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) do |repo_name|
4
6
  "https://github.com/#{repo_name}"
5
7
  end
6
8
 
7
- # Specify your gem's dependencies in aide.gemspec
9
+ # Specify your gem's dependencies in aid.gemspec
8
10
  gemspec
11
+
12
+ group :development do
13
+ gem 'aid-foo',
14
+ require: false,
15
+ path: File.dirname(__FILE__) + '/spec/plugins/aid-foo'
16
+ end
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Aid
2
2
 
3
+ [![Build Status](https://travis-ci.com/dbalatero/aid.svg?branch=master)](https://travis-ci.com/dbalatero/aid)
4
+
3
5
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/aid`. To experiment with that code, run `bin/console` for an interactive prompt.
4
6
 
5
7
  TODO: Delete this and the text above, and describe your gem
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
@@ -1,27 +1,30 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "aid/version"
5
+ require 'aid/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "aid"
8
+ spec.name = 'aid'
8
9
  spec.version = Aid::VERSION
9
- spec.authors = ["David Balatero"]
10
- spec.email = ["dbalatero@gmail.com"]
10
+ spec.authors = ['David Balatero']
11
+ spec.email = ['dbalatero@gmail.com']
11
12
 
12
- spec.summary = %q{A library to make repo scripts easy and discoverable.}
13
- spec.homepage = "https://github.com/dbalatero/aid"
14
- spec.license = "MIT"
13
+ spec.summary = 'A library to make repo scripts easy and discoverable.'
14
+ spec.homepage = 'https://github.com/dbalatero/aid'
15
+ spec.license = 'MIT'
15
16
 
16
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
18
  f.match(%r{^(test|spec|features)/})
18
19
  end
19
20
 
20
- spec.bindir = "exe"
21
+ spec.bindir = 'exe'
21
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
+ spec.require_paths = ['lib']
23
24
 
24
- spec.add_development_dependency "bundler", "~> 1.15"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_development_dependency 'bundler'
26
+ spec.add_development_dependency 'pry'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.0'
29
+ spec.add_development_dependency 'rubocop'
27
30
  end
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "aide"
4
+ require 'bundler/setup'
5
+ require 'aid'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "aide"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
@@ -1,6 +1,8 @@
1
- require "json"
2
- require "tempfile"
3
- require "fileutils"
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'tempfile'
5
+ require 'fileutils'
4
6
 
5
7
  require_relative './shared/pivotal'
6
8
  require_relative './shared/git_config'
@@ -9,24 +11,21 @@ class Begin < Aid::Script
9
11
  include GitConfig
10
12
 
11
13
  def self.description
12
- "Starts your Pivotal Tracker story and opens a new PR on Github"
14
+ 'Starts your Pivotal Tracker story and opens a new PR on Github'
13
15
  end
14
16
 
15
17
  def self.help
16
18
  <<~EOF
17
- aid begin #{colorize(:light_blue, "[story id] [branch name]")}
18
-
19
- Example: $ #{colorize(:light_blue, 'aid begin "#133717234"')}
20
-
21
- This command will start your Pivotal Tracker story for you, open a pull
22
- request on Github, and copy over the Pivotal Tracker story description to
23
- the Github pull request description. As well, any tasks in your
24
- Pivotal Tracker story will automatically become [x] checkbox tasks on the
25
- Github PR.
26
-
27
- * All branch names will be auto-converted to kebab-case, lowercase
28
- * Passing story id/branch name as arguments are optional - if
29
- they are missing, you'll be prompted.
19
+ aid begin #{colorize(:light_blue, '[story id] [branch name]')}
20
+ Example: $ #{colorize(:light_blue, 'aid begin "#133717234"')}
21
+ This command will start your Pivotal Tracker story for you, open a pull
22
+ request on Github, and copy over the Pivotal Tracker story description to
23
+ the Github pull request description. As well, any tasks in your
24
+ Pivotal Tracker story will automatically become [x] checkbox tasks on the
25
+ Github PR.
26
+ * All branch names will be auto-converted to kebab-case, lowercase
27
+ * Passing story id/branch name as arguments are optional - if
28
+ they are missing, you'll be prompted.
30
29
  EOF
31
30
  end
32
31
 
@@ -37,7 +36,7 @@ class Begin < Aid::Script
37
36
  check_for_hub_credentials!
38
37
  check_for_pivotal_credentials!
39
38
 
40
- step "Starting the story" do
39
+ step 'Starting the story' do
41
40
  if story_id
42
41
  pivotal_start(story_id)
43
42
  else
@@ -48,7 +47,7 @@ class Begin < Aid::Script
48
47
  reset_hard_to_master!
49
48
  create_git_branch
50
49
 
51
- step "Pushing to Github" do
50
+ step 'Pushing to Github' do
52
51
  make_empty_commit
53
52
  push_branch_to_github
54
53
  end
@@ -60,11 +59,11 @@ class Begin < Aid::Script
60
59
  private
61
60
 
62
61
  def remove_story_id_from_master_branch
63
- FileUtils.rm_rf("tmp/.pivo_flow/stories/master")
62
+ FileUtils.rm_rf('tmp/.pivo_flow/stories/master')
64
63
  end
65
64
 
66
65
  def check_for_clean_git_workspace!
67
- unless system("git diff-index --quiet HEAD --")
66
+ unless system('git diff-index --quiet HEAD --')
68
67
  header = colorize :red, <<~HEADER
69
68
  You have unstaged changes in your git repository. Please commit or
70
69
  stash them first.
@@ -75,14 +74,14 @@ class Begin < Aid::Script
75
74
  end
76
75
 
77
76
  def reset_hard_to_master!
78
- silent "git checkout master",
79
- "git fetch origin",
80
- "git reset --hard origin/master"
77
+ silent 'git checkout master',
78
+ 'git fetch origin',
79
+ 'git reset --hard origin/master'
81
80
  end
82
81
 
83
82
  def create_git_branch
84
- step "Creating git branch" do
85
- system! "bundle exec pf branch"
83
+ step 'Creating git branch' do
84
+ system! 'bundle exec pf branch'
86
85
  end
87
86
  end
88
87
 
@@ -98,7 +97,7 @@ class Begin < Aid::Script
98
97
  end
99
98
 
100
99
  def project_id
101
- @project_id ||= git_config("pivo-flow.project-id")
100
+ @project_id ||= git_config('pivo-flow.project-id')
102
101
  end
103
102
 
104
103
  def branch_name
@@ -106,7 +105,7 @@ class Begin < Aid::Script
106
105
  end
107
106
 
108
107
  def default_tasks
109
- ["Add your tasks here"]
108
+ ['Add your tasks here']
110
109
  end
111
110
 
112
111
  def pivotal_tasks
@@ -114,7 +113,7 @@ class Begin < Aid::Script
114
113
 
115
114
  @pivotal_tasks = begin
116
115
  tasks = pivotal
117
- .request("/projects/#{project_id}/stories/#{story_id}/tasks")
116
+ .request("/projects/#{project_id}/stories/#{story_id}/tasks")
118
117
 
119
118
  return nil if tasks.empty?
120
119
 
@@ -146,28 +145,28 @@ class Begin < Aid::Script
146
145
  story['url']
147
146
  ]
148
147
 
149
- story_description = story["description"]
148
+ story_description = story['description']
150
149
 
151
150
  if story_description
152
- parts << "# Description"
151
+ parts << '# Description'
153
152
  parts << story_description
154
153
  end
155
154
 
156
- parts << "## TODO"
155
+ parts << '## TODO'
157
156
  parts << formatted_task_list
158
157
 
159
158
  parts.join("\n\n").strip
160
159
  end
161
160
 
162
161
  def open_pull_request_on_github!
163
- step "Opening pull request..." do
164
- tempfile = Tempfile.new("begin_pull_request")
162
+ step 'Opening pull request...' do
163
+ tempfile = Tempfile.new('begin_pull_request')
165
164
 
166
165
  begin
167
166
  tempfile.write(pull_request_description)
168
167
  tempfile.close
169
168
 
170
- labels = ["WIP", story["story_type"]].join(",")
169
+ labels = ['WIP', story['story_type']].join(',')
171
170
 
172
171
  url = `hub pull-request -F #{tempfile.path} -l "#{labels}" -a "" -o`
173
172
 
@@ -180,15 +179,13 @@ class Begin < Aid::Script
180
179
  end
181
180
  end
182
181
 
183
- private
184
-
185
182
  def silent(*cmds)
186
183
  cmds.each { |cmd| system("#{cmd} >/dev/null 2>&1") }
187
184
  end
188
185
 
189
186
  def command?(name)
190
187
  `which #{name}`
191
- $?.success?
188
+ $CHILD_STATUS.success?
192
189
  end
193
190
 
194
191
  def prompt(msg)
@@ -200,18 +197,19 @@ class Begin < Aid::Script
200
197
 
201
198
  def normalized_branch_name(branch_name)
202
199
  branch_name
203
- .gsub(/[^\w\s-]/, "")
204
- .gsub(/\s+/, "-")
200
+ .gsub(/[^\w\s-]/, '')
201
+ .gsub(/\s+/, '-')
205
202
  .downcase
206
- .gsub(/-*$/, "") # trailing dashes
203
+ .gsub(/-*$/, '') # trailing dashes
207
204
  end
208
205
 
209
206
  def check_for_hub!
210
- if !command?("hub")
211
- download_url = "https://github.com/github/hub/releases"\
212
- "/download/v2.3.0-pre10/hub-darwin-amd64-2.3.0-pre10.tgz"
207
+ return if command?('hub')
213
208
 
214
- abort <<~EOF
209
+ download_url = 'https://github.com/github/hub/releases'\
210
+ '/download/v2.3.0-pre10/hub-darwin-amd64-2.3.0-pre10.tgz'
211
+
212
+ abort <<~HELP
215
213
  You need to install `hub` before you can use this program.
216
214
  We use a pre-release version of hub as it adds some additional
217
215
  flags to `hub pull-request`.
@@ -219,18 +217,15 @@ class Begin < Aid::Script
219
217
  To fix:
220
218
 
221
219
  Download it at #{download_url}
222
-
223
220
  Untar the downloaded tarball, cd to the directory, and run:
224
-
225
221
  $ ./install
226
- EOF
227
- end
222
+ HELP
228
223
  end
229
224
 
230
225
  def check_for_hub_credentials!
231
226
  config_file = "#{ENV['HOME']}/.config/hub"
232
227
  credentials_exist = File.exist?(config_file) &&
233
- File.read(config_file).match(/oauth_token/i)
228
+ File.read(config_file).match(/oauth_token/i)
234
229
 
235
230
  unless credentials_exist
236
231
  abort <<~EOF
@@ -246,20 +241,20 @@ class Begin < Aid::Script
246
241
 
247
242
  def check_for_pivotal_credentials!
248
243
  config_abort_if_blank!(
249
- "pivo-flow.api-token",
244
+ 'pivo-flow.api-token',
250
245
  api_token,
251
- "You can find this value in your user Profile section on Pivotal."
246
+ 'You can find this value in your user Profile section on Pivotal.'
252
247
  )
253
248
 
254
249
  config_abort_if_blank!(
255
- "pivo-flow.project-id",
250
+ 'pivo-flow.project-id',
256
251
  project_id,
257
- "Please run: $ git config pivo-flow.project-id 2092669"
252
+ 'Please run: $ git config pivo-flow.project-id 2092669'
258
253
  )
259
254
  end
260
255
 
261
256
  def interactive_prompt_for_story
262
- system "bundle exec pf stories"
257
+ system 'bundle exec pf stories'
263
258
  @story_id = `bundle exec pf current`.strip
264
259
  end
265
260
 
@@ -268,11 +263,11 @@ class Begin < Aid::Script
268
263
  end
269
264
 
270
265
  def story_id
271
- @story_id ||= argv.first&.gsub(/[^\d]/, "")
266
+ @story_id ||= argv.first&.gsub(/[^\d]/, '')
272
267
  end
273
268
 
274
269
  def api_token
275
- @api_token ||= git_config("pivo-flow.api-token")
270
+ @api_token ||= git_config('pivo-flow.api-token')
276
271
  end
277
272
 
278
273
  def pivotal