devcenter 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CONTRIBUTING.md CHANGED
@@ -11,4 +11,4 @@ We welcome contributions!
11
11
  * Make commits of logical units.
12
12
  * Check for unnecessary whitespace with `git --diff` before commiting.
13
13
  * Push your changes to a topic branch in the main repository.
14
- * Submit a pull request to the base branch.# Contributing to this repo
14
+ * Submit a pull request to the base branch.
data/README.md CHANGED
@@ -14,7 +14,13 @@ CLI to interact with Heroku's Dev Center
14
14
 
15
15
  ### Save a local copy of an article
16
16
 
17
- $ devcenter pull error-pages
17
+ You can pull an article from its slug
18
+
19
+ $ devcenter pull article-slug
20
+
21
+ or from its URL:
22
+
23
+ $ devcenter pull https://devcenter.heroku.com/articles/article-slug
18
24
 
19
25
  This will save an `article-slug.md` text file in your local directory. The file includes some metadata (article title and id) followed by the article content in markdown format. You can edit both the title and the content, but **never overwrite the article id**.
20
26
 
@@ -34,6 +40,10 @@ Get help about a specific command
34
40
 
35
41
  $ devcenter help pull
36
42
 
43
+ ### Development
44
+
45
+ If you have a Dev Center instance, you can point your CLI to it by setting the `DEVCENTER_BASE_URL` env. var (e.g: `export DEVCENTER_BASE_URL=http://localhost:3000`).
46
+
37
47
  ## License
38
48
 
39
49
  See LICENSE.txt file.
data/devcenter.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'devcenter/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "devcenter"
8
8
  gem.version = Devcenter::VERSION
9
- gem.authors = ["Raul Murciano"]
9
+ gem.authors = ["Raul Murciano", "Clint Shryock"]
10
10
  gem.email = ["raul@heroku.com"]
11
11
  gem.description = %q{CLI to interact with Heroku's Dev Center}
12
12
  gem.summary = %q{CLI to interact with Heroku's Dev Center}
data/lib/devcenter/cli.rb CHANGED
@@ -26,6 +26,7 @@ command :pull do |c|
26
26
  c.summary = 'Save an editable copy of an article in your current directory'
27
27
  c.description = c.summary
28
28
  c.example 'devcenter pull process-model', 'Saves the content of the article with the "process-model" slug to a local process-model.md file in the current directory'
29
+ c.example 'devcenter pull https://devcenter.heroku.com/articles/process-model', 'Saves the content of the article with the provided URL'
29
30
  c.option '--force', 'Skip confirmation and overwrite existing local file'
30
31
  c.option '--debug', 'Output internal log to help debugging'
31
32
  c.action do |args, options|
@@ -50,3 +51,5 @@ command :preview do |c|
50
51
  Devcenter::Commands::Preview.run(args[0], options.host, options.port)
51
52
  end
52
53
  end
54
+
55
+ default_command :help
@@ -3,14 +3,14 @@ module Devcenter::Commands
3
3
  class Pull < Base
4
4
 
5
5
  def initialize(*args)
6
- @slug = args[0]
6
+ @slug = slug_from_article_url(args[0])
7
7
  @force_overwrite = args[1]
8
8
  super
9
9
  end
10
10
 
11
11
  def validate
12
12
  unless @slug && !@slug.strip.empty?
13
- @validation_errors << 'Please provide a slug (e.g: ps is the slug for https://devcenter.heroku.com/articles/ps)'
13
+ @validation_errors << 'Please provide an article slug or full (e.g: ps or https://devcenter.heroku.com/articles/ps)'
14
14
  end
15
15
  end
16
16
 
@@ -23,7 +23,8 @@ module Devcenter::Helpers
23
23
  end
24
24
 
25
25
  def slug_from_article_url(url)
26
- url.split('/articles/').last
26
+ return nil unless url
27
+ url.split('/articles/').last.split('?').first.split('#').first
27
28
  end
28
29
 
29
30
  def md_file_path(slug)
@@ -1,3 +1,3 @@
1
1
  module Devcenter
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devcenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Raul Murciano
9
+ - Clint Shryock
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-01-28 00:00:00.000000000 Z
13
+ date: 2013-02-08 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: listen