renuo-cli 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0eb5039386ffdffd329e3cfe77d6b4c71a08ba01
4
- data.tar.gz: eab4d8dc9c1aedddaa02d9784e7fc9de0e52e902
3
+ metadata.gz: ea4d424a283f3ee6479f46ec48a27529568e7a88
4
+ data.tar.gz: 67fd3687792a837d1e5acad6bbe3570d6efda24b
5
5
  SHA512:
6
- metadata.gz: 85f6f0e4c34ce27e3f1330d9ed9dfab300f3a65cac76ab89c113e7e149be567ed774aa32b421550d551c2b2aef116bffa87c617d6e88ff3aad4faf92ac46896d
7
- data.tar.gz: 662eab2263cf41bcbe71a7283152d36f1990794076d6df09e1db3e62ca8513b2e3ff0e6f9a2b42de65dd58bc19e0b2a995df76f719a1ab73ff07173d0d8058df
6
+ metadata.gz: 9d43ef8c0ef3fec4900cf44ecaa34d0a871f1ef13d685afb5be0c3eead3bd8396bd3ad60feb3460c609bf171ce8a00c1bcdda75a373468ab9c24d594695e2d1a
7
+ data.tar.gz: b62c416bbb58ca1aca630426fb107f7bb0927dc0cb6973b6364957deaaaeae6e6bffee68aa8a29c9815e4fae8569e4327eeb02e222ecca7d942cac507a0b13ce
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.3.0
data/.travis.yml CHANGED
@@ -1,10 +1,9 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 1.9.3
5
- - 2.0.0
6
4
  - 2.1
7
5
  - 2.2
6
+ - 2.3.0
8
7
  before_install: gem install bundler -v 1.10.6
9
8
  install:
10
9
  - bundle install --retry=3
@@ -0,0 +1,22 @@
1
+ require 'renuo/cli/app/services/markdown_parser_service'
2
+ require 'net/http'
3
+
4
+ # see https://www.gitbook.com/book/renuo/rails-application-setup-guide/edit#/edit/master/templates/auto_copy_files.md
5
+
6
+ class ApplicationSetupAutoConfig
7
+ def run
8
+ url = 'https://raw.githubusercontent.com/renuo/rails-application-setup-guide/master/templates/auto_copy_files.md'
9
+ data = Net::HTTP.get(URI(url))
10
+ files = MarkdownParserService.new.parse_markdown(data)
11
+ files.each { |file, hint| handle_file(file, hint) }
12
+ end
13
+
14
+ def handle_file(file, hint)
15
+ base_url = 'https://raw.githubusercontent.com/renuo/rails-application-setup-guide/master/templates/'
16
+ if agree("Overwrite #{file}?#{" Hint: #{hint})" if hint}")
17
+ `curl #{base_url}#{file} > #{file}`
18
+ else
19
+ puts "Skipping file #{base_url}#{file}"
20
+ end
21
+ end
22
+ end
@@ -13,6 +13,14 @@ class MigrateToGithub
13
13
 
14
14
  private
15
15
 
16
+ def task(description)
17
+ say("=> #{description}")
18
+ end
19
+
20
+ def ready
21
+ agree('Ready?')
22
+ end
23
+
16
24
  def run_tasks
17
25
  transfer_git
18
26
  update_readme
@@ -26,8 +34,8 @@ class MigrateToGithub
26
34
  end
27
35
 
28
36
  def check_requirements
29
- say('Please ensure that hub is installed (brew install hub)')
30
- agree('Ready?')
37
+ say('Please ensure that hub is installed (brew install hub) and connected to your account')
38
+ ready
31
39
  end
32
40
 
33
41
  def check_pwd
@@ -76,80 +84,80 @@ class MigrateToGithub
76
84
 
77
85
  def general_repo_settings
78
86
  say('The repo settings are next')
79
- say('Remove the features "Wikis" and "Issues"')
80
- say('Close the tab when you are done')
87
+ task('Remove the features "Wikis" and "Issues"')
88
+ task('Close the tab when you are done')
81
89
  agree('The browser will open automatically. Ready?')
82
90
  `open https://github.com/renuo/#{@project_name}/settings`
83
91
  end
84
92
 
85
93
  def repo_collaborators
86
- say("Next, assign Renuo-Team 'Renuo | Master' to project")
87
- agree('Ready?')
94
+ task("Next, assign Renuo-Team 'renuo' to project and grant 'write' permissions")
95
+ ready
88
96
  `open https://github.com/renuo/#{@project_name}/settings/collaboration`
89
97
  end
90
98
 
91
99
  def repo_branches
92
- say('Choose develop as default branch')
93
- say('Protect branches master and develop')
94
- agree('Ready?')
100
+ task('Choose develop as default branch')
101
+ task('Protect branches master and develop')
102
+ ready
95
103
  `open https://github.com/renuo/#{@project_name}/settings/branches`
96
104
  end
97
105
 
98
106
  def copy_hooks
99
- say('Copy the hooks from gitlab to github. We will open two tabs this time (gitlab and github)')
100
- agree('Ready?')
107
+ task('Copy the hooks from gitlab to github. We will open two tabs this time (gitlab and github)')
108
+ ready
101
109
  `open https://github.com/renuo/#{@project_name}/settings/hooks`
102
110
  `open https://git.renuo.ch/renuo/#{@project_name}/hooks`
103
111
  end
104
112
 
105
113
  def check_deploy
106
- say('Check the deployment scripts for the correct repository')
107
- agree('Ready?')
114
+ task('Check the deployment scripts for the correct repository')
115
+ ready
108
116
  `open https://deploy.renuo.ch/deployment_configs`
109
- say('Now login to the deployment server, and change the remotes. E.g.')
117
+ task('Now login to the deployment server as www-data, and change the remotes. E.g.')
110
118
  cd = "cd deployments/#{@project_name}"
111
119
  say("#{cd}-master && git remote set-url origin git@github.com:renuo/#{@project_name}.git && cd ../..")
112
120
  say("#{cd}-develop && git remote set-url origin git@github.com:renuo/#{@project_name}.git && cd ../..")
113
121
  say("#{cd}-testing && git remote set-url origin git@github.com:renuo/#{@project_name}.git && cd ../..")
114
- agree('Ready?')
122
+ ready
115
123
  end
116
124
 
117
125
  def rename_repo
118
- say("Almost done. Rename the old repo to zzz-old-#{@project_name}")
119
- say('* Project name')
120
- say('* Path')
121
- agree('Ready?')
126
+ task("Almost done. Rename the old repo to zzz-old-#{@project_name}")
127
+ say(' * Project name')
128
+ say(' * Path')
129
+ ready
122
130
  `open https://git.renuo.ch/renuo/#{@project_name}/edit`
123
131
  end
124
132
 
125
133
  def replace_other_old_links
126
134
  say('Now let\'s replace other old links in the repo!')
127
- agree('Ready?')
135
+ ready
128
136
  `open https://github.com/renuo/#{@project_name}/search?q=git.renuo.ch`
129
- say('Replace all those links!')
130
- agree('Ready?')
131
- say('Now let\'s replace other old links in the wiki!')
137
+ task('Replace all those links!')
138
+ ready
139
+ task('Now let\'s replace other old links in the wiki!')
132
140
  `open https://redmine.renuo.ch/search?q=git.renuo.ch/renuo/#{@project_name}&wiki_pages=1&attachments=0&options=0`
133
- say('Replace all those links!')
134
- agree('Ready?')
141
+ task('Replace all those links!')
142
+ ready
135
143
  end
136
144
 
137
145
  def setup_gemnasium
138
146
  say('Now the security monitoring: Gemnasium')
139
- say('Go to https://gemnasium.com/dashboard and add the new project via GitHub')
140
- say("Add new project --> Hosted on GitHub --> Renuo --> Check #{@project_name} and click submit")
141
- agree('Ready?')
147
+ task('Go to https://gemnasium.com/dashboard and add the new project via GitHub')
148
+ task("Add new project --> Hosted on GitHub --> Renuo --> Check #{@project_name} and click submit")
149
+ ready
142
150
  `open https://gemnasium.com/dashboard`
143
151
  end
144
152
 
145
153
  def setup_ci
146
154
  say('One last thing: CI')
147
155
  say('Find your CI script on the old CI:')
148
- say('Click on <project> --> Settings --> preview')
149
- agree('Ready?')
156
+ task('Click on <project> --> Settings --> preview')
157
+ ready
150
158
  `open https://ci.renuo.ch/`
151
159
  say("Enable TravisCI for #{@project_name}")
152
- agree('Ready?')
160
+ ready
153
161
  `open https://magnum.travis-ci.com/profile/renuo`
154
162
  end
155
163
 
@@ -0,0 +1,30 @@
1
+ require 'redcarpet'
2
+
3
+ class MarkdownParserService
4
+ class ListExtractor < Redcarpet::Render::Base
5
+ attr_reader :files
6
+
7
+ def list(_contents, _list_type)
8
+ @next_is_hint = true
9
+ ''
10
+ end
11
+
12
+ def list_item(text, _list_type)
13
+ @files ||= []
14
+ if @next_is_hint
15
+ @files.last.unshift text.strip
16
+ @next_is_hint = false
17
+ else
18
+ @files << [text.strip]
19
+ end
20
+ ''
21
+ end
22
+ end
23
+
24
+ def parse_markdown(markdown_text)
25
+ renderer = ListExtractor.new
26
+ markdown = Redcarpet::Markdown.new(renderer)
27
+ markdown.render(markdown_text)
28
+ renderer.files
29
+ end
30
+ end
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  module Renuo
2
3
  module Cli
3
- VERSION = '0.0.8'
4
+ VERSION = '0.0.9'.freeze
4
5
  end
5
6
  end
data/lib/renuo/cli.rb CHANGED
@@ -5,6 +5,7 @@ require 'renuo/cli/app/local_storage'
5
5
  require 'renuo/cli/app/migrate_to_github'
6
6
  require 'renuo/cli/app/list_large_git_files'
7
7
  require 'renuo/cli/app/generate_password'
8
+ require 'renuo/cli/app/application_setup_auto_config'
8
9
 
9
10
  module Renuo
10
11
  class CLI
@@ -67,6 +68,16 @@ module Renuo
67
68
  GeneratePassword.new.run
68
69
  end
69
70
  end
71
+
72
+ command 'application-setup-auto-config' do |c|
73
+ c.syntax = 'renuo application-setup-auto-config'
74
+ c.summary = 'Sets up the application setup using the default config'
75
+ c.description = 'Generates a phrase of random 0-9a-zA-Z characters. Choose a substring of it as a new password.'
76
+ c.example 'renuo application-setup-auto-config', 'applies the default config'
77
+ c.action do
78
+ ApplicationSetupAutoConfig.new.run
79
+ end
80
+ end
70
81
  end
71
82
  end
72
83
  end
data/renuo-cli.gemspec CHANGED
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'rubocop'
30
30
  spec.add_development_dependency 'pry'
31
31
  spec.add_development_dependency 'coveralls'
32
+ spec.add_development_dependency 'redcarpet'
32
33
  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.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Elmer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-08 00:00:00.000000000 Z
11
+ date: 2016-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: redcarpet
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  description: The Renuo CLI automates some commonly used workflows by providing a command
140
154
  line interface.
141
155
  email:
@@ -154,7 +168,6 @@ files:
154
168
  - ".travis.yml"
155
169
  - CODE_OF_CONDUCT.md
156
170
  - Gemfile
157
- - Gemfile.lock
158
171
  - LICENSE.txt
159
172
  - README.md
160
173
  - Rakefile
@@ -163,11 +176,13 @@ files:
163
176
  - bin/setup
164
177
  - exe/renuo
165
178
  - lib/renuo/cli.rb
179
+ - lib/renuo/cli/app/application_setup_auto_config.rb
166
180
  - lib/renuo/cli/app/generate_password.rb
167
181
  - lib/renuo/cli/app/list_large_git_files.rb
168
182
  - lib/renuo/cli/app/local_storage.rb
169
183
  - lib/renuo/cli/app/migrate_to_github.rb
170
184
  - lib/renuo/cli/app/name_display.rb
185
+ - lib/renuo/cli/app/services/markdown_parser_service.rb
171
186
  - lib/renuo/cli/version.rb
172
187
  - renuo-cli.gemspec
173
188
  homepage: https://github.com/renuo/renuo-cli
@@ -190,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
205
  version: '0'
191
206
  requirements: []
192
207
  rubyforge_project:
193
- rubygems_version: 2.4.5.1
208
+ rubygems_version: 2.5.1
194
209
  signing_key:
195
210
  specification_version: 4
196
211
  summary: The Renuo CLI automates some commonly used workflows by providing a command
data/Gemfile.lock DELETED
@@ -1,119 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- renuo-cli (0.0.8)
5
- commander
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- aruba (0.10.0)
11
- childprocess (~> 0.5.6)
12
- contracts (~> 0.9)
13
- cucumber (>= 1.3.19)
14
- ffi (~> 1.9.10)
15
- rspec-expectations (>= 2.99)
16
- thor (~> 0.19)
17
- ast (2.1.0)
18
- astrolabe (1.3.1)
19
- parser (~> 2.2)
20
- builder (3.2.2)
21
- childprocess (0.5.7)
22
- ffi (~> 1.0, >= 1.0.11)
23
- coderay (1.1.0)
24
- commander (4.3.5)
25
- highline (~> 1.7.2)
26
- contracts (0.12.0)
27
- coveralls (0.8.3)
28
- json (~> 1.8)
29
- rest-client (>= 1.6.8, < 2)
30
- simplecov (~> 0.10.0)
31
- term-ansicolor (~> 1.3)
32
- thor (~> 0.19.1)
33
- cucumber (2.1.0)
34
- builder (>= 2.1.2)
35
- cucumber-core (~> 1.3.0)
36
- diff-lcs (>= 1.1.3)
37
- gherkin3 (~> 3.1.0)
38
- multi_json (>= 1.7.5, < 2.0)
39
- multi_test (>= 0.1.2)
40
- cucumber-core (1.3.0)
41
- gherkin3 (~> 3.1.0)
42
- diff-lcs (1.2.5)
43
- docile (1.1.5)
44
- domain_name (0.5.25)
45
- unf (>= 0.0.5, < 1.0.0)
46
- ffi (1.9.10)
47
- gherkin3 (3.1.2)
48
- highline (1.7.8)
49
- http-cookie (1.0.2)
50
- domain_name (~> 0.5)
51
- json (1.8.3)
52
- method_source (0.8.2)
53
- mime-types (2.6.2)
54
- multi_json (1.11.2)
55
- multi_test (0.1.2)
56
- netrc (0.11.0)
57
- parser (2.2.3.0)
58
- ast (>= 1.1, < 3.0)
59
- powerpack (0.1.1)
60
- pry (0.10.3)
61
- coderay (~> 1.1.0)
62
- method_source (~> 0.8.1)
63
- slop (~> 3.4)
64
- rainbow (2.0.0)
65
- rake (10.4.2)
66
- rest-client (1.8.0)
67
- http-cookie (>= 1.0.2, < 2.0)
68
- mime-types (>= 1.16, < 3.0)
69
- netrc (~> 0.7)
70
- rspec (3.3.0)
71
- rspec-core (~> 3.3.0)
72
- rspec-expectations (~> 3.3.0)
73
- rspec-mocks (~> 3.3.0)
74
- rspec-core (3.3.2)
75
- rspec-support (~> 3.3.0)
76
- rspec-expectations (3.3.1)
77
- diff-lcs (>= 1.2.0, < 2.0)
78
- rspec-support (~> 3.3.0)
79
- rspec-mocks (3.3.2)
80
- diff-lcs (>= 1.2.0, < 2.0)
81
- rspec-support (~> 3.3.0)
82
- rspec-support (3.3.0)
83
- rubocop (0.35.0)
84
- astrolabe (~> 1.3)
85
- parser (>= 2.2.3.0, < 3.0)
86
- powerpack (~> 0.1)
87
- rainbow (>= 1.99.1, < 3.0)
88
- ruby-progressbar (~> 1.7)
89
- ruby-progressbar (1.7.5)
90
- simplecov (0.10.0)
91
- docile (~> 1.1.0)
92
- json (~> 1.8)
93
- simplecov-html (~> 0.10.0)
94
- simplecov-html (0.10.0)
95
- slop (3.6.0)
96
- term-ansicolor (1.3.2)
97
- tins (~> 1.0)
98
- thor (0.19.1)
99
- tins (1.6.0)
100
- unf (0.1.4)
101
- unf_ext
102
- unf_ext (0.0.7.1)
103
-
104
- PLATFORMS
105
- ruby
106
-
107
- DEPENDENCIES
108
- aruba
109
- bundler (~> 1.10)
110
- coveralls
111
- cucumber
112
- pry
113
- rake (~> 10.0)
114
- renuo-cli!
115
- rspec
116
- rubocop
117
-
118
- BUNDLED WITH
119
- 1.10.6