codeunion 0.0.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52ea6972b9909f54b51efc7492a367c1a52b390e
4
- data.tar.gz: b107ddbc578eb45603bbac1f1aa804938508f48b
3
+ metadata.gz: 6501d0e9cfb4ee5627e21baa3a9afc82308b3bd5
4
+ data.tar.gz: 0a2a9c950509570e6a5c0888580bb2a1efae34e8
5
5
  SHA512:
6
- metadata.gz: cfa18400fa8db69c0d40157fc8f1f2bd28b8475e0875278abf50585f50f8ae6c67dae18db445b8997da2abb2dfc881ca24d9097e88b1a358b070ab2730211ef3
7
- data.tar.gz: 0ad6a777f8a1949284c155c49b73cca2185ce251068ef437fac55c953f45d6182fcf253bf6b1ca1d371decbdd93d4440b6680b19c6b0bdcc3f68f3ca711f6395
6
+ metadata.gz: 952ecd7fd62f6f64fb7fe4c9a622077ca2d9af7a3d37161e6e41694f2cbcae9261853ed3a073ee7172514a0faaf02905a8c5e7f3234f18e603017320b719594f
7
+ data.tar.gz: 086239d08ac7c5465ce95b527c190960bf2812ea792ee2fb930eaeecc274f4a29eb870e8e78306bfdc8c5f98ec654a617e71b328205448ed5c7b276a0d10c1ff
data/README.md CHANGED
@@ -21,18 +21,98 @@ $ rbenv rehash
21
21
  after you install the gem. This is required for rbenv to pick up any new
22
22
  executables installed by a gem, including ours.
23
23
 
24
+ ## Getting Started
25
+
26
+ Once you've installed the gem, you will be able to run the `codeunion` command:
27
+
28
+ ```shell-session
29
+ $ codeunion
30
+ ```
31
+
32
+ To run a particular subcommand, add it to the `codeunion` base command. For example, to use the search command you would run:
33
+
34
+ ```shell-session
35
+ $ codeunion search [your search query]
36
+ ```
37
+
38
+ You can see a help window for any subcommand by appending a `-h` or `--help` flag:
39
+
40
+ ```shell-session
41
+ $ codeunion search -h
42
+ Usage: codeunion search [options] <terms>
43
+
44
+ Options:
45
+ -c, --category CATEGORY Display config variable NAME
46
+ -h, --help Print this help message
47
+ ```
48
+
24
49
  ## Subcommands
25
50
 
26
- The command-line tool is organized into subcommands, a la git. If we were to
27
- run this command, for example
51
+ #### Config
52
+
53
+ Read and write configuration for the CodeUnion command-line tool.
54
+
55
+ Example usage:
28
56
 
29
57
  ```shell-session
30
- $ codeunion waffles
58
+ # Set the feedback.repository value
59
+ $ codeunion config feedback.repository codeunion/feedback-requests-web-fundamentals
60
+
61
+ # Get the feedback.repository value
62
+ $ codeunion config feedback.repository
63
+ codeunion/feedback-requests-web-fundamentals
31
64
  ```
32
65
 
33
- the CodeUnion tool would look for an executable named `codeunion-waffles`. If
34
- the executable exists, the tool will run it. If it doesn't exist, we would see
35
- a `CommandNotFound` error.
66
+ #### Feedback
67
+
68
+ Request feedback on your code.
69
+
70
+ Feedback requests require a URL for a _specific commit_ or a _pull request_.
71
+
72
+ Example usage:
73
+
74
+ ```shell-session
75
+ $ codeunion feedback request https://github.com/codeunion/overheard-server/commit/0edb7866809620013d4a3c2d3b5bea57b12bf255
76
+ ```
77
+
78
+ Run `codeunion feedback -h` for more information.
79
+
80
+ #### Search
81
+
82
+ Search the repositories in the CodeUnion curriculum.
83
+
84
+ Example usage:
85
+
86
+ ```shell-session
87
+ $ codeunion search html
88
+ Project: social-wall
89
+ Your First Web Application
90
+ https://github.com/codeunion/social-wall
91
+ tags:
92
+ Excerpt: HTML templating and ERB - Deploying an application to Heroku
93
+ The following video tutorials are all based...
94
+
95
+ [...]
96
+ ```
97
+
98
+ You can narrow your searches by category with the `--category` flag.
99
+
100
+
101
+ ```shell-session
102
+ $ codeunion search html --category example
103
+ ```
104
+
105
+ Or you can use the alias commands to narrow your search to either `projects` or `examples`.
106
+
107
+ ```shell-session
108
+ $ codeunion examples html
109
+ ```
110
+
111
+ ...and...
112
+
113
+ ```shell-session
114
+ $ codeunion projects html
115
+ ```
36
116
 
