skippy 0.2.0.a → 0.3.0.a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.gitmodules +3 -0
- data/.idea/.rakeTasks +6 -6
- data/.idea/codeStyleSettings.xml +8 -8
- data/.idea/encodings.xml +5 -5
- data/.idea/inspectionProfiles/Project_Default.xml +7 -7
- data/.idea/misc.xml +3 -3
- data/.idea/modules.xml +7 -7
- data/.idea/skippy.iml +89 -82
- data/.idea/vcs.xml +5 -5
- data/.rubocop.yml +93 -0
- data/.rubocop_todo.yml +24 -0
- data/.vscode/launch.json +51 -61
- data/.vscode/settings.json +41 -2
- data/.vscode/tasks.json +16 -16
- data/Gemfile +11 -2
- data/README.md +194 -15
- data/Rakefile +1 -1
- data/app/boot.rb +1 -1
- data/app/commands/install.rb +41 -0
- data/app/commands/lib.rb +42 -2
- data/app/commands/new.rb +22 -8
- data/app/commands/template.rb +2 -2
- data/bin/rubocop +17 -0
- data/bin/ruby-parse +17 -0
- data/bin/ruby-rewrite +17 -0
- data/debug/skippy.bat +2 -0
- data/fixtures/my_lib/{src → modules}/command.rb +0 -0
- data/fixtures/my_lib/{src → modules}/geometry.rb +0 -0
- data/fixtures/my_lib/modules/gl.rb +4 -0
- data/fixtures/my_lib/modules/gl/container.rb +8 -0
- data/fixtures/my_lib/modules/gl/control.rb +6 -0
- data/fixtures/my_lib/modules/gl/nested/nested.rb +8 -0
- data/fixtures/my_lib/{src → modules}/tool.rb +0 -0
- data/fixtures/my_lib/skippy.json +1 -1
- data/fixtures/my_project/skippy.json +2 -1
- data/fixtures/my_project/src/hello_world.rb +2 -2
- data/fixtures/my_project/src/hello_world/extension.json +9 -9
- data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/command.rb +4 -0
- data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/gl.rb +4 -0
- data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/gl/container.rb +8 -0
- data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/gl/control.rb +6 -0
- data/fixtures/project_with_lib/.skippy/libs/my-lib/skippy.json +5 -0
- data/fixtures/project_with_lib/.skippy/libs/my-other-lib/modules/something.rb +4 -0
- data/fixtures/project_with_lib/.skippy/libs/my-other-lib/skippy.json +5 -0
- data/fixtures/project_with_lib/skippy.json +25 -0
- data/fixtures/project_with_lib/skippy/commands/example.rb +14 -0
- data/fixtures/project_with_lib/src/hello_world.rb +47 -0
- data/fixtures/project_with_lib/src/hello_world/extension.json +10 -0
- data/fixtures/project_with_lib/src/hello_world/main.rb +21 -0
- data/fixtures/project_with_lib/src/hello_world/vendor/my-lib/command.rb +4 -0
- data/fixtures/project_with_lib/src/hello_world/vendor/my-other-lib/something.rb +4 -0
- data/lib/skippy.rb +2 -0
- data/lib/skippy/app.rb +2 -2
- data/lib/skippy/cli.rb +41 -20
- data/lib/skippy/command.rb +2 -4
- data/lib/skippy/config.rb +27 -22
- data/lib/skippy/config_accessors.rb +12 -12
- data/lib/skippy/group.rb +1 -3
- data/lib/skippy/helpers/file.rb +3 -3
- data/lib/skippy/installer.rb +49 -0
- data/lib/skippy/installer/git.rb +115 -0
- data/lib/skippy/installer/local.rb +19 -0
- data/lib/skippy/lib_module.rb +16 -16
- data/lib/skippy/lib_source.rb +139 -0
- data/lib/skippy/library.rb +50 -10
- data/lib/skippy/library_manager.rb +116 -18
- data/lib/skippy/module_manager.rb +104 -26
- data/lib/skippy/namespace.rb +17 -1
- data/lib/skippy/project.rb +34 -4
- data/lib/skippy/version.rb +3 -1
- data/skippy.gemspec +10 -5
- metadata +85 -29
- data/cSpell.json +0 -18
data/app/commands/new.rb
CHANGED
@@ -9,13 +9,25 @@ class New < Skippy::Command::Group
|
|
9
9
|
include Thor::Actions
|
10
10
|
|
11
11
|
argument :namespace,
|
12
|
-
:
|
13
|
-
:
|
12
|
+
type: :string,
|
13
|
+
desc: 'The namespace the extension will use'
|
14
|
+
|
15
|
+
class_option :basename,
|
16
|
+
aliases: ['-b'],
|
17
|
+
type: :string,
|
18
|
+
desc: 'The basename for the extension filename'
|
19
|
+
|
20
|
+
class_option :downcase,
|
21
|
+
aliases: ['-d'],
|
22
|
+
type: :boolean,
|
23
|
+
desc: 'Downcase the generated basename for the extension filename',
|
24
|
+
default: false
|
14
25
|
|
15
26
|
class_option :template,
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
27
|
+
aliases: ['-t'],
|
28
|
+
type: :string,
|
29
|
+
desc: 'The template used to generate the project files',
|
30
|
+
default: 'standard'
|
19
31
|
|
20
32
|
source_paths << Skippy.app.resources
|
21
33
|
|
@@ -28,6 +40,8 @@ class New < Skippy::Command::Group
|
|
28
40
|
end
|
29
41
|
project.namespace = namespace
|
30
42
|
project.name = project.namespace.to_name
|
43
|
+
project.basename = options[:basename] || project.namespace.short_name
|
44
|
+
project.basename = project.basename.downcase if options[:downcase]
|
31
45
|
end
|
32
46
|
|
33
47
|
def validate_template
|
@@ -60,12 +74,12 @@ class New < Skippy::Command::Group
|
|
60
74
|
creator: project.author,
|
61
75
|
copyright: project.copyright,
|
62
76
|
license: project.license,
|
63
|
-
product_id: project.namespace.
|
77
|
+
product_id: project.namespace.short_name,
|
64
78
|
version: '0.1.0',
|
65
79
|
build: '1',
|
66
80
|
}
|
67
81
|
json = JSON.pretty_generate(extension_info)
|
68
|
-
json_filename = "src/#{
|
82
|
+
json_filename = "src/#{ext_name}/extension.json"
|
69
83
|
create_file(json_filename, json)
|
70
84
|
end
|
71
85
|
|
@@ -84,7 +98,7 @@ class New < Skippy::Command::Group
|
|
84
98
|
|
85
99
|
# @return [String] The basename for the extension files.
|
86
100
|
def ext_name
|
87
|
-
project.
|
101
|
+
project.basename
|
88
102
|
end
|
89
103
|
|
90
104
|
end # no_commands
|
data/app/commands/template.rb
CHANGED
@@ -15,12 +15,12 @@ class Template < Skippy::Command
|
|
15
15
|
default_command(:list)
|
16
16
|
|
17
17
|
desc 'install SOURCE', 'Install a new template'
|
18
|
-
def install(
|
18
|
+
def install(_source)
|
19
19
|
raise Skippy::Error, 'Not implemented'
|
20
20
|
end
|
21
21
|
|
22
22
|
desc 'remove TEMPLATE', 'Remove an installed template'
|
23
|
-
def remove(
|
23
|
+
def remove(_template_name)
|
24
24
|
raise Skippy::Error, 'Not implemented'
|
25
25
|
end
|
26
26
|
|
data/bin/rubocop
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rubocop' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rubocop", "rubocop")
|
data/bin/ruby-parse
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'ruby-parse' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("parser", "ruby-parse")
|
data/bin/ruby-rewrite
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'ruby-rewrite' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("parser", "ruby-rewrite")
|
data/debug/skippy.bat
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/fixtures/my_lib/skippy.json
CHANGED
@@ -11,7 +11,7 @@ require 'json'
|
|
11
11
|
require 'extensions.rb'
|
12
12
|
require 'sketchup.rb'
|
13
13
|
|
14
|
-
module Example
|
14
|
+
module Example
|
15
15
|
module HelloWorld
|
16
16
|
|
17
17
|
file = __FILE__.dup
|
@@ -41,7 +41,7 @@ module HelloWorld
|
|
41
41
|
Sketchup.register_extension(@extension, true)
|
42
42
|
end
|
43
43
|
|
44
|
-
end # module HelloWorld
|
44
|
+
end # module HelloWorld
|
45
45
|
end # module Example
|
46
46
|
|
47
47
|
file_loaded(__FILE__)
|
@@ -1,10 +1,10 @@
|
|
1
|
-
{
|
2
|
-
"name": "Hello World",
|
3
|
-
"description": "",
|
4
|
-
"creator": "Unknown",
|
5
|
-
"copyright": "Copyright (c) 2017",
|
6
|
-
"license": "None",
|
7
|
-
"product_id": "Example_HelloWorld",
|
8
|
-
"version": "0.1.0",
|
9
|
-
"build": "1"
|
1
|
+
{
|
2
|
+
"name": "Hello World",
|
3
|
+
"description": "",
|
4
|
+
"creator": "Unknown",
|
5
|
+
"copyright": "Copyright (c) 2017",
|
6
|
+
"license": "None",
|
7
|
+
"product_id": "Example_HelloWorld",
|
8
|
+
"version": "0.1.0",
|
9
|
+
"build": "1"
|
10
10
|
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"name": "Hello World",
|
3
|
+
"description": "",
|
4
|
+
"namespace": "Example::HelloWorld",
|
5
|
+
"basename": "hello_world",
|
6
|
+
"author": "Unknown",
|
7
|
+
"copyright": "Copyright (c) 2017",
|
8
|
+
"license": "None",
|
9
|
+
"libraries": [
|
10
|
+
{
|
11
|
+
"name": "my-lib",
|
12
|
+
"version": "1.2.3",
|
13
|
+
"source": "./temp/my_lib"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"name": "my-other-lib",
|
17
|
+
"version": "2.4.3",
|
18
|
+
"source": "./temp/my-other-lib"
|
19
|
+
}
|
20
|
+
],
|
21
|
+
"modules": [
|
22
|
+
"my-lib/command",
|
23
|
+
"my-other-lib/something"
|
24
|
+
]
|
25
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Hello < Skippy::Command
|
2
|
+
|
3
|
+
desc 'world PERSON', 'Oh, hi there!'
|
4
|
+
def world(person)
|
5
|
+
say "Hello #{person}"
|
6
|
+
end
|
7
|
+
default_command(:world)
|
8
|
+
|
9
|
+
desc 'universe', 'Greets the universe in general'
|
10
|
+
def universe
|
11
|
+
say "DARK IN HERE, ISN'T IT?"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#-------------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Author: Unknown
|
4
|
+
# Copyright: Copyright (c) 2017
|
5
|
+
# License: None
|
6
|
+
#
|
7
|
+
#-------------------------------------------------------------------------------
|
8
|
+
|
9
|
+
require 'json'
|
10
|
+
|
11
|
+
require 'extensions.rb'
|
12
|
+
require 'sketchup.rb'
|
13
|
+
|
14
|
+
module Example
|
15
|
+
module HelloWorld
|
16
|
+
|
17
|
+
file = __FILE__.dup
|
18
|
+
# Account for Ruby encoding bug under Windows.
|
19
|
+
file.force_encoding('UTF-8') if file.respond_to?(:force_encoding)
|
20
|
+
# Support folder should be named the same as the root .rb file.
|
21
|
+
folder_name = File.basename(file, '.*')
|
22
|
+
|
23
|
+
# Path to the root .rb file (this file).
|
24
|
+
PATH_ROOT = File.dirname(file).freeze
|
25
|
+
|
26
|
+
# Path to the support folder.
|
27
|
+
PATH = File.join(PATH_ROOT, folder_name).freeze
|
28
|
+
|
29
|
+
# Extension information.
|
30
|
+
extension_json_file = File.join(PATH, 'extension.json')
|
31
|
+
extension_json = File.read(extension_json_file)
|
32
|
+
EXTENSION = ::JSON.parse(extension_json, symbolize_names: true).freeze
|
33
|
+
|
34
|
+
unless file_loaded?(__FILE__)
|
35
|
+
loader = File.join(PATH, 'main')
|
36
|
+
@extension = SketchupExtension.new(EXTENSION[:name], loader)
|
37
|
+
@extension.description = EXTENSION[:description]
|
38
|
+
@extension.version = EXTENSION[:version]
|
39
|
+
@extension.copyright = EXTENSION[:copyright]
|
40
|
+
@extension.creator = EXTENSION[:creator]
|
41
|
+
Sketchup.register_extension(@extension, true)
|
42
|
+
end
|
43
|
+
|
44
|
+
end # module HelloWorld
|
45
|
+
end # module Example
|
46
|
+
|
47
|
+
file_loaded(__FILE__)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'sketchup.rb'
|
2
|
+
|
3
|
+
module Example::HelloWorld
|
4
|
+
|
5
|
+
unless file_loaded?(__FILE__)
|
6
|
+
menu = UI.menu('Plugins').add_submenu(EXTENSION[:name])
|
7
|
+
menu.add_item('Make Magic') { self.make_magic }
|
8
|
+
menu.add_separator
|
9
|
+
menu.add_item('Help...') { self.open_help }
|
10
|
+
file_loaded(__FILE__)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.make_magic
|
14
|
+
# Do magic here...
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.open_help
|
18
|
+
UI.openURL(EXTENSION[:url])
|
19
|
+
end
|
20
|
+
|
21
|
+
end # module
|