ghedsh 1.1.40 → 2.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +12 -0
- data/.github/ISSUE_TEMPLATE.md +31 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +30 -0
- data/.gitignore +12 -1
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/Gemfile +5 -0
- data/LICENSE +165 -0
- data/README.md +6 -93
- data/Rakefile +3 -9
- data/bin/ghedsh +2 -1
- data/file_templates/add_members_template.json +12 -0
- data/file_templates/create_teams_template.json +19 -0
- data/file_templates/invite_outside_collabs.json +12 -0
- data/file_templates/remove_members_template.json +12 -0
- data/ghedsh.gemspec +3 -2
- data/lib/actions/orgs.rb +636 -842
- data/lib/actions/system.rb +212 -278
- data/lib/actions/teams.rb +15 -229
- data/lib/actions/user.rb +304 -12
- data/lib/commands.rb +465 -0
- data/lib/common.rb +15 -0
- data/lib/context.rb +42 -0
- data/lib/helpers.rb +147 -0
- data/lib/interface.rb +71 -733
- data/lib/plugin_loader.rb +43 -0
- data/lib/version.rb +1 -1
- data/spec/cli_spec.rb +30 -0
- data/spec/spec_helper.rb +106 -0
- metadata +38 -10
- data/docs/Javier-clemente-MemoriaTFG-ghedsh.pdf +0 -0
- data/lib/actions/help.rb +0 -357
- data/lib/actions/repo.rb +0 -832
- data/spec/spec.rb +0 -1
@@ -0,0 +1,43 @@
|
|
1
|
+
class PluginLoader
|
2
|
+
GEM_NAME_PREFIX = /^ghedsh-/
|
3
|
+
attr_reader :plugins
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@plugins = []
|
7
|
+
end
|
8
|
+
|
9
|
+
def load_plugins
|
10
|
+
find_plugins
|
11
|
+
end
|
12
|
+
|
13
|
+
def find_plugins
|
14
|
+
find_gems.map do |gem|
|
15
|
+
@plugins << { name: gem.name, path: gem_path(gem.name), plugin_klass: plugin_klass_name(gem.name) }
|
16
|
+
end
|
17
|
+
|
18
|
+
@plugins
|
19
|
+
end
|
20
|
+
|
21
|
+
def find_gems
|
22
|
+
gem_list.select { |gem| gem.name =~ GEM_NAME_PREFIX }
|
23
|
+
end
|
24
|
+
|
25
|
+
def gem_path(name)
|
26
|
+
name.tr('-', '/')
|
27
|
+
end
|
28
|
+
|
29
|
+
def plugin_klass_name(path)
|
30
|
+
# convert gem paths to plugin module.
|
31
|
+
# ghedsh/firstplugin --> Ghedsh::Firstplugin
|
32
|
+
# ghedsh/another_name --> Ghedsh::AnotherName
|
33
|
+
path = gem_path(path)
|
34
|
+
path.split('/').collect do |c|
|
35
|
+
c.split('_').collect(&:capitalize).join
|
36
|
+
end.join('::')
|
37
|
+
end
|
38
|
+
|
39
|
+
def gem_list
|
40
|
+
Gem.refresh
|
41
|
+
Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.find_name('')
|
42
|
+
end
|
43
|
+
end
|
data/lib/version.rb
CHANGED
data/spec/cli_spec.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe "# GitHub Education Shell: ghedsh" do
|
4
|
+
before :all do
|
5
|
+
@org = Organization.new
|
6
|
+
@team = Team.new
|
7
|
+
@user = User.new
|
8
|
+
end
|
9
|
+
|
10
|
+
context "# Test Organization class" do
|
11
|
+
it "initializes correctly" do
|
12
|
+
expect(@org).not_to eq(nil)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "object is instance of class Organization" do
|
16
|
+
expect(@org).to be_instance_of(Organization)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "# Test User class" do
|
21
|
+
it "initializes correctly" do
|
22
|
+
expect(@user).not_to eq(nil)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "object is instance of class User" do
|
26
|
+
expect(@user).to be_instance_of(User)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
|
+
|
17
|
+
require_relative '../lib/actions/user'
|
18
|
+
require_relative '../lib/actions/teams'
|
19
|
+
require_relative '../lib/actions/system'
|
20
|
+
require_relative '../lib/actions/orgs'
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
# rspec-expectations config goes here. You can use an alternate
|
24
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
25
|
+
# assertions if you prefer.
|
26
|
+
config.expect_with :rspec do |expectations|
|
27
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
28
|
+
# and `failure_message` of custom matchers include text for helper methods
|
29
|
+
# defined using `chain`, e.g.:
|
30
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
31
|
+
# # => "be bigger than 2 and smaller than 4"
|
32
|
+
# ...rather than:
|
33
|
+
# # => "be bigger than 2"
|
34
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
35
|
+
end
|
36
|
+
|
37
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
38
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
39
|
+
config.mock_with :rspec do |mocks|
|
40
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
41
|
+
# a real object. This is generally recommended, and will default to
|
42
|
+
# `true` in RSpec 4.
|
43
|
+
mocks.verify_partial_doubles = true
|
44
|
+
end
|
45
|
+
|
46
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
47
|
+
# have no way to turn it off -- the option exists only for backwards
|
48
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
49
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
50
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
51
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
52
|
+
|
53
|
+
# The settings below are suggested to provide a good initial experience
|
54
|
+
# with RSpec, but feel free to customize to your heart's content.
|
55
|
+
=begin
|
56
|
+
# This allows you to limit a spec run to individual examples or groups
|
57
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
58
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
59
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
60
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
61
|
+
config.filter_run_when_matching :focus
|
62
|
+
|
63
|
+
# Allows RSpec to persist some state between runs in order to support
|
64
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
65
|
+
# you configure your source control system to ignore this file.
|
66
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
67
|
+
|
68
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
69
|
+
# recommended. For more details, see:
|
70
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
71
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
72
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
73
|
+
config.disable_monkey_patching!
|
74
|
+
|
75
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
76
|
+
# be too noisy due to issues in dependencies.
|
77
|
+
config.warnings = true
|
78
|
+
|
79
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
80
|
+
# file, and it's useful to allow more verbose output when running an
|
81
|
+
# individual spec file.
|
82
|
+
if config.files_to_run.one?
|
83
|
+
# Use the documentation formatter for detailed output,
|
84
|
+
# unless a formatter has already been configured
|
85
|
+
# (e.g. via a command-line flag).
|
86
|
+
config.default_formatter = "doc"
|
87
|
+
end
|
88
|
+
|
89
|
+
# Print the 10 slowest examples and example groups at the
|
90
|
+
# end of the spec run, to help surface which specs are running
|
91
|
+
# particularly slow.
|
92
|
+
config.profile_examples = 10
|
93
|
+
|
94
|
+
# Run specs in random order to surface order dependencies. If you find an
|
95
|
+
# order dependency and want to debug it, you can fix the order by providing
|
96
|
+
# the seed, which is printed after each run.
|
97
|
+
# --seed 1234
|
98
|
+
config.order = :random
|
99
|
+
|
100
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
101
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
102
|
+
# test failures related to randomization by passing the same `--seed` value
|
103
|
+
# as the one that triggered the failure.
|
104
|
+
Kernel.srand config.seed
|
105
|
+
=end
|
106
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghedsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Clemente
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '4.8'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '4.8'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: require_all
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,6 +53,20 @@ dependencies:
|
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.7'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.7'
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
71
|
name: bundler
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,22 +89,35 @@ executables:
|
|
75
89
|
extensions: []
|
76
90
|
extra_rdoc_files: []
|
77
91
|
files:
|
92
|
+
- ".editorconfig"
|
93
|
+
- ".github/ISSUE_TEMPLATE.md"
|
94
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
78
95
|
- ".gitignore"
|
96
|
+
- ".rspec"
|
97
|
+
- CODE_OF_CONDUCT.md
|
79
98
|
- Gemfile
|
99
|
+
- LICENSE
|
80
100
|
- README.md
|
81
101
|
- Rakefile
|
82
102
|
- bin/ghedsh
|
83
|
-
-
|
103
|
+
- file_templates/add_members_template.json
|
104
|
+
- file_templates/create_teams_template.json
|
105
|
+
- file_templates/invite_outside_collabs.json
|
106
|
+
- file_templates/remove_members_template.json
|
84
107
|
- ghedsh.gemspec
|
85
|
-
- lib/actions/help.rb
|
86
108
|
- lib/actions/orgs.rb
|
87
|
-
- lib/actions/repo.rb
|
88
109
|
- lib/actions/system.rb
|
89
110
|
- lib/actions/teams.rb
|
90
111
|
- lib/actions/user.rb
|
112
|
+
- lib/commands.rb
|
113
|
+
- lib/common.rb
|
114
|
+
- lib/context.rb
|
115
|
+
- lib/helpers.rb
|
91
116
|
- lib/interface.rb
|
117
|
+
- lib/plugin_loader.rb
|
92
118
|
- lib/version.rb
|
93
|
-
- spec/
|
119
|
+
- spec/cli_spec.rb
|
120
|
+
- spec/spec_helper.rb
|
94
121
|
homepage: https://github.com/ULL-ESIT-GRADOII-TFG/ghedsh
|
95
122
|
licenses:
|
96
123
|
- MIT
|
@@ -103,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
130
|
requirements:
|
104
131
|
- - ">="
|
105
132
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
133
|
+
version: 2.4.0
|
107
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
135
|
requirements:
|
109
136
|
- - ">="
|
@@ -116,4 +143,5 @@ signing_key:
|
|
116
143
|
specification_version: 4
|
117
144
|
summary: A command line program following the philosophy of GitHub Education.
|
118
145
|
test_files:
|
119
|
-
- spec/
|
146
|
+
- spec/cli_spec.rb
|
147
|
+
- spec/spec_helper.rb
|
Binary file
|
data/lib/actions/help.rb
DELETED
@@ -1,357 +0,0 @@
|
|
1
|
-
require 'require_all'
|
2
|
-
require_rel '.'
|
3
|
-
|
4
|
-
class HelpM
|
5
|
-
attr_reader :user
|
6
|
-
attr_reader :org_repo
|
7
|
-
attr_reader :org_teams
|
8
|
-
attr_reader :user_repo
|
9
|
-
attr_reader :common_opt
|
10
|
-
|
11
|
-
def context(name,scope)
|
12
|
-
name=name.join("_")
|
13
|
-
begin
|
14
|
-
self.send(:"#{name}",scope)
|
15
|
-
rescue
|
16
|
-
puts "There is no command with that name"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def clone(scope)
|
21
|
-
case
|
22
|
-
when scope==USER || scope==ORGS
|
23
|
-
print "\tclone\t\t\tClone a repository.\n"
|
24
|
-
print "\t\t\t\t->\tclone [repository]\n\n"
|
25
|
-
print "\t\t\t\tYou can use a RegExp to clone several repositories with \/ parameter \n"
|
26
|
-
print "\t\t\t\t->\tclone /[RegExp]/\n\n"
|
27
|
-
when scope==USER_REPO || scope==TEAM_REPO || scope==ORGS_REPO
|
28
|
-
print "\tclone\t\t\tClone the current repository.\n"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def repos(scope)
|
33
|
-
case
|
34
|
-
when scope==USER
|
35
|
-
print "\trepos\t\t\tList your repositories\n"
|
36
|
-
when scope==ORGS
|
37
|
-
print "\trepos\t\t\tList the repositories of your organization\n"
|
38
|
-
when scope==TEAM
|
39
|
-
print "\trepos\t\t\tList the team's repositories\n"
|
40
|
-
end
|
41
|
-
print "\t\t\t\tUse the parameter -a, to directly show all repositories\n"
|
42
|
-
print "\t\t\t\t->\trepos -a\n\n"
|
43
|
-
print "\t\t\t\tYou can use a RegExp to improve the search using the \/ parameter \n"
|
44
|
-
print "\t\t\t\t->\trepos /[RegExp]/\n\n"
|
45
|
-
end
|
46
|
-
|
47
|
-
def new_repository(scope)
|
48
|
-
case
|
49
|
-
when scope==USER
|
50
|
-
print "\tnew repository\t\tCreate a repository in your personal account\n"
|
51
|
-
when scope==ORGS
|
52
|
-
print "\tnew repository\t\tCreate a repository in a organization\n"
|
53
|
-
when scope==TEAM
|
54
|
-
print "\tnew repository\t\tCreate a repository to this team\n"
|
55
|
-
end
|
56
|
-
print "\t\t\t\t->\tnew repository [name of the repository]\n\n"
|
57
|
-
end
|
58
|
-
|
59
|
-
def rm_repository(scope)
|
60
|
-
case
|
61
|
-
when scope==USER
|
62
|
-
print "\trm repository\t\tDelete a repository in your personal account\n"
|
63
|
-
when scope==ORGS
|
64
|
-
print "\trm repository\t\tDelete a repository in a organization\n"
|
65
|
-
when scope==TEAM
|
66
|
-
print "\trm repository\t\tDelete a repository of a team\n"
|
67
|
-
end
|
68
|
-
print "\t\t\t\t->\trm repository [name of the repository]\n\n"
|
69
|
-
end
|
70
|
-
|
71
|
-
def open(scope)
|
72
|
-
case
|
73
|
-
when scope==USER
|
74
|
-
print "\topen\t\t\tOpen the user's url of github in your web browser.\n"
|
75
|
-
when scope==ORGS
|
76
|
-
print "\topen\t\t\tOpen the organization's url of github in your web browser.\n"
|
77
|
-
print "\t\t\t\tIf you have added the aditional .csv information with, you can open an specific github profile.\n"
|
78
|
-
print "\t\t\t\t->\topen [user]\n\n"
|
79
|
-
print "\t\t\t\tYou can use a RegExp to open several users.\n"
|
80
|
-
print "\t\t\t\t->\topen /RegExp/\n\n"
|
81
|
-
print "\t\t\t\tYou can open an specific field if its contains an url.\n"
|
82
|
-
print "\t\t\t\t->\topen [user] [fieldname]\n\n"
|
83
|
-
print "\t\t\t\tIf you don't want to put the whole field, you can open the url contained with \"/\" parameter.\n"
|
84
|
-
print "\t\t\t\t->\topen [user] /[part of the url]/\n\n"
|
85
|
-
print "\t\t\t\tYo can also use the RegExp in first parameter too, in order to open several websites.\n"
|
86
|
-
print "\t\t\t\t->\topen /RegExp/ /[part of the url]/\n\n"
|
87
|
-
when scope==ORGS_REPO
|
88
|
-
print "\topen\t\t\tOpen the repository's url of github in your web browser.\n"
|
89
|
-
when scope==TEAM
|
90
|
-
print "\topen\t\t\tOpen the team's url of github in your web browser.\n"
|
91
|
-
when scope==TEAM_REPO
|
92
|
-
print "\topen\t\t\tOpen the repository's url of github in your web browser.\n"
|
93
|
-
when scope==ASSIG
|
94
|
-
print "\topen\t\t\topen the github assignment repositories disposition\n"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def rm_clone_files(scope)
|
99
|
-
print "\trm clone files\t\tDelete the repositories cloned with GHEDSH.\n"
|
100
|
-
print "\t\t\t\tYou can use a RegExp to choose the repositories that you want to be deleted\n"
|
101
|
-
print "\t\t\t\t->\trm clone files /RegExp/\n\n"
|
102
|
-
end
|
103
|
-
alias_method :rm_clone,:rm_clone_files
|
104
|
-
def people(scope)
|
105
|
-
case
|
106
|
-
when scope==ORGS
|
107
|
-
print "\tpeople\t\t\tMembers of the organization\n"
|
108
|
-
print "\t\t\t\t->\tpeople\n\n"
|
109
|
-
print "\t\t\t\tIf you add the parameter 'info', the extended information will be showed\n"
|
110
|
-
print "\t\t\t\t->\tpeople info\n\n"
|
111
|
-
print "\t\t\t\tTo find a specific member extended info, you can give the github id as parameter.\n"
|
112
|
-
print "\t\t\t\t->\tpeople info [github id]\n\n"
|
113
|
-
print "\t\t\t\tTo use a RegExp search in each field of the information, you can use the parameter /.\n"
|
114
|
-
print "\t\t\t\t->\tpeople info /[RegExp]/\n\n"
|
115
|
-
when scope==TEAM
|
116
|
-
print "\tpeople\t\t\tMembers of the team\n"
|
117
|
-
end
|
118
|
-
end
|
119
|
-
alias_method :people_info, :people
|
120
|
-
|
121
|
-
def cd(scope)
|
122
|
-
print "\tcd\t\t\tGo to the path. Could be an assignment, an organization, a team or a repository\n"
|
123
|
-
print "\t\t\t\t->\tcd [path]\n\n"
|
124
|
-
print "\t\t\t\tFor going to the user root path use cd without argument:\n"
|
125
|
-
print "\t\t\t\t->\tcd\n\n"
|
126
|
-
print "\t\t\t\tYou can go back to the previous level with the argument ".."\n"
|
127
|
-
print "\t\t\t\t->\tcd [..]\n\n"
|
128
|
-
print "\t\t\t\tDefault search look for repositories at the end of the queue.\n"
|
129
|
-
print "\t\t\t\tIf you want to look for an specific repository use: \n"
|
130
|
-
print "\t\t\t\t->\tcd repo [name] \n\n"
|
131
|
-
end
|
132
|
-
|
133
|
-
def groups(scope)
|
134
|
-
case
|
135
|
-
when scope==ORGS
|
136
|
-
print "\tgroups\t\t\tShow the list of groups with each team and user that it has\n"
|
137
|
-
print "\tgroup\t\t\tShow the information of an specific group\n"
|
138
|
-
print "\t\t\t\t->\tgroup [name of the group]\n\n"
|
139
|
-
print "\tnew group\t\tCreate a new group. Expected the name and teams given one by one\n"
|
140
|
-
print "\t\t\t\t->\tnew group [name of the group] [team1] [team2] [team3] ... \n\n"
|
141
|
-
print "\t\t\t\tIf you want to import the teams from a file, use the parameter -f\n"
|
142
|
-
print "\t\t\t\t->\tnew group -f [name of the group] [file]\n\n"
|
143
|
-
print "\trm group\t\tDelete a created group\n"
|
144
|
-
print "\t\t\t\t->\trm group [name of the group]\n\n"
|
145
|
-
end
|
146
|
-
end
|
147
|
-
alias_method :group,:groups
|
148
|
-
alias_method :new_group,:groups
|
149
|
-
alias_method :rm_group,:groups
|
150
|
-
|
151
|
-
def teams(scope)
|
152
|
-
case
|
153
|
-
when scope==ORGS
|
154
|
-
print "\tteams\t\t\tTeams of a organization\n"
|
155
|
-
print "\trm team\t\t\tDelete a team in you organization. Expected the name of the team\n"
|
156
|
-
print "\t\t\t\t->\trm team [name of the team]\n\n"
|
157
|
-
print "\tnew team\t\tCreate a team in the organization. Expected the name of the team, and/or members given one by one\n"
|
158
|
-
print "\t\t\t\t->\tnew team [name of the team] [member1] [member2] [member3] ... \n\n"
|
159
|
-
end
|
160
|
-
end
|
161
|
-
alias_method :rm_team, :teams
|
162
|
-
alias_method :new_team, :teams
|
163
|
-
|
164
|
-
def assignments(scope)
|
165
|
-
case
|
166
|
-
when scope==ORGS
|
167
|
-
print "\tassignments\t\tShow the list of assignments created\n"
|
168
|
-
print "\tnew assignment\t\tCreate an Assignment in your organization\n"
|
169
|
-
print "\t\t\t\t->\tnew assignment [name of the assignment]\n\n"
|
170
|
-
end
|
171
|
-
end
|
172
|
-
alias_method :new_assignment, :assignments
|
173
|
-
|
174
|
-
def issues(scope)
|
175
|
-
if scope==ORGS_REPO || scope==TEAM_REPO || scope==USER_REPO
|
176
|
-
print "\tnew issue\t\tCreates a new issue\n"
|
177
|
-
print "\tissues\t\t\tShow the list of issues from the repository\n"
|
178
|
-
print "\tissue\t\t\tShow the issue and its comments\n"
|
179
|
-
print "\t\t\t\t->\tissue [Id of the issue]\n\n"
|
180
|
-
print "\tnew issue comment\tAdd a comment in a specific issue\n"
|
181
|
-
print "\t\t\t\t->\tnew issue comment [Id of the issue]\n\n"
|
182
|
-
print "\topen issue\t\tOpen a closed issue\n"
|
183
|
-
print "\t\t\t\t->\topen issue [Id of the issue]\n\n"
|
184
|
-
print "\tclose issue\t\tClose an opened issue\n"
|
185
|
-
print "\t\t\t\t->\tclose issue [Id of the issue]\n\n"
|
186
|
-
end
|
187
|
-
end
|
188
|
-
alias_method :new_issue,:issues
|
189
|
-
alias_method :issue,:issues
|
190
|
-
alias_method :open_issue,:issues
|
191
|
-
alias_method :close_issue,:issues
|
192
|
-
|
193
|
-
def new_people_info(scope)
|
194
|
-
if scope==ORGS
|
195
|
-
print "\tnew relation\t\tSet a relation for the extendend information between Github ID and an email from a .csv file\n"
|
196
|
-
print "\t\t\t\t->\tnew relation [name of the file]\n\n"
|
197
|
-
print "\tnew people info\t\tGet extended information from a .csv file founded in the excecute path\n"
|
198
|
-
print "\t\t\t\t->\tnew people info [name of the file]\n\n"
|
199
|
-
print "\trm people info\t\tDelete the extended information\n"
|
200
|
-
end
|
201
|
-
end
|
202
|
-
alias_method :new_relation,:new_people_info
|
203
|
-
alias_method :rm_people_info,:new_people_info
|
204
|
-
|
205
|
-
def info(scope)
|
206
|
-
|
207
|
-
if scope==USER
|
208
|
-
end
|
209
|
-
if scope==USER_REPO || scope==ORGS_REPO || scope==TEAM_REPO
|
210
|
-
print "\tinfo\t\t\tShow information about the repository\n"
|
211
|
-
end
|
212
|
-
if scope==ASSIG
|
213
|
-
print "\tinfo\t\t\t\Show information about the assignment\n"
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
def user()
|
218
|
-
self.common_opt
|
219
|
-
puts " Users options:"
|
220
|
-
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
221
|
-
print "\torgs\t\t\tShow your organizations\n"
|
222
|
-
self.open(USER)
|
223
|
-
self.repos(USER)
|
224
|
-
self.clone(USER)
|
225
|
-
self.new_repository(USER)
|
226
|
-
self.rm_repository(USER)
|
227
|
-
print "\tset\t\t\tMove you to a specific repository\n"
|
228
|
-
end
|
229
|
-
|
230
|
-
def org()
|
231
|
-
self.common_opt
|
232
|
-
puts " Organization options:"
|
233
|
-
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
234
|
-
self.repos(ORGS)
|
235
|
-
self.clone(ORGS)
|
236
|
-
self.new_repository(ORGS)
|
237
|
-
self.rm_repository(ORGS)
|
238
|
-
self.open(ORGS)
|
239
|
-
print "\tset\t\t\tMove you to a specific repository\n"
|
240
|
-
self.people(ORGS)
|
241
|
-
self.new_people_info(ORGS)
|
242
|
-
self.assignments(ORGS)
|
243
|
-
self.groups(ORGS)
|
244
|
-
self.teams(ORGS)
|
245
|
-
end
|
246
|
-
|
247
|
-
def org_repo()
|
248
|
-
self.common_opt
|
249
|
-
puts " Repository options:"
|
250
|
-
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
251
|
-
self.info(ORGS_REPO)
|
252
|
-
self.clone(ORGS_REPO)
|
253
|
-
self.open(ORGS_REPO)
|
254
|
-
print "\tcommits\t\t\tShow the list of commits from the repository\n"
|
255
|
-
self.issues(ORGS_REPO)
|
256
|
-
print "\tfiles\t\t\tShow the files of the repository path given\n"
|
257
|
-
print "\tcat\t\t\tShow data from a file\n"
|
258
|
-
print "\t\t\t\t->\tcat [file]\n\n"
|
259
|
-
print "\tprivate\t\t\tChange the privacy of a repository. Expected 'true' or 'false' as parameter.\n"
|
260
|
-
print "\t\t\t\t->\tprivate [true]\n\n"
|
261
|
-
print "\tcol\t\t\tShow the list of collaborators from the repository\n\n"
|
262
|
-
end
|
263
|
-
|
264
|
-
def orgs_teams()
|
265
|
-
self.common_opt
|
266
|
-
puts " Organization team options:"
|
267
|
-
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
268
|
-
self.repos(TEAM)
|
269
|
-
self.people(TEAM)
|
270
|
-
self.clone(TEAM)
|
271
|
-
self.open(TEAM)
|
272
|
-
print "\tadd team member\t\tAdd a member in the team\n\n"
|
273
|
-
print "\t\t\t\t->\tadd team member [new member]\n\n"
|
274
|
-
end
|
275
|
-
|
276
|
-
def user_repo()
|
277
|
-
self.common_opt
|
278
|
-
puts " Repository options:"
|
279
|
-
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
280
|
-
self.info(USER_REPO)
|
281
|
-
self.clone(USER_REPO)
|
282
|
-
self.open(USER_REPO)
|
283
|
-
print "\tcommits\t\t\tShow the list of commits from the repository\n"
|
284
|
-
self.issues(USER_REPO)
|
285
|
-
print "\tfiles\t\t\tShow the files of the repository path given\n"
|
286
|
-
print "\tcat\t\t\tShow data from a file\n"
|
287
|
-
print "\t\t\t\t->\tcat [file]\n\n"
|
288
|
-
print "\tprivate\t\t\tChange the privacy of a repository. Expected 'true' or 'false' as parameter.\n"
|
289
|
-
print "\t\t\t\t->\tprivate [true]\n\n"
|
290
|
-
print "\topen\t\t\tOpen the repository's url of github in your web browser.\n"
|
291
|
-
print "\tcol\t\t\tShow the list of collaborators from the repository\n\n"
|
292
|
-
end
|
293
|
-
|
294
|
-
def asssig()
|
295
|
-
self.common_opt
|
296
|
-
puts " Assignment options:"
|
297
|
-
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
298
|
-
self.info(ASSIG)
|
299
|
-
print "\tadd repo\t\tAdd or create the repository of the assignment\n"
|
300
|
-
print "\tchange repo\t\tChange a repository of the assignment\n"
|
301
|
-
print "\t\t\t\t->\tchange repo [number of the repo]\n\n"
|
302
|
-
print "\trm repo\t\t\tDelete a repository from the assignment list.\n"
|
303
|
-
print "\t\t\t\t->\trm repo [id]\n\n"
|
304
|
-
print "\tchange sufix\t\tChange a sufix from a repository of the assignment\n"
|
305
|
-
print "\t\t\t\t->\tchange sufix [number of the repo]\n\n"
|
306
|
-
print "\tadd group\t\tAdd a new group to the assignment\n"
|
307
|
-
print "\trm group\t\tDelete a group from the assignment list.\n"
|
308
|
-
print "\t\t\t\t->\trm group [name]\n\n"
|
309
|
-
print "\t\t\t\tTo delete all the groups list, use the parameter -all.\n"
|
310
|
-
print "\t\t\t\t->\trm group -all\n\n"
|
311
|
-
self.open(ASSIG)
|
312
|
-
print "\tadd students\t\tAdd new students to the assignment\n"
|
313
|
-
print "\trm student\t\tDelete a student from the assignment list.\n"
|
314
|
-
print "\t\t\t\t->\trm student [name]\n\n"
|
315
|
-
print "\t\t\t\tTo delete all the students list, use the parameter -all.\n"
|
316
|
-
print "\t\t\t\t->\trm student -all\n\n"
|
317
|
-
print "\tmake\t\t\tCreate the repository assignment in Github for each team of every group\n\n"
|
318
|
-
end
|
319
|
-
|
320
|
-
def team_repo()
|
321
|
-
self.common_opt
|
322
|
-
puts " Repository options:"
|
323
|
-
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
324
|
-
self.info(TEAM_REPO)
|
325
|
-
self.clone(TEAM_REPO)
|
326
|
-
self.open(TEAM_REPO)
|
327
|
-
print "\tcommits\t\t\tShow the list of commits from the repository\n"
|
328
|
-
self.issues(TEAM_REPO)
|
329
|
-
print "\tfiles\t\t\tShow the files of the repository path given\n"
|
330
|
-
print "\tcat\t\t\tShow data from a file\n"
|
331
|
-
print "\t\t\t\t->\tcat [file]\n\n"
|
332
|
-
print "\tprivate\t\t\tChange the privacy of a repository. Expected 'true' or 'false' as parameter.\n"
|
333
|
-
print "\t\t\t\t->\tprivate [true]\n\n"
|
334
|
-
print "\tcol\t\t\tShow the list of collaborators from the repository\n\n"
|
335
|
-
end
|
336
|
-
|
337
|
-
def common_opt()
|
338
|
-
puts "\n------------------"
|
339
|
-
puts " List of commands "
|
340
|
-
puts "------------------"
|
341
|
-
puts "\n Main options:"
|
342
|
-
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
343
|
-
print "\tdo\t\t\tRun a script in ghedsh execute path\n"
|
344
|
-
print "\t\t\t\t->\tdo [filename]\n\n"
|
345
|
-
self.rm_clone_files(1)
|
346
|
-
print "\texit\t\t\tExit from this program\n"
|
347
|
-
print "\thelp\t\t\tList of commands available\n"
|
348
|
-
self.cd(1)
|
349
|
-
print "\t!\t\t\tExecute a bash command\n\n"
|
350
|
-
end
|
351
|
-
|
352
|
-
def welcome
|
353
|
-
puts "\nGitHub Education Shell!"
|
354
|
-
puts "_______________________\n\n"
|
355
|
-
end
|
356
|
-
|
357
|
-
end
|