renuo-cli 0.0.1 → 0.0.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 +4 -4
- data/.rubocop.yml +4 -0
- data/.travis.yml +1 -1
- data/Gemfile.lock +1 -1
- data/Rakefile +6 -1
- data/bin/check +12 -0
- data/bin/setup +1 -1
- data/exe/renuo +1 -1
- data/lib/renuo/cli/app/list_large_git_files.rb +7 -0
- data/lib/renuo/cli/app/migrate_to_github.rb +139 -0
- data/lib/renuo/cli/app/name_display.rb +12 -0
- data/lib/renuo/cli/version.rb +1 -1
- data/lib/renuo/cli.rb +49 -24
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a0ce6db8427a12ad6f7d7337958e50a048b6a1a
|
4
|
+
data.tar.gz: cc117b680088c4e8cecabe581c1f9f1634121ebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53820f3e806119541cb4376db32592de390af68120484d9fcd56f974f15351eac9dd48e7d9474478f7f2216059bedf4cfc54aa5e8faedbec54293e3494e323db
|
7
|
+
data.tar.gz: 1f203ca7d7e3d58fe171029fd78f95f3740acb5e17c55b040c276036eaab5e2f9abb3442d17cb9dd248b84d8bb41f3edd26f3003d1548b3c3c8257b5e66c054f
|
data/.rubocop.yml
CHANGED
@@ -10,6 +10,9 @@ Style/Documentation:
|
|
10
10
|
Style/NonNilCheck:
|
11
11
|
IncludeSemanticChanges: true
|
12
12
|
|
13
|
+
Metrics/ClassLength:
|
14
|
+
Max: 120
|
15
|
+
|
13
16
|
AllCops:
|
14
17
|
Include:
|
15
18
|
- '**/Rakefile'
|
@@ -18,4 +21,5 @@ AllCops:
|
|
18
21
|
- '*.gemspec'
|
19
22
|
Exclude:
|
20
23
|
- 'bin/**/*'
|
24
|
+
- 'lib/renuo/cli.rb'
|
21
25
|
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
|
+
require 'coveralls/rake/task'
|
4
|
+
require 'cucumber/rake/task'
|
3
5
|
|
4
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
Cucumber::Rake::Task.new
|
8
|
+
Coveralls::RakeTask.new
|
5
9
|
|
6
|
-
task
|
10
|
+
task test_with_coveralls: [:spec, :cucumber, 'coveralls:push']
|
11
|
+
task default: [:spec, :cucumber]
|
data/bin/check
CHANGED
data/bin/setup
CHANGED
data/exe/renuo
CHANGED
@@ -0,0 +1,139 @@
|
|
1
|
+
class MigrateToGithub
|
2
|
+
def initialize(project_name)
|
3
|
+
@project_name = project_name
|
4
|
+
@pwd = `pwd`.strip
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
return stop unless check_requirements
|
9
|
+
return stop unless check_pwd
|
10
|
+
|
11
|
+
transfer_git
|
12
|
+
update_readme
|
13
|
+
repo_settings
|
14
|
+
check_deploy
|
15
|
+
rename_repo
|
16
|
+
setup_ci
|
17
|
+
congrats
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def check_requirements
|
23
|
+
say('Please ensure that hub is installed (brew install hub)')
|
24
|
+
agree('Ready?')
|
25
|
+
end
|
26
|
+
|
27
|
+
def check_pwd
|
28
|
+
say("Project to transfer is called '#{@project_name}'. For the transfer, we will need these temporary directories")
|
29
|
+
say("* #{@pwd}/#{@project_name}")
|
30
|
+
say("* #{@pwd}/#{@project_name}.git")
|
31
|
+
say('If you want to use different directories, cd to a another directory, and run the command again.')
|
32
|
+
say("E.g.: cd ~/tmp ; mkdir transfer ; cd transfer ; renuo migrate-to-github #{@project_name}")
|
33
|
+
agree('Is that ok?')
|
34
|
+
end
|
35
|
+
|
36
|
+
def transfer_git
|
37
|
+
`git clone --mirror git@git.renuo.ch:renuo/#{@project_name}.git`
|
38
|
+
`cd #{@project_name}.git && hub create -p renuo/#{@project_name}`
|
39
|
+
`cd #{@project_name}.git && git push --mirror git@github.com:renuo/#{@project_name}.git`
|
40
|
+
`rm -rf #{@project_name}.git`
|
41
|
+
end
|
42
|
+
|
43
|
+
def update_readme
|
44
|
+
agree('Let us update the README.md now. Ready?')
|
45
|
+
|
46
|
+
`git clone git@github.com:renuo/#{@project_name}.git`
|
47
|
+
`cd #{@project_name} && git fetch --all && git checkout develop && git pull && git flow init -d`
|
48
|
+
File.write("#{@project_name}/README.md", File.read("#{@project_name}/README.md").gsub('git.renuo.ch', 'github.com'))
|
49
|
+
|
50
|
+
update_readme_loop
|
51
|
+
|
52
|
+
`cd #{@project_name} && git commit -m 'migrate to github' && git push --set-upstream origin develop`
|
53
|
+
`rm -rf #{@project_name}`
|
54
|
+
end
|
55
|
+
|
56
|
+
def update_readme_loop
|
57
|
+
loop do
|
58
|
+
puts `cd #{@project_name} && git add . && git status && git diff --staged`
|
59
|
+
break if agree('Does this look ok?')
|
60
|
+
ask("Please change it manually in #{@pwd}/#{@project_name}. Hit enter when you are done.")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def repo_settings
|
65
|
+
general_repo_settings
|
66
|
+
repo_collaborators
|
67
|
+
repo_branches
|
68
|
+
copy_hooks
|
69
|
+
end
|
70
|
+
|
71
|
+
def general_repo_settings
|
72
|
+
say('The repo settings are next')
|
73
|
+
say('Remove the features "Wikis" and "Issues"')
|
74
|
+
say('Close the tab when you are done')
|
75
|
+
agree('The browser will open automatically. Ready?')
|
76
|
+
`open https://github.com/renuo/#{@project_name}/settings`
|
77
|
+
end
|
78
|
+
|
79
|
+
def repo_collaborators
|
80
|
+
say("Next, assign Renuo-Team 'Renuo | Master' to project")
|
81
|
+
agree('Ready?')
|
82
|
+
`open https://github.com/renuo/#{@project_name}/settings/collaboration`
|
83
|
+
end
|
84
|
+
|
85
|
+
def repo_branches
|
86
|
+
say('Choose develop as default branch')
|
87
|
+
say('Protect branches master and develop')
|
88
|
+
agree('Ready?')
|
89
|
+
`open https://github.com/renuo/#{@project_name}/settings/branches`
|
90
|
+
end
|
91
|
+
|
92
|
+
def copy_hooks
|
93
|
+
say('Copy the hooks from gitlab to github. We will open two tabs this time (gitlab and github)')
|
94
|
+
agree('Ready?')
|
95
|
+
`open https://github.com/renuo/#{@project_name}/settings/hooks`
|
96
|
+
`open https://git.renuo.ch/renuo/#{@project_name}/hooks`
|
97
|
+
end
|
98
|
+
|
99
|
+
def check_deploy
|
100
|
+
say('Check the deployment scripts for the correct repository')
|
101
|
+
agree('Ready?')
|
102
|
+
`open https://deploy.renuo.ch/deployment_configs`
|
103
|
+
say('Now login to the deployment server, and change the remotes. E.g.')
|
104
|
+
cd = "cd deployments/#{@project_name}"
|
105
|
+
say("#{cd}-master && git remote set-url origin git@github.com:renuo/#{@project_name}.git && cd ..")
|
106
|
+
say("#{cd}-develop && git remote set-url origin git@github.com:renuo/#{@project_name}.git && cd ..")
|
107
|
+
say("#{cd}-testing && git remote set-url origin git@github.com:renuo/#{@project_name}.git && cd ..")
|
108
|
+
agree('Ready?')
|
109
|
+
end
|
110
|
+
|
111
|
+
def rename_repo
|
112
|
+
say("Almost done. Rename the old repo to zzz-old-#{@project_name}")
|
113
|
+
say('* Project name')
|
114
|
+
say('* Path')
|
115
|
+
agree('Ready?')
|
116
|
+
`open https://git.renuo.ch/renuo/#{@project_name}/edit`
|
117
|
+
end
|
118
|
+
|
119
|
+
def setup_ci
|
120
|
+
say('One last thing: CI')
|
121
|
+
say('Find your CI script on the old CI:')
|
122
|
+
say('Click on <project> --> Settings --> preview')
|
123
|
+
agree('Ready?')
|
124
|
+
`open https://ci.renuo.ch/`
|
125
|
+
say("Enable TravisCI for #{@project_name}")
|
126
|
+
agree('Ready?')
|
127
|
+
`open https://magnum.travis-ci.com/profile/renuo`
|
128
|
+
end
|
129
|
+
|
130
|
+
def congrats
|
131
|
+
agree("That's it! Congrats!!")
|
132
|
+
agree('I hope you enjoy Github and TravisCI!')
|
133
|
+
agree('Cheers!')
|
134
|
+
end
|
135
|
+
|
136
|
+
def stop
|
137
|
+
say('Command aborted.')
|
138
|
+
end
|
139
|
+
end
|
@@ -1,5 +1,17 @@
|
|
1
1
|
class NameDisplay
|
2
|
+
def run(args, options)
|
3
|
+
return display_name('') if options.delete
|
4
|
+
|
5
|
+
return say('invalid customer name') if args.empty?
|
6
|
+
|
7
|
+
display_name(args.join(' '))
|
8
|
+
end
|
9
|
+
|
2
10
|
def display_name(name)
|
3
11
|
puts "TODO: display #{name}"
|
4
12
|
end
|
13
|
+
|
14
|
+
def delete_current
|
15
|
+
display_name('')
|
16
|
+
end
|
5
17
|
end
|
data/lib/renuo/cli/version.rb
CHANGED
data/lib/renuo/cli.rb
CHANGED
@@ -2,34 +2,59 @@ require 'renuo/cli/version'
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 'renuo/cli/app/name_display'
|
4
4
|
require 'renuo/cli/app/local_storage'
|
5
|
+
require 'renuo/cli/app/migrate_to_github'
|
6
|
+
require 'renuo/cli/app/list_large_git_files'
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
module Renuo
|
9
|
+
class CLI
|
10
|
+
def start
|
11
|
+
require 'commander/import'
|
12
|
+
program :version, Renuo::Cli::VERSION
|
13
|
+
program :description, 'renuo CLI'
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
command 'display-name'.to_sym do |c|
|
16
|
+
c.syntax = 'renuo display-name [options]'
|
17
|
+
c.summary = 'Sets the name of a customer on the Renuo dashboard'
|
18
|
+
c.description = 'Sets the name of a customer on the Renuo dashboard'
|
19
|
+
c.example 'Display "Peter Muster" on the dashboard', 'renuo display-name "Peter Muster"'
|
20
|
+
c.example 'Remove the current name from the dashboard', 'renuo display-name --delete'
|
21
|
+
c.option '--delete', 'Deletes the current name'
|
22
|
+
c.action do |args, options|
|
23
|
+
NameDisplay.new.run(args, options)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
command :config do |c|
|
28
|
+
c.syntax = 'renuo config [options]'
|
29
|
+
c.summary = 'Setup the config (API keys)'
|
30
|
+
c.description = 'Setup the config (API keys)'
|
31
|
+
c.action do
|
32
|
+
key = ask('API Key?') { |q| q.echo = '*' }
|
33
|
+
LocalStorage.new.store(:api_key, key)
|
34
|
+
say('stored the api key')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
command 'migrate-to-github' do |c|
|
39
|
+
c.syntax = 'renuo migrate-to-github [project]'
|
40
|
+
c.summary = 'A guide how to migrate from gitlab to github'
|
41
|
+
c.description = 'A guide how to migrate from gitlab to github'
|
42
|
+
c.example 'migrate the renuo-cli project', 'renuo migrate-to-github renuo-cli'
|
43
|
+
c.action do |args, _options|
|
44
|
+
MigrateToGithub.new(args.first).run
|
45
|
+
end
|
20
46
|
end
|
21
|
-
end
|
22
47
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
48
|
+
command 'list-large-git-files' do |c|
|
49
|
+
c.syntax = 'renuo list-large-git-files'
|
50
|
+
c.summary = 'Lists the 5 largest files in a git repository. Warning: must be a bare checkout of the repo!'
|
51
|
+
c.description = "Lists the 5 largest files in a git repository.\nWarning: must be a bare checkout of the repo!"
|
52
|
+
c.example 'list the 5 largest git files of github.com/renuo/renuo-cli',
|
53
|
+
'git clone --bare git@github.com:renuo/renuo-cli.git && '\
|
54
|
+
'cd renuo-cli.git && renuo list-large-git-files'
|
55
|
+
c.action do
|
56
|
+
ListLargeGitFiles.new.run
|
57
|
+
end
|
33
58
|
end
|
34
59
|
end
|
35
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renuo-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Elmer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -163,7 +163,9 @@ files:
|
|
163
163
|
- bin/setup
|
164
164
|
- exe/renuo
|
165
165
|
- lib/renuo/cli.rb
|
166
|
+
- lib/renuo/cli/app/list_large_git_files.rb
|
166
167
|
- lib/renuo/cli/app/local_storage.rb
|
168
|
+
- lib/renuo/cli/app/migrate_to_github.rb
|
167
169
|
- lib/renuo/cli/app/name_display.rb
|
168
170
|
- lib/renuo/cli/version.rb
|
169
171
|
- renuo-cli.gemspec
|