site_hook 0.8.2 → 0.9.3

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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rspec +0 -2
  4. data/.rubocop.yml +2 -0
  5. data/Gemfile +1 -5
  6. data/Rakefile +35 -3
  7. data/bin/site_hook +5 -1
  8. data/features/get_help.feature +3 -0
  9. data/features/step_definitions/get_help_step_definition.rb +1 -0
  10. data/features/step_definitions/my_steps.rb +3 -0
  11. data/features/support/env.rb +1 -0
  12. data/lib/site_hook.rb +2 -28
  13. data/lib/site_hook/cli.rb +22 -39
  14. data/lib/site_hook/commands/config_class.rb +22 -68
  15. data/lib/site_hook/commands/jekyll_class.rb +38 -0
  16. data/lib/site_hook/commands/server_class.rb +38 -34
  17. data/lib/site_hook/config.rb +390 -14
  18. data/lib/site_hook/config_sections.rb +60 -9
  19. data/lib/site_hook/deprecate.rb +34 -11
  20. data/lib/site_hook/env/env.rb +2 -0
  21. data/lib/site_hook/exceptions.rb +26 -2
  22. data/lib/site_hook/log.rb +20 -15
  23. data/lib/site_hook/logger.rb +94 -173
  24. data/lib/site_hook/loggers.rb +10 -0
  25. data/lib/site_hook/loggers/access.rb +20 -0
  26. data/lib/site_hook/loggers/app.rb +78 -0
  27. data/lib/site_hook/loggers/build.rb +77 -0
  28. data/lib/site_hook/loggers/fake.rb +52 -0
  29. data/lib/site_hook/loggers/git.rb +81 -0
  30. data/lib/site_hook/loggers/hook.rb +74 -0
  31. data/lib/site_hook/methods.rb +26 -0
  32. data/lib/site_hook/paths.rb +65 -2
  33. data/lib/site_hook/prelogger.rb +88 -0
  34. data/lib/site_hook/prompt.rb +14 -0
  35. data/lib/site_hook/prompts/prompt_project.rb +48 -0
  36. data/lib/site_hook/runner.rb +36 -0
  37. data/lib/site_hook/sender.rb +4 -9
  38. data/lib/site_hook/string_ext.rb +57 -0
  39. data/lib/site_hook/version.rb +2 -2
  40. data/lib/site_hook/webhook.rb +120 -129
  41. data/site_hook.gemspec +39 -22
  42. data/spec/spec_helper.rb +13 -0
  43. data/spec/string_ext_spec.rb +10 -0
  44. metadata +87 -85
  45. data/CODE_OF_CONDUCT.md +0 -74
  46. data/bin/console +0 -14
  47. data/lib/site_hook/assets/css/styles.css +0 -26
  48. data/lib/site_hook/commands/debug_class.rb +0 -29
  49. data/lib/site_hook/config_sections/cli.rb +0 -24
  50. data/lib/site_hook/config_sections/log_levels.rb +0 -15
  51. data/lib/site_hook/config_sections/projects.rb +0 -22
  52. data/lib/site_hook/const.rb +0 -10
  53. data/lib/site_hook/gem.rb +0 -26
  54. data/lib/site_hook/persist.rb +0 -14
  55. data/lib/site_hook/prompts/gen_config.rb +0 -48
  56. data/lib/site_hook/spinner.rb +0 -19
  57. data/lib/site_hook/views/layout.haml +0 -24
  58. data/lib/site_hook/views/webhooks.haml +0 -7
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at me@iotaspencer.me. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "site_hook"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- require 'pry'
11
- Pry.start
12
-
13
- #require "irb"
14
- #IRB.start(__FILE__)
@@ -1,26 +0,0 @@
1
- body {
2
- background-color: #000;
3
- }
4
- h1 {
5
- color: darkgreen;
6
- }
7
- .list-group {
8
- border-radius: 5px;
9
- }
10
- .list-group-item {
11
- background-color: rgb(0, 51, 2);
12
- border-radius: 5px;
13
- }
14
- .list-group-item:hover {
15
- background-color: #3a3a3a;
16
- }
17
- a {
18
- color: darkgreen !important;
19
- text-decoration-color: darkgreen !important;
20
- }
21
- a:hover {
22
- color: green !important;
23
- }
24
- a:focus {
25
- color: green !important;
26
- }
@@ -1,29 +0,0 @@
1
- ##########
2
- # -> File: /home/ken/RubymineProjects/site_hook/lib/site_hook/debug_class.rb
3
- # -> Project: site_hook
4
- # -> Author: Ken Spencer <me@iotaspencer.me>
5
- # -> Last Modified: 6/10/2018 13:14:51
6
- # -> Copyright (c) 2018 Ken Spencer
7
- # -> License: MIT
8
- ##########
9
- require 'gli'
10
-
11
- module SiteHook
12
- class FileExistsError < StandardError
13
- end
14
-
15
- # *DebugClass*
16
- #
17
- # Holds all of the commands for the debug subcommand
18
- class App
19
- extend GLI::App
20
-
21
- desc "Return current paths for running site_hook"
22
- def paths
23
- home_gem_path = ENV['GEM_HOME']
24
- puts home_gem_path
25
- puts Pathname(::Gem.default_path.first).join('lib', 'site_hook')
26
- # puts .exist?
27
- end
28
- end
29
- end
@@ -1,24 +0,0 @@
1
- module SiteHook
2
- module ConfigSections
3
- class Cli
4
-
5
- def self.example
6
- [
7
- 'cli:',
8
- ' config:',
9
- ' mkpass:',
10
- ' symbols: 0',
11
- ' length: 8',
12
- ' gen-project:',
13
- ' config-file: _config.yml',
14
- ' add-project:',
15
- ' gen:'
16
-
17
-
18
-
19
-
20
- ]
21
- end
22
- end
23
- end
24
- end
@@ -1,15 +0,0 @@
1
- module SiteHook
2
- module ConfigSections
3
- class LogLevels
4
- def self.example
5
- [
6
- 'log_levels:',
7
- ' app: info',
8
- ' build: info',
9
- ' git: info',
10
- ' hook: info'
11
- ]
12
- end
13
- end
14
- end
15
- end
@@ -1,22 +0,0 @@
1
- module SiteHook
2
- module ConfigSections
3
- class Projects
4
- def self.example
5
- [
6
- 'projects:',
7
- ' PROJECT.NAME:',
8
- " config: _config.yml",
9
- " src: /path/2/site/source",
10
- " dst: /path/2/destination/",
11
- " host: git*.com",
12
- " repo: USER/REPO",
13
- " hookpass: SOMERANDOMSTRING",
14
- " private: true/false"
15
- ]
16
- end
17
- def initialize(**answers)
18
- @answers = answers
19
- end
20
- end
21
- end
22
- end
@@ -1,10 +0,0 @@
1
- require 'site_hook/log'
2
- require 'site_hook/logger'
3
- module SiteHook
4
- class Consts
5
- HOOKLOG = SiteHook::HookLogger::HookLog.new(SiteHook::Logs.log_levels['hook']).log
6
- BUILDLOG = SiteHook::HookLogger::BuildLog.new(SiteHook::Logs.log_levels['build']).log
7
- APPLOG = SiteHook::HookLogger::AppLog.new(SiteHook::Logs.log_levels['app']).log
8
- SHRC = YAML.load_file(Pathname(Dir.home).join('.jph', 'config'))
9
- end
10
- end
@@ -1,26 +0,0 @@
1
- ##########
2
- # -> File: /home/ken/RubymineProjects/site_hook/lib/site_hook/gem.rb
3
- # -> Project: site_hook
4
- # -> Author: Ken Spencer <me@iotaspencer.me>
5
- # -> Last Modified: 1/10/2018 21:20:45
6
- # -> Copyright (c) 2018 Ken Spencer
7
- # -> License: MIT
8
- ##########
9
- module SiteHook
10
- module Gem
11
- # class Info
12
- class Info
13
- def self.name
14
- 'site_hook'
15
- end
16
-
17
- def self.constant_name
18
- 'SiteHook'
19
- end
20
-
21
- def self.author
22
- 'Ken Spencer <me@iotaspencer.me>'
23
- end
24
- end
25
- end
26
- end
@@ -1,14 +0,0 @@
1
- require 'site_hook/const'
2
-
3
- module SiteHook
4
- class Options
5
- def self.set_options(global, local)
6
- global.each do |option, value|
7
- Options.class_variable_set(:"@@global-#{option}", value)
8
- end
9
- local.each do |option, value|
10
- Options.class_variable_set(:"@@local-#{option}", value)
11
- end
12
- end
13
- end
14
- end
@@ -1,48 +0,0 @@
1
- module SiteHook
2
- class GenConfig
3
- # @param [HighLine]
4
- def initialize(hl)
5
- @hl = hl
6
-
7
- end
8
- def prompt_project
9
- @hl.say "First What's the name of the project?"
10
- project_name = @hl.ask('> ')
11
-
12
- @hl.say "What's the source path? e.g. /home/#{ENV['USER']}/sites/site.tld"
13
- source_path = @hl.ask('> ')
14
-
15
- @hl.say 'Where is the web root? e.g. /var/www/sites/site.tld'
16
- dest_path = @hl.ask('> ')
17
-
18
- @hl.say 'The next things are for the public webhook list.'
19
- @hl.say "\n"
20
- @hl.say "\n"
21
- @hl.say "What's the hostname of the git service? e.g. github.com,"
22
- @hl.say "gitlab.com, git.domain.tld"
23
- git_host = @hl.ask('> ')
24
-
25
- @hl.say "What's the repo path? e.g. UserName/SiteName, UserName/site, etc."
26
- repo_path = @hl.ask('> ')
27
-
28
- @hl.say 'Is this repo allowed to be shown publically?'
29
- is_private = @hl.agree('> ', true) ? true : false
30
-
31
- @hl.say "Generating a hook password for you. If this one isn't wanted"
32
- @hl.say "then just change it afterwards using '#{exe_name} config mkpass'."
33
- hook_pass = RandomPassword.new(length: 20, symbols: 0).generate
34
- @hl.say 'Done.'
35
- @hl.say 'Outputting...'
36
- [
37
- " #{project_name}:",
38
- " src: #{source_path}",
39
- " dst: #{dest_path}",
40
- " hookpass: #{hook_pass}",
41
- " host: #{git_host}",
42
- " repo: #{repo_path}",
43
- " private: #{is_private}"
44
- ]
45
-
46
- end
47
- end
48
- end
@@ -1,19 +0,0 @@
1
- module SiteHook
2
- module_function
3
- def show_wait_spinner(fps = 10)
4
- chars = %w[| / - \\]
5
- delay = 1.0 / fps
6
- iter = 0
7
- spinner = Thread.new do
8
- while iter do # Keep spinning until told otherwise
9
- print chars[(iter += 1) % chars.length]
10
- sleep delay
11
- print "\b"
12
- end
13
- end
14
- yield.tap {# After yielding to the block, save the return value
15
- iter = false # Tell the thread to exit, cleaning up after itself…
16
- spinner.join # …and wait for it to do so.
17
- } # Use the block's return value as the method's
18
- end
19
- end
@@ -1,24 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %meta{charset: "utf-8"}
5
- %meta{name: "viewport", content: "width=device-width, initial-scale=1, shrink-to-fit=yes"}
6
- %link{rel: "stylesheet", href: "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css", integrity: "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm", crossorigin: "anonymous"}
7
- %link{rel: "stylesheet", href: "/css/styles.css"}
8
-
9
- %title Public site_hook Webhooks
10
- %body
11
- %header.d-flex
12
- %h1.d-flex.mx-auto Webhooks
13
-
14
- #content
15
- =yield
16
- %hr
17
- %footer.container-fluid
18
- %p.d-flex.justify-content-end.text-light
19
- %span.pr-1 Powered by
20
- %a{href: "https://iotaspencer.me/projects/site_hook"} SiteHook v#{SiteHook::VERSION}
21
-
22
- %script{src: "https://code.jquery.com/jquery-3.2.1.slim.min.js", integrity: "sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN", crossorigin: "anonymous"}
23
- %script{src: "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js", integrity: "sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q", crossorigin: "anonymous"}
24
- %script{src: "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js", integrity: "sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl", crossorigin: "anonymous"}
@@ -1,7 +0,0 @@
1
- #webhook-list.list-group
2
- - projects.each do |name, hsh|
3
- - if hsh.fetch('private', nil).nil? or hsh.fetch('private', nil) == false
4
- %a.list-group-item{id: "#{hsh['repo'].sub(/\./, '-').sub(/\//, '-')}", href: "https://#{hsh['host']}/#{hsh['repo']}"}
5
- %p.display-6 #{name}
6
- %span.badge.badge-pill.badge-dark
7
- https://#{hsh['host']}/#{hsh['repo']}