KManager.action :bootstrap do
  def on_action
    application_name = :k_genesis
    director = Dsl::RubyGemDsl
      .init(k_builder,
        template_base_folder:       'ruby/gem',
        on_exist:                   :skip,                      # %i[skip write compare]
        on_action:                  :queue,                     # %i[queue execute]
        repo_name:                  application_name,
        application:                application_name,
        description:                'Conventional Gitflow provides tools for conventional git workflows including changelogs and SemVer',
        application_lib_path:       application_name.to_s,
        application_lib_namespace:  'KGenesis',
        namespaces:                 ['KGenesis'],
        author:                     'David Cruwys',
        author_email:               'david@ideasmen.com.au',
        avatar:                     'Developer',
        initial_semver:             '0.0.1',
        main_story:                 'As a Developer, I want to XYZ, so that I can XYZ',
        copyright_date:             '2022',
        website:                    'http://appydave.com/gems/k_genesis'
      )
      .github do
        parent.options.repo_info = repo_info

        # create_repository # (:k_genesis)
        # delete_repository # (:k_genesis)
        # list_repositories
        # open_repository # (:k_genesis)
      end
      .blueprint(
        name: :bin_hook,
        description: 'BIN/Hook structures',
        on_exist: :write) do

        cd(:app)
        self.dom = parent.options.to_h.merge(options.to_h)

        # debug

        # add('.gitignore')

        # add('bin/k')
        # add('bin/khotfix')
        # add('bin/kgitsync')
    
        # add('bin/setup')
        # add('bin/console')
    
        # add('bin/runonce/common.sh')
        # add('bin/runonce/setup-chmod.sh')
        # run_command("sudo chmod 755 './bin/runonce/setup-chmod.sh'")
        # add('bin/runonce/setup-git.sh')
        # run_command("cd bin/runonce && setup-git.sh")

        # run_command('git init')

        # add('bin/runonce/git-setup.sh', dom: dom)
        # run_template_script('bin/runonce/git-setup.sh', dom: dom)

        # enable sharable githooks (developer needs to turn this on before editing rep)
        run_command('git config core.hooksPath .githooks')

        add('.githooks/commit-msg')
        add('.githooks/pre-commit')
        add('.githooks/update-version')

        run_command('chmod +x .githooks/commit-msg')
        run_command('chmod +x .githooks/pre-commit')
        run_command('chmod +x .githooks/update-version')
        
      end

    # director.k_builder.debug
    director.play_actions
    # director.builder.logit
  end
end

# git remote add origin git@github.com:klueless-io/k_genesis.git
# git branch -M main
# git add .
# git commit -am 'first commit'
# git tag v0.0.1 -a -m 'k_genesis initialize repository'
# git push -u origin main --tags
