skippy 0.2.0.a → 0.3.0.a

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 (75) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.gitmodules +3 -0
  4. data/.idea/.rakeTasks +6 -6
  5. data/.idea/codeStyleSettings.xml +8 -8
  6. data/.idea/encodings.xml +5 -5
  7. data/.idea/inspectionProfiles/Project_Default.xml +7 -7
  8. data/.idea/misc.xml +3 -3
  9. data/.idea/modules.xml +7 -7
  10. data/.idea/skippy.iml +89 -82
  11. data/.idea/vcs.xml +5 -5
  12. data/.rubocop.yml +93 -0
  13. data/.rubocop_todo.yml +24 -0
  14. data/.vscode/launch.json +51 -61
  15. data/.vscode/settings.json +41 -2
  16. data/.vscode/tasks.json +16 -16
  17. data/Gemfile +11 -2
  18. data/README.md +194 -15
  19. data/Rakefile +1 -1
  20. data/app/boot.rb +1 -1
  21. data/app/commands/install.rb +41 -0
  22. data/app/commands/lib.rb +42 -2
  23. data/app/commands/new.rb +22 -8
  24. data/app/commands/template.rb +2 -2
  25. data/bin/rubocop +17 -0
  26. data/bin/ruby-parse +17 -0
  27. data/bin/ruby-rewrite +17 -0
  28. data/debug/skippy.bat +2 -0
  29. data/fixtures/my_lib/{src → modules}/command.rb +0 -0
  30. data/fixtures/my_lib/{src → modules}/geometry.rb +0 -0
  31. data/fixtures/my_lib/modules/gl.rb +4 -0
  32. data/fixtures/my_lib/modules/gl/container.rb +8 -0
  33. data/fixtures/my_lib/modules/gl/control.rb +6 -0
  34. data/fixtures/my_lib/modules/gl/nested/nested.rb +8 -0
  35. data/fixtures/my_lib/{src → modules}/tool.rb +0 -0
  36. data/fixtures/my_lib/skippy.json +1 -1
  37. data/fixtures/my_project/skippy.json +2 -1
  38. data/fixtures/my_project/src/hello_world.rb +2 -2
  39. data/fixtures/my_project/src/hello_world/extension.json +9 -9
  40. data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/command.rb +4 -0
  41. data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/gl.rb +4 -0
  42. data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/gl/container.rb +8 -0
  43. data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/gl/control.rb +6 -0
  44. data/fixtures/project_with_lib/.skippy/libs/my-lib/skippy.json +5 -0
  45. data/fixtures/project_with_lib/.skippy/libs/my-other-lib/modules/something.rb +4 -0
  46. data/fixtures/project_with_lib/.skippy/libs/my-other-lib/skippy.json +5 -0
  47. data/fixtures/project_with_lib/skippy.json +25 -0
  48. data/fixtures/project_with_lib/skippy/commands/example.rb +14 -0
  49. data/fixtures/project_with_lib/src/hello_world.rb +47 -0
  50. data/fixtures/project_with_lib/src/hello_world/extension.json +10 -0
  51. data/fixtures/project_with_lib/src/hello_world/main.rb +21 -0
  52. data/fixtures/project_with_lib/src/hello_world/vendor/my-lib/command.rb +4 -0
  53. data/fixtures/project_with_lib/src/hello_world/vendor/my-other-lib/something.rb +4 -0
  54. data/lib/skippy.rb +2 -0
  55. data/lib/skippy/app.rb +2 -2
  56. data/lib/skippy/cli.rb +41 -20
  57. data/lib/skippy/command.rb +2 -4
  58. data/lib/skippy/config.rb +27 -22
  59. data/lib/skippy/config_accessors.rb +12 -12
  60. data/lib/skippy/group.rb +1 -3
  61. data/lib/skippy/helpers/file.rb +3 -3
  62. data/lib/skippy/installer.rb +49 -0
  63. data/lib/skippy/installer/git.rb +115 -0
  64. data/lib/skippy/installer/local.rb +19 -0
  65. data/lib/skippy/lib_module.rb +16 -16
  66. data/lib/skippy/lib_source.rb +139 -0
  67. data/lib/skippy/library.rb +50 -10
  68. data/lib/skippy/library_manager.rb +116 -18
  69. data/lib/skippy/module_manager.rb +104 -26
  70. data/lib/skippy/namespace.rb +17 -1
  71. data/lib/skippy/project.rb +34 -4
  72. data/lib/skippy/version.rb +3 -1
  73. data/skippy.gemspec +10 -5
  74. metadata +85 -29
  75. 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
- :type => :string,
13
- :desc => 'The namespace the extension will use'
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
- :type => :string,
17
- :desc => 'The template used to generate the project files',
18
- :default => 'standard'
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.to_a.join('_'),
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/#{project.namespace.to_underscore}/extension.json"
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.namespace.to_underscore
101
+ project.basename
88
102
  end
89
103
 
90
104
  end # no_commands
@@ -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(source)
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(template_name)
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
@@ -1,5 +1,7 @@
1
1
  @echo off
2
2
  REM This is used to be able to run Skippy directly from source.
3
+ REM Add its location to the system PATH.
4
+ REM
3
5
  REM %~dp0 returns the path for this batch file.
4
6
  REM http://stackoverflow.com/a/659672/486990
5
7
  REM
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ module SkippyLib
2
+ module GL
3
+ end
4
+ end # module
@@ -0,0 +1,8 @@
1
+ require 'modules/gl/control'
2
+
3
+ module SkippyLib
4
+ module GL
5
+ class Container < Control
6
+ end
7
+ end
8
+ end # module
@@ -0,0 +1,6 @@
1
+ module SkippyLib
2
+ module GL
3
+ class Control
4
+ end
5
+ end
6
+ end # module
@@ -0,0 +1,8 @@
1
+ require 'modules/gl/control'
2
+
3
+ module SkippyLib
4
+ module GL
5
+ module Nested
6
+ end
7
+ end
8
+ end # module
File without changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "library": true,
3
- "name": "My Shiny Library",
3
+ "name": "my-lib",
4
4
  "version": "1.2.3"
5
5
  }
@@ -2,7 +2,8 @@
2
2
  "name": "Hello World",
3
3
  "description": "",
4
4
  "namespace": "Example::HelloWorld",
5
+ "basename": "hello_world",
5
6
  "author": "Unknown",
6
7
  "copyright": "Copyright (c) 2017",
7
8
  "license": "None"
8
- }
9
+ }
@@ -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,4 @@
1
+ module SkippyLib
2
+ class Command
3
+ end
4
+ end # module
@@ -0,0 +1,4 @@
1
+ module SkippyLib
2
+ module GL
3
+ end
4
+ end # module
@@ -0,0 +1,8 @@
1
+ Sketchup.require 'modules/gl/control'
2
+
3
+ module SkippyLib
4
+ module GL
5
+ class Container < Control
6
+ end
7
+ end
8
+ end # module
@@ -0,0 +1,6 @@
1
+ module SkippyLib
2
+ module GL
3
+ class Control
4
+ end
5
+ end
6
+ end # module
@@ -0,0 +1,5 @@
1
+ {
2
+ "library": true,
3
+ "name": "my-lib",
4
+ "version": "1.2.3"
5
+ }
@@ -0,0 +1,4 @@
1
+ module SkippyLib
2
+ class Something
3
+ end
4
+ end # module
@@ -0,0 +1,5 @@
1
+ {
2
+ "library": true,
3
+ "name": "my-other-lib",
4
+ "version": "2.4.3"
5
+ }
@@ -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,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"
10
+ }
@@ -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
@@ -0,0 +1,4 @@
1
+ module Example::HelloWorld
2
+ class Command
3
+ end
4
+ end # module
@@ -0,0 +1,4 @@
1
+ module Example::HelloWorld
2
+ class Something
3
+ end
4
+ end # module
data/lib/skippy.rb CHANGED
@@ -3,7 +3,9 @@ require 'skippy/version'
3
3
  module Skippy
4
4
 
5
5
  class << self
6
+
6
7
  attr_accessor :app
8
+
7
9
  end
8
10
 
9
11
  end # module