37
117
  ## Development
38
118
 
@@ -46,3 +126,16 @@ make unit-test # Runs the unit tests against all ruby versions. Thread-safe.
46
126
  make feature-test # Runs the feature tests against all ruby versions. Not-thread-safe.
47
127
  make test # Runs unit and feature tests against all ruby versions
48
128
  ```
129
+
130
+ ### How Subcommands Work
131
+
132
+ The command-line tool is organized into subcommands, a la git. If we were to
133
+ run this command, for example
134
+
135
+ ```shell-session
136
+ $ codeunion waffles
137
+ ```
138
+
139
+ the CodeUnion tool would look for an executable named `codeunion-waffles`. If
140
+ the executable exists, the tool will run it. If it doesn't exist, we would see
141
+ a `CommandNotFound` error.
@@ -9,9 +9,53 @@ bin_file = Pathname.new(__FILE__).realpath
9
9
  $LOAD_PATH.unshift File.expand_path("../../lib", bin_file)
10
10
 
11
11
  # Add our gem-specific "libexec" directory to the PATH
12
- ENV["PATH"] += ":" + File.expand_path("../../libexec", bin_file)
12
+ subcmd_dir = File.expand_path("../../libexec", bin_file)
13
+ ENV["PATH"] += ":" + subcmd_dir
14
+
15
+ # Find all available subcommands
16
+ subcmd_prefix = "codeunion-"
17
+ subcmd_files = Pathname.glob(File.join(subcmd_dir, subcmd_prefix + "*"))
18
+
19
+ SUBCOMMANDS = subcmd_files.map do |path|
20
+ path.basename.to_s[/#{subcmd_prefix}(.+)/, 1]
21
+ end
13
22
 
14
23
  require "codeunion/command/main"
24
+ require "optparse"
25
+
26
+ description = <<HELP
27
+ The CodeUnion command-line tool is meant to be used in conjunction with CodeUnion's curriculum.
28
+
29
+ Think of it as your "learning sherpa."
30
+ HELP
31
+
32
+ parser = OptionParser.new do |opts|
33
+ opts.instance_exec do
34
+ self.banner = "Usage: codeunion <command>"
35
+
36
+ separator ""
37
+ separator description
38
+
39
+ separator ""
40
+ separator "Commands:"
41
+ separator SUBCOMMANDS.map { |subcmd| summary_indent + subcmd }
42
+
43
+ separator ""
44
+ separator "Options:"
45
+
46
+ on_tail("-h", "--help", "Print this help message") do
47
+ puts self
48
+ exit
49
+ end
50
+ end
51
+ end
52
+
53
+ parser.order!
54
+
55
+ if ARGV.empty?
56
+ puts parser
57
+ exit
58
+ end
15
59
 
16
60
  options = {
17
61
  :command_name => ARGV.first,
@@ -1,3 +1,3 @@
1
1
  module CodeUnion
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeunion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Farmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-15 00:00:00.000000000 Z
11
+ date: 2015-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -229,4 +229,3 @@ test_files:
229
229
  - test/unit/feedback_request_test.rb
230
230
  - test/unit/fixtures/sample_config
231
231
  - test/unit/search_test.rb
232
- has_rdoc: