lumise 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/exe/lumise +16 -0
  3. data/lib/lumise/cli.rb +31 -0
  4. data/lib/lumise/cli.rbi +28 -0
  5. data/lib/lumise/command.rb +8 -0
  6. data/lib/lumise/commands/rubocop.rb +56 -0
  7. data/lib/lumise/commands/rubocop.rbi +48 -0
  8. data/lib/lumise/commands.rb +36 -0
  9. data/lib/lumise/commands.rbi +30 -0
  10. data/lib/lumise/configurations.rb +16 -0
  11. data/lib/lumise/configurations.rbi +1 -0
  12. data/lib/lumise/error.rb +6 -0
  13. data/lib/lumise/l.rb +10 -0
  14. data/lib/lumise/l.rbi +10 -0
  15. data/lib/lumise/logger.rb +7 -0
  16. data/lib/lumise/services/commands/rubocop/repo_files.rb +56 -0
  17. data/lib/lumise/services/commands/rubocop/repo_files.rbi +51 -0
  18. data/lib/lumise/services/commands/rubocop/update_files.rb +87 -0
  19. data/lib/lumise/services/commands/rubocop/update_files.rbi +67 -0
  20. data/lib/lumise/services/commands/rubocop/update_gems.rb +64 -0
  21. data/lib/lumise/services/commands/rubocop/update_gems.rbi +47 -0
  22. data/lib/lumise/services/commands/rubocop/update_todo.rb +52 -0
  23. data/lib/lumise/services/commands/rubocop/update_todo.rbi +43 -0
  24. data/lib/lumise/templates/.git +1 -0
  25. data/lib/lumise/templates/README.md +70 -0
  26. data/lib/lumise/templates/rubocop/.rubocop +1 -0
  27. data/lib/lumise/templates/rubocop/.rubocop.yml +17 -0
  28. data/lib/lumise/templates/rubocop/.rubocop_global.yml +58 -0
  29. data/lib/lumise/templates/rubocop/.rubocop_local.yml +3 -0
  30. data/lib/lumise/templates/rubocop/.rubocop_project.yml +29 -0
  31. data/lib/lumise/templates/rubocop/.rubocop_raw.yml +16 -0
  32. data/lib/lumise/templates/rubocop/.rubocop_todo.yml +5 -0
  33. data/lib/lumise/version.rb +6 -0
  34. data/lib/lumise/which/curl.rb +46 -0
  35. data/lib/lumise/which/curl.rbi +36 -0
  36. data/lib/lumise.rb +45 -0
  37. data/lib/lumise.rbi +12 -0
  38. data/lib/warning.rb +10 -0
  39. data/lib/warning.rbi +8 -0
  40. metadata +187 -0
@@ -0,0 +1,52 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Lumise
5
+ module Commands
6
+ class Rubocop < Lumise::Command
7
+ class UpdateTodo
8
+ include Commands
9
+ include L
10
+
11
+ def self.call(plugins:)
12
+ new(plugins: plugins).send :perform
13
+ end
14
+
15
+ def initialize(plugins:)
16
+ @plugins = plugins
17
+ end
18
+
19
+ private
20
+
21
+ attr_reader :plugins
22
+
23
+ def perform
24
+ if yes?
25
+ logger.info "#Running #{autogen_command}"
26
+ bundle_update
27
+ end
28
+ end
29
+
30
+ def bundle_update
31
+ command(printer: :quiet).run autogen_command
32
+ end
33
+
34
+ def yes?
35
+ if l.update_todo.nil?
36
+ prompt.yes? 'Update rubocop TODO file?', suffix: 'Yeah/nah'
37
+ else
38
+ l.update_todo
39
+ end
40
+ end
41
+
42
+ def autogen_command
43
+ <<~AUTOGEN
44
+ bundle exec rubocop --config .rubocop.yml \
45
+ --auto-gen-config --auto-gen-only-exclude \
46
+ --exclude-limit $(bundle exec rubocop -L | wc -l)
47
+ AUTOGEN
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,43 @@
1
+ # typed: strong
2
+ # frozen_string_literal: true
3
+
4
+ module Lumise
5
+ module Commands
6
+ class Rubocop < Lumise::Command
7
+ class UpdateTodo
8
+ include Commands
9
+ include L
10
+
11
+ sig { params(plugins: T::Array[String]).void }
12
+ def self.call(plugins:)
13
+ end
14
+
15
+ sig { params(plugins: T::Array[String]).void }
16
+ def initialize(plugins:)
17
+ @plugins = plugins
18
+ end
19
+
20
+ private
21
+
22
+ sig { returns T::Array[String] }
23
+ attr_reader :plugins
24
+
25
+ sig { void }
26
+ def perform
27
+ end
28
+
29
+ sig { void }
30
+ def bundle_update
31
+ end
32
+
33
+ sig { returns T::Boolean }
34
+ def yes?
35
+ end
36
+
37
+ sig { returns(String) }
38
+ def autogen_command
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1 @@
1
+ gitdir: ../../../.git/modules/lib/lumise/templates
@@ -0,0 +1,70 @@
1
+ # rubocop-config-example
2
+
3
+ ## .rubocop.yml
4
+ **This file is not meant to be modified**
5
+
6
+ This is the main configuration file.
7
+
8
+ It is used by default by your IDE, lefthook, the command line; and most
9
+ importantly, the CI.
10
+
11
+ This file should have no cops, and act only as a child file, inheriting from,
12
+ in order:
13
+ * `.rubocop_global.yml # or the file with the weird name`
14
+ * `.rubocop_project.yml`
15
+ * `.rubocop_todo.yml`
16
+ * `.rubocop_local.yml`
17
+
18
+ ## .rubocop_raw.yml
19
+ **This file is not meant to be modified**
20
+
21
+ Same as above, but without inheriting from the `todo` file.
22
+
23
+ As with .rubocop.yml, this file should have no cops, and only inherit from
24
+ elsewhere.
25
+
26
+ The purpose of this file is to be used with IDEs or rubocop CLI, so you can
27
+ **SEE THE TRUTH**.
28
+
29
+ ## .rubocop_global.yml
30
+ **This file is not meant to be modified**
31
+
32
+ This is Company's global rubocop config; the starting point for all of our
33
+ projects.
34
+
35
+ This file is hosted online, and is autoupdated locally by rubocop when needed.
36
+
37
+ In the project, this file will have a weird ass name.
38
+
39
+ ## .rubocop_project.yml
40
+ **This if the file to be modified after team decisions**
41
+
42
+ Anything deviating from Company's global standards should go here.
43
+
44
+ This should mainly include DSLs handling and exclusions.
45
+
46
+ ## .rubocop_todo.yml
47
+ **This file is autogenerated**
48
+
49
+ This file is autogenerated by rubocop with the intent of providing a clean run
50
+ afterwards.
51
+
52
+ For each file, every cop that has offenses will be completely disabled.
53
+
54
+ Recreate this file after rebasing and before pushing with this command:
55
+
56
+ ```sh
57
+ rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit $(rubocop -L | wc -l)
58
+ ```
59
+
60
+ ## .rubocop_local.yml
61
+ **The use of this file is completely optional for developers**
62
+
63
+ If by any change you want to adjust cops to be even more strict, this is the
64
+ place to do it.
65
+
66
+ One should have extreme care as to make changes be compliant with the default
67
+ config, as that is the one used by the CI.
68
+
69
+ As inherited files must be present, this file should be commited to the repo,
70
+ and ignored with `git --update-index --skip-worktree` if modified.
@@ -0,0 +1 @@
1
+ --config .rubocop_raw.yml
@@ -0,0 +1,17 @@
1
+ # Do not modify this file at all.
2
+ ---
3
+ inherit_from:
4
+ - .rubocop_global.yml
5
+ - .rubocop_project.yml
6
+ - .rubocop_todo.yml
7
+ - .rubocop_local.yml
8
+
9
+ inherit_mode:
10
+ merge:
11
+ - Exclude
12
+ - ExcludedMethods
13
+ {{# require }}
14
+
15
+ require:
16
+ {{ plugins }}
17
+ {{/ require }}
@@ -0,0 +1,58 @@
1
+ # Do not modify this file at all.
2
+ ---
3
+ AllCops:
4
+ NewCops: enable
5
+ Exclude:
6
+ - 'db/schema.rb'
7
+
8
+ Layout/ClassStructure:
9
+ Enabled: true
10
+
11
+ Layout/FirstArrayElementIndentation:
12
+ EnforcedStyle: consistent
13
+
14
+ Metrics/AbcSize:
15
+ Exclude:
16
+ - 'db/migrate/*'
17
+
18
+ Metrics/BlockLength:
19
+ Exclude:
20
+ - 'config/routes.rb'
21
+ ExcludedMethods:
22
+ - context
23
+ - describe
24
+
25
+ Metrics/MethodLength:
26
+ Max: 5
27
+ ExcludedMethods: []
28
+ Exclude:
29
+ - '**/*.rbi'
30
+ - 'db/**/*'
31
+
32
+ Metrics/ParameterLists:
33
+ Max: 4
34
+
35
+ {{# rspec }}
36
+ RSpec/EmptyExampleGroup:
37
+ Enabled: false
38
+
39
+ {{/ rspec }}
40
+ Style/AsciiComments:
41
+ Enabled: false
42
+
43
+ Style/Documentation:
44
+ Enabled: false
45
+
46
+ Style/EmptyMethod:
47
+ EnforcedStyle: expanded
48
+
49
+ Style/GuardClause:
50
+ Enabled: false
51
+
52
+ Style/IfUnlessModifier:
53
+ Enabled: false
54
+ {{# sorbet}}
55
+
56
+ Sorbet:
57
+ Enabled: false
58
+ {{/ sorbet}}
@@ -0,0 +1,3 @@
1
+ # As this file must exist for rubocop to work properly,
2
+ # tell git to ignore it if modified, using:
3
+ # git update-index --skip-worktree .rubocop_local.yml
@@ -0,0 +1,29 @@
1
+ ---
2
+ # Metric/MethodLength:
3
+ # Max: 5
4
+ {{# sorbet }}
5
+ #
6
+ # Sorbet/EnforceSignatures:
7
+ # Enabled: true
8
+ #
9
+ # Sorbet/ValidSigil:
10
+ # MinimumStrictness: ignore
11
+ #
12
+ # Sorbet/HasSigil:
13
+ # Enabled: true
14
+ #
15
+ # Sorbet/IgnoreSigil:
16
+ # Enabled: true
17
+ #
18
+ # Sorbet/FalseSigil:
19
+ # Enabled: true
20
+ #
21
+ # Sorbet/TrueSigil:
22
+ # Enabled: true
23
+ #
24
+ # Sorbet/StrictSigil:
25
+ # Enabled: true
26
+ #
27
+ # Sorbet/StrongSigil:
28
+ # Enabled: true
29
+ {{/ sorbet}}
@@ -0,0 +1,16 @@
1
+ # Do not modify this file at all.
2
+ ---
3
+ inherit_from:
4
+ - .rubocop_global.yml
5
+ - .rubocop_project.yml
6
+ - .rubocop_local.yml
7
+
8
+ inherit_mode:
9
+ merge:
10
+ - Exclude
11
+ - ExcludedMethods
12
+ {{# require }}
13
+
14
+ require:
15
+ {{ plugins }}
16
+ {{/ require }}
@@ -0,0 +1,5 @@
1
+ # Generate this file using:
2
+ # rubocop --auto-gen-config --auto-gen-only-exclude \
3
+ # --exclude-limit $(rubocop -L | wc -l)
4
+
5
+ # Don't forget to add bundle exec if needed!~
@@ -0,0 +1,6 @@
1
+ # typed: strong
2
+ # frozen_string_literal: true
3
+
4
+ module Lumise
5
+ VERSION = '0.2.1'
6
+ end
@@ -0,0 +1,46 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Lumise
5
+ module Which
6
+ module Curl
7
+ CurlError = Class.new(Error)
8
+
9
+ class << self
10
+ def call
11
+ if curl_exists?
12
+ curl_v
13
+ else
14
+ raise CurlError, "Couldn't find curl"
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def curl_exists?
21
+ TTY::Which.exist? 'curl'
22
+ end
23
+
24
+ def curl_v
25
+ command.run('curl -V') do |out, err|
26
+ raise CurlError, err if err
27
+
28
+ logger.success out.scan(curl_semver)
29
+ end
30
+ end
31
+
32
+ def command
33
+ TTY::Command.new(printer: :null)
34
+ end
35
+
36
+ def curl_semver
37
+ /curl \d*\.\d*\.\d*/
38
+ end
39
+
40
+ def logger
41
+ TTY::Logger.new
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,36 @@
1
+ # typed: strong
2
+ # frozen_string_literal: true
3
+
4
+ module Lumise
5
+ module Which
6
+ module Curl
7
+ class << self
8
+ sig { void }
9
+ def call
10
+ end
11
+
12
+ private
13
+
14
+ sig { returns T::Boolean }
15
+ def curl_exists?
16
+ end
17
+
18
+ sig { void }
19
+ def curl_v
20
+ end
21
+
22
+ sig { returns TTY::Command }
23
+ def command
24
+ end
25
+
26
+ sig { returns Regexp }
27
+ def curl_semver
28
+ end
29
+
30
+ sig { returns TTY::Logger }
31
+ def logger
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
data/lib/lumise.rb ADDED
@@ -0,0 +1,45 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require 'mustache'
5
+ require 'sorbet-runtime'
6
+ require 'thor'
7
+ require 'tty-command'
8
+ require 'tty-file'
9
+ require 'tty-logger'
10
+ require 'tty-prompt'
11
+ require 'tty-which'
12
+
13
+ require_relative 'warning'
14
+ require_relative 'lumise/error'
15
+ require_relative 'lumise/version'
16
+
17
+ require_relative 'lumise/configurations'
18
+ require_relative 'lumise/cli'
19
+ require_relative 'lumise/commands'
20
+ require_relative 'lumise/command'
21
+ require_relative 'lumise/l'
22
+ require_relative 'lumise/logger'
23
+
24
+ require_relative 'lumise/commands/rubocop'
25
+ require_relative 'lumise/services/commands/rubocop/repo_files'
26
+ require_relative 'lumise/services/commands/rubocop/update_gems'
27
+ require_relative 'lumise/services/commands/rubocop/update_files'
28
+ require_relative 'lumise/services/commands/rubocop/update_todo'
29
+ require_relative 'lumise/which/curl'
30
+
31
+ module Lumise
32
+ def self.config(&_blk)
33
+ yield Lumise::Configurations.instance
34
+ end
35
+
36
+ def self.load_dotfile
37
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__))
38
+ load '.lumise'
39
+ Logger.new.success 'loaded .lumise file'
40
+ rescue LoadError
41
+ Logger.new.error 'There was an error loading .lumise file'
42
+ end
43
+
44
+ load_dotfile
45
+ end
data/lib/lumise.rbi ADDED
@@ -0,0 +1,12 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Lumise
5
+ sig { returns Lumise::Configurations }
6
+ def self.config(&blk)
7
+ end
8
+
9
+ sig { void }
10
+ def self.load_dotfile
11
+ end
12
+ end
data/lib/warning.rb ADDED
@@ -0,0 +1,10 @@
1
+ # typed: strong
2
+ # frozen_string_literal: true
3
+
4
+ module Warning
5
+ def warn(msg)
6
+ unless 'keyword parameters'.match?(msg)
7
+ msg
8
+ end
9
+ end
10
+ end
data/lib/warning.rbi ADDED
@@ -0,0 +1,8 @@
1
+ # typed: strong
2
+ # frozen_string_literal: true
3
+
4
+ module Warning
5
+ sig { params(msg: T.any(Regexp, String)).returns(T.untyped) }
6
+ def warn(msg)
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lumise
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - vaporyhumo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mustache
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sorbet-runtime
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: tty-command
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: tty-file
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.8'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.8'
83
+ - !ruby/object:Gem::Dependency
84
+ name: tty-logger
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.3'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: tty-which
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.4'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.4'
111
+ description: 'Standardize your team''s gems configurations.
112
+
113
+ '
114
+ email:
115
+ - roanvilina@gmail.com
116
+ executables:
117
+ - lumise
118
+ extensions: []
119
+ extra_rdoc_files: []
120
+ files:
121
+ - exe/lumise
122
+ - lib/lumise.rb
123
+ - lib/lumise.rbi
124
+ - lib/lumise/cli.rb
125
+ - lib/lumise/cli.rbi
126
+ - lib/lumise/command.rb
127
+ - lib/lumise/commands.rb
128
+ - lib/lumise/commands.rbi
129
+ - lib/lumise/commands/rubocop.rb
130
+ - lib/lumise/commands/rubocop.rbi
131
+ - lib/lumise/configurations.rb
132
+ - lib/lumise/configurations.rbi
133
+ - lib/lumise/error.rb
134
+ - lib/lumise/l.rb
135
+ - lib/lumise/l.rbi
136
+ - lib/lumise/logger.rb
137
+ - lib/lumise/services/commands/rubocop/repo_files.rb
138
+ - lib/lumise/services/commands/rubocop/repo_files.rbi
139
+ - lib/lumise/services/commands/rubocop/update_files.rb
140
+ - lib/lumise/services/commands/rubocop/update_files.rbi
141
+ - lib/lumise/services/commands/rubocop/update_gems.rb
142
+ - lib/lumise/services/commands/rubocop/update_gems.rbi
143
+ - lib/lumise/services/commands/rubocop/update_todo.rb
144
+ - lib/lumise/services/commands/rubocop/update_todo.rbi
145
+ - lib/lumise/templates/.git
146
+ - lib/lumise/templates/README.md
147
+ - lib/lumise/templates/rubocop/.rubocop
148
+ - lib/lumise/templates/rubocop/.rubocop.yml
149
+ - lib/lumise/templates/rubocop/.rubocop_global.yml
150
+ - lib/lumise/templates/rubocop/.rubocop_local.yml
151
+ - lib/lumise/templates/rubocop/.rubocop_project.yml
152
+ - lib/lumise/templates/rubocop/.rubocop_raw.yml
153
+ - lib/lumise/templates/rubocop/.rubocop_todo.yml
154
+ - lib/lumise/version.rb
155
+ - lib/lumise/which/curl.rb
156
+ - lib/lumise/which/curl.rbi
157
+ - lib/warning.rb
158
+ - lib/warning.rbi
159
+ homepage: https://github.com/vaporyhumo/lumise
160
+ licenses:
161
+ - Unlicense
162
+ metadata:
163
+ bug_tracker_uri: https://github.com/vaporyhumo/lumise/issues
164
+ changelog_uri: https://github.com/vaporyhumo/lumise/blob/master/CHANGELOG.md
165
+ documentation_uri: https://www.rubydoc.info/gems/lumise
166
+ source_code_uri: https://github.com/vaporyhumo/lumise
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: 2.4.0
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements: []
182
+ rubyforge_project:
183
+ rubygems_version: 2.6.14.4
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: Stardard initializers for other gems.
187
+ test_files: []