Skip to content

Commit 2dcaa4c

Browse files
[](feat) support local versions file
1 parent f8f6e12 commit 2dcaa4c

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

rakefile.rb

+19-10
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
PLUGINS_DEST_FOLDER = './plugins'
99
PLUGIN_RELEASE_FOLDER = './releases'
1010

11-
def build(target, hard, ver, pack)
11+
def build(target, hard, ver, pack, vers)
1212
if target.nil?
1313
putsAccent('Please define target to be built like: "rake build[./plugins/plugin.complex]"', true)
1414
end
15-
versions = Versions.new
15+
versions = Versions.new(vers)
1616
plugin = Plugin.new(target, versions, hard, ver, pack)
1717
if plugin.build
1818
puts "Plugin #{plugin.get_plugin_name} is built SUCCESSFULLY"
@@ -23,23 +23,32 @@ def build(target, hard, ver, pack)
2323
puts "Traget is: #{target}"
2424
end
2525

26-
task :pack, [:target, :ver] do |_t, args|
27-
build(args.target, false, args.ver, true)
26+
# Does:
27+
# - build defined plugin
28+
# - pack plugin into chipmunk plugin package
29+
task :pack, [:target, :ver, :vers] do |_t, args|
30+
build(args.target, false, args.ver, true, args.vers)
2831
end
2932

30-
task :build, [:target, :ver] do |_t, args|
31-
build(args.target, false, args.ver, false)
33+
# Does:
34+
# - build defined plugin
35+
task :build, [:target, :ver, :vers] do |_t, args|
36+
build(args.target, false, args.ver, false, args.vers)
3237
end
3338

34-
task :rebuild, [:target, :ver] do |_t, args|
35-
build(args.target, true, args.ver, false)
39+
# Does:
40+
# - rebuild defined plugin (will drop node_modules stuff)
41+
task :rebuild, [:target, :ver, :vers] do |_t, args|
42+
build(args.target, true, args.ver, false, args.vers)
3643
end
3744

38-
task :synch, [:target] do |_t, args|
45+
# Does (used only for Angular plugins):
46+
# - copy sources from angular/projects folder back to ./plugins/[plugin_name]/render folder
47+
task :synch, [:target, :vers] do |_t, args|
3948
if args.target.nil?
4049
putsAccent('Please define target to be synch like: "rake synch[./plugins/plugin.complex]"', true)
4150
end
42-
versions = Versions.new
51+
versions = Versions.new(args.vers)
4352
plugin = Plugin.new(args.target, versions, false)
4453
plugin.synch
4554
end

scripts/versions.rb

+11-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@
66
VERSIONS_FILE_URL = 'https://raw.githubusercontent.com/esrlabs/chipmunk/master/versions.json'
77

88
class Versions
9-
def initialize
10-
puts "Reading versions file from \"#{VERSIONS_FILE_URL}\""
11-
@versions_str = URI.open(VERSIONS_FILE_URL, &:read)
9+
def initialize(ver_file)
10+
if ver_file.nil?
11+
puts "Reading versions file from \"#{VERSIONS_FILE_URL}\""
12+
@versions_str = URI.open(VERSIONS_FILE_URL, &:read)
13+
else
14+
if !File.file?(ver_file)
15+
raise "Fail to find versions file: #{ver_file}"
16+
end
17+
puts "Reading versions file from \"#{ver_file}\""
18+
@versions_str = File.read("#{ver_file}")
19+
end
1220
@versions = JSON.parse(@versions_str)
1321
puts "Next versions of frameworks/modules will be used:\n"
1422
puts "\telectron: #{@versions['electron']}\n"

versions.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"electron": "8.1.0",
3+
"electron-rebuild": "1.10.0",
4+
"chipmunk.client.toolkit": "1.0.2",
5+
"chipmunk.plugin.ipc": "0.0.42",
6+
"chipmunk-client-material": "0.0.1",
7+
"angular-core": "8.2.12",
8+
"angular-material": "8.2.3",
9+
"force": "0.0.8"
10+
}

0 commit comments

Comments
 (0)