-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0570f1
commit f4c9059
Showing
12 changed files
with
282 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
name: UnitTest | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
push: | ||
branches: ["dev", "dev-update", "private-dk-dev-init"] | ||
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab | ||
|
||
jobs: | ||
UnitTest-Jest: | ||
name: UnitTest:Jest | ||
runs-on: ubuntu-22.04 # ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Run jest with coverage | ||
run: npm run coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const helpers = require('yeoman-test'); | ||
|
||
describe('generators:app', () => { | ||
describe('creates files without existing package', () => { | ||
let runResult; | ||
|
||
const config = {}; | ||
const expectedFiles = ['.gitignore']; | ||
|
||
beforeEach(async () => { | ||
runResult = await helpers | ||
.run(path.join(process.env.INIT_CWD, '/generators/app')) | ||
.withPrompts(config) | ||
.withLocalConfig(config); | ||
}); | ||
|
||
afterEach(() => { | ||
if (runResult) { | ||
runResult.restore(); | ||
} | ||
}); | ||
|
||
it('runs correctly', () => { | ||
runResult.assertFile(expectedFiles); | ||
}); | ||
}); | ||
|
||
describe('creates files with existing package', () => { | ||
let runResult; | ||
|
||
const config = { | ||
// generator_data | ||
sublime_version: '4.0.x', | ||
package_name: 'My-Package', | ||
package_description: 'My description.', | ||
github_username: 'dennykorsukewitz', | ||
github_fullname: 'Denny Korsukéwitz', | ||
generators: '', | ||
}; | ||
|
||
const expectedFiles = ['.gitignore']; | ||
|
||
beforeEach(async () => { | ||
runResult = await helpers | ||
.run(path.join(process.env.INIT_CWD, '/generators/app')) | ||
.withPrompts(config) | ||
.withLocalConfig(config); | ||
}); | ||
|
||
afterEach(() => { | ||
if (runResult) { | ||
runResult.restore(); | ||
} | ||
}); | ||
|
||
it('runs correctly', () => { | ||
runResult.assertFile(expectedFiles); | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Description: | ||
Creates a new python plugin. | ||
|
||
Example: | ||
yo sublime-package:plugin | ||
|
||
This will create: | ||
plugin.py: Default python template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const config = { | ||
name: 'README.md', | ||
priority: 5, | ||
versions: { | ||
'4.0.x': '', | ||
}, | ||
prompts: [], | ||
}; | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
'use strict'; | ||
/* eslint no-empty-function: ["error", { "allow": ["methods"] }] */ | ||
|
||
const Generator = require('yeoman-generator'); | ||
const chalk = require('chalk'); | ||
const yosay = require('yosay'); | ||
const path = require('path'); | ||
const helper = require('./../../src/helper.js'); | ||
const generator = path.basename(__dirname); | ||
const generator_config = require('./config.js'); | ||
|
||
let config = {}; | ||
let answers = {}; | ||
|
||
module.exports = class extends Generator { | ||
// initializing - Your initialization methods (checking current project state, getting configs, etc) | ||
async initializing() { | ||
|
||
// create or update config | ||
await helper.InitConfig(this, generator_config); | ||
|
||
// get current config | ||
config = this.config.getAll(); | ||
config.generator_name = generator_config.name || generator; | ||
} | ||
|
||
// prompting - Where you prompt users for options (where you’d call this.prompt()) | ||
async prompting() { | ||
this.log( | ||
yosay( | ||
`${chalk.green(config.generator_name)}`, | ||
), | ||
); | ||
answers = await this.prompt(generator_config.prompts); | ||
} | ||
|
||
// configuring - Saving configurations and configure the project (creating .editorconfig files and other metadata files) | ||
configuring() {} | ||
|
||
// default - If the method name doesn’t match a priority, it will be pushed to this group. | ||
default() {} | ||
|
||
// writing - Where you write the generator specific files (routes, controllers, etc) | ||
writing() { | ||
|
||
// merge data | ||
const data = { | ||
...config, | ||
...answers, | ||
}; | ||
|
||
// template path | ||
const template_path = 'README.md'; | ||
|
||
// destination path | ||
const destination_path = 'README.md'; | ||
|
||
this.renderTemplate( | ||
this.templatePath(template_path), | ||
this.destinationPath(destination_path), | ||
data, | ||
); | ||
} | ||
|
||
// conflicts - Where conflicts are handled (used internally) | ||
conflicts() { } | ||
|
||
// install - Where installations are run (npm, bower) | ||
install() {} | ||
|
||
// end - Called last, cleanup, say good bye, etc | ||
end() { | ||
helper.End(this, config); | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
|
||
import sublime | ||
import sublime_plugin | ||
|
||
|
||
def plugin_loaded(): | ||
|
||
global settings | ||
settings = sublime.load_settings("GitHubFileFetcher.sublime-settings") | ||
|
||
|
||
class ExampleCommand(sublime_plugin.TextCommand): | ||
def run(self, edit): | ||
|
||
self.view.insert(edit, 0, "Hello, World!") | ||
|
||
# Status Message | ||
sublime.status_message("Hello, World!") | ||
|
||
# Owner/Repository Selection. | ||
self.window.show_quick_panel( | ||
items=['yes', 'no'], | ||
on_select=self.quick_panel_selected, | ||
on_highlight=None, | ||
flags=32, | ||
selected_index=-1, | ||
placeholder="Your placeholder", | ||
) | ||
|
||
# Create search_string input panel | ||
self.window.show_input_panel( | ||
caption="Hello, World!", | ||
initial_text="Hello, World!", | ||
on_done=self.input_panel_set, | ||
on_change=None, | ||
on_cancel=None, | ||
) | ||
|
||
def quick_panel_selected(self, index): | ||
|
||
if index == -1: | ||
return | ||
|
||
def input_panel_set(self, value): | ||
|
||
if value == -1: | ||
return | ||
|
||
class ExampleCommand(sublime_plugin.WindowCommand): | ||
def run(self): | ||
|
||
self.view.insert(edit, 0, "Hello, World!") | ||
|
||
# Status Message | ||
sublime.status_message("Hello, World!") | ||
|
||
# Owner/Repository Selection. | ||
self.window.show_quick_panel( | ||
items=['yes', 'no'], | ||
on_select=self.quick_panel_selected, | ||
on_highlight=None, | ||
flags=32, | ||
selected_index=-1, | ||
placeholder="Your placeholder", | ||
) | ||
|
||
# Create search_string input panel | ||
self.window.show_input_panel( | ||
caption="Hello, World!", | ||
initial_text="Hello, World!", | ||
on_done=self.input_panel_set, | ||
on_change=None, | ||
on_cancel=None, | ||
) | ||
|
||
def quick_panel_selected(self, index): | ||
|
||
if index == -1: | ||
return | ||
|
||
def input_panel_set(self, value): | ||
|
||
if value == -1: | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,4 +94,3 @@ git clone [email protected]:<%= github_username %>/<%= package_name %>.git <%= pack | |
## Download | ||
|
||
For download see [<%= package_name %>](https://github.com/<%= github_username %>/<%= package_name %>/releases) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters