MuranoCLI 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +28 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +21 -0
  5. data/Gemfile +27 -0
  6. data/LICENSE.txt +19 -0
  7. data/MuranoCLI.gemspec +50 -0
  8. data/MuranoCLI.iss +50 -0
  9. data/README.markdown +208 -0
  10. data/Rakefile +188 -0
  11. data/TODO.taskpaper +122 -0
  12. data/bin/mr +8 -0
  13. data/bin/murano +84 -0
  14. data/docs/demo.md +109 -0
  15. data/lib/MrMurano/Account.rb +211 -0
  16. data/lib/MrMurano/Config-Migrate.rb +47 -0
  17. data/lib/MrMurano/Config.rb +286 -0
  18. data/lib/MrMurano/Mock.rb +63 -0
  19. data/lib/MrMurano/Product-1P-Device.rb +145 -0
  20. data/lib/MrMurano/Product-Resources.rb +195 -0
  21. data/lib/MrMurano/Product.rb +358 -0
  22. data/lib/MrMurano/ProjectFile.rb +349 -0
  23. data/lib/MrMurano/Solution-Cors.rb +46 -0
  24. data/lib/MrMurano/Solution-Endpoint.rb +177 -0
  25. data/lib/MrMurano/Solution-File.rb +150 -0
  26. data/lib/MrMurano/Solution-ServiceConfig.rb +140 -0
  27. data/lib/MrMurano/Solution-Services.rb +326 -0
  28. data/lib/MrMurano/Solution-Users.rb +129 -0
  29. data/lib/MrMurano/Solution.rb +59 -0
  30. data/lib/MrMurano/SubCmdGroupContext.rb +49 -0
  31. data/lib/MrMurano/SyncUpDown.rb +565 -0
  32. data/lib/MrMurano/commands/assign.rb +57 -0
  33. data/lib/MrMurano/commands/businessList.rb +45 -0
  34. data/lib/MrMurano/commands/completion.rb +152 -0
  35. data/lib/MrMurano/commands/config.rb +67 -0
  36. data/lib/MrMurano/commands/content.rb +130 -0
  37. data/lib/MrMurano/commands/cors.rb +30 -0
  38. data/lib/MrMurano/commands/domain.rb +17 -0
  39. data/lib/MrMurano/commands/gb.rb +33 -0
  40. data/lib/MrMurano/commands/init.rb +138 -0
  41. data/lib/MrMurano/commands/keystore.rb +157 -0
  42. data/lib/MrMurano/commands/logs.rb +78 -0
  43. data/lib/MrMurano/commands/mock.rb +63 -0
  44. data/lib/MrMurano/commands/password.rb +88 -0
  45. data/lib/MrMurano/commands/postgresql.rb +41 -0
  46. data/lib/MrMurano/commands/product.rb +14 -0
  47. data/lib/MrMurano/commands/productCreate.rb +39 -0
  48. data/lib/MrMurano/commands/productDelete.rb +33 -0
  49. data/lib/MrMurano/commands/productDevice.rb +84 -0
  50. data/lib/MrMurano/commands/productDeviceIdCmds.rb +86 -0
  51. data/lib/MrMurano/commands/productList.rb +45 -0
  52. data/lib/MrMurano/commands/productWrite.rb +27 -0
  53. data/lib/MrMurano/commands/show.rb +80 -0
  54. data/lib/MrMurano/commands/solution.rb +14 -0
  55. data/lib/MrMurano/commands/solutionCreate.rb +39 -0
  56. data/lib/MrMurano/commands/solutionDelete.rb +34 -0
  57. data/lib/MrMurano/commands/solutionList.rb +45 -0
  58. data/lib/MrMurano/commands/status.rb +92 -0
  59. data/lib/MrMurano/commands/sync.rb +60 -0
  60. data/lib/MrMurano/commands/timeseries.rb +115 -0
  61. data/lib/MrMurano/commands/tsdb.rb +271 -0
  62. data/lib/MrMurano/commands/usage.rb +23 -0
  63. data/lib/MrMurano/commands/zshcomplete.erb +112 -0
  64. data/lib/MrMurano/commands.rb +32 -0
  65. data/lib/MrMurano/hash.rb +20 -0
  66. data/lib/MrMurano/http.rb +153 -0
  67. data/lib/MrMurano/makePretty.rb +75 -0
  68. data/lib/MrMurano/schema/pf-v1.0.0.yaml +114 -0
  69. data/lib/MrMurano/schema/sf-v0.2.0.yaml +77 -0
  70. data/lib/MrMurano/schema/sf-v0.3.0.yaml +78 -0
  71. data/lib/MrMurano/template/mock.erb +9 -0
  72. data/lib/MrMurano/template/projectFile.murano.erb +81 -0
  73. data/lib/MrMurano/verbosing.rb +99 -0
  74. data/lib/MrMurano/version.rb +4 -0
  75. data/lib/MrMurano.rb +20 -0
  76. data/spec/Account-Passwords_spec.rb +242 -0
  77. data/spec/Account_spec.rb +272 -0
  78. data/spec/ConfigFile_spec.rb +50 -0
  79. data/spec/ConfigMigrate_spec.rb +89 -0
  80. data/spec/Config_spec.rb +409 -0
  81. data/spec/Http_spec.rb +204 -0
  82. data/spec/MakePretties_spec.rb +118 -0
  83. data/spec/Mock_spec.rb +53 -0
  84. data/spec/ProductBase_spec.rb +113 -0
  85. data/spec/ProductContent_spec.rb +162 -0
  86. data/spec/ProductResources_spec.rb +329 -0
  87. data/spec/Product_1P_Device_spec.rb +202 -0
  88. data/spec/Product_1P_RPC_spec.rb +175 -0
  89. data/spec/Product_spec.rb +153 -0
  90. data/spec/ProjectFile_spec.rb +324 -0
  91. data/spec/Solution-Cors_spec.rb +164 -0
  92. data/spec/Solution-Endpoint_spec.rb +581 -0
  93. data/spec/Solution-File_spec.rb +212 -0
  94. data/spec/Solution-ServiceConfig_spec.rb +202 -0
  95. data/spec/Solution-ServiceDevice_spec.rb +176 -0
  96. data/spec/Solution-ServiceEventHandler_spec.rb +385 -0
  97. data/spec/Solution-ServiceModules_spec.rb +465 -0
  98. data/spec/Solution-UsersRoles_spec.rb +207 -0
  99. data/spec/Solution_spec.rb +92 -0
  100. data/spec/SyncRoot_spec.rb +83 -0
  101. data/spec/SyncUpDown_spec.rb +495 -0
  102. data/spec/Verbosing_spec.rb +279 -0
  103. data/spec/_workspace.rb +27 -0
  104. data/spec/cmd_assign_spec.rb +51 -0
  105. data/spec/cmd_business_spec.rb +59 -0
  106. data/spec/cmd_common.rb +72 -0
  107. data/spec/cmd_config_spec.rb +68 -0
  108. data/spec/cmd_content_spec.rb +71 -0
  109. data/spec/cmd_cors_spec.rb +50 -0
  110. data/spec/cmd_device_spec.rb +96 -0
  111. data/spec/cmd_domain_spec.rb +32 -0
  112. data/spec/cmd_init_spec.rb +30 -0
  113. data/spec/cmd_keystore_spec.rb +97 -0
  114. data/spec/cmd_password_spec.rb +62 -0
  115. data/spec/cmd_status_spec.rb +239 -0
  116. data/spec/cmd_syncdown_spec.rb +86 -0
  117. data/spec/cmd_syncup_spec.rb +62 -0
  118. data/spec/cmd_usage_spec.rb +36 -0
  119. data/spec/fixtures/.mrmuranorc +9 -0
  120. data/spec/fixtures/ProjectFiles/invalid.yaml +9 -0
  121. data/spec/fixtures/ProjectFiles/only_meta.yaml +24 -0
  122. data/spec/fixtures/ProjectFiles/with_routes.yaml +27 -0
  123. data/spec/fixtures/SolutionFiles/0.2.0.json +20 -0
  124. data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +18 -0
  125. data/spec/fixtures/SolutionFiles/0.2.json +21 -0
  126. data/spec/fixtures/SolutionFiles/0.3.0.json +20 -0
  127. data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +19 -0
  128. data/spec/fixtures/SolutionFiles/0.3.json +20 -0
  129. data/spec/fixtures/SolutionFiles/basic.json +20 -0
  130. data/spec/fixtures/SolutionFiles/secret.json +6 -0
  131. data/spec/fixtures/configfile +9 -0
  132. data/spec/fixtures/dumped_config +42 -0
  133. data/spec/fixtures/mrmuranorc_deleted_bob +8 -0
  134. data/spec/fixtures/mrmuranorc_tool_bob +3 -0
  135. data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +116 -0
  136. data/spec/fixtures/product_spec_files/example.murano.spec.yaml +14 -0
  137. data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +21 -0
  138. data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +16 -0
  139. data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +11 -0
  140. data/spec/fixtures/product_spec_files/lightbulb.yaml +14 -0
  141. data/spec/fixtures/roles-three.yaml +11 -0
  142. data/spec/fixtures/syncable_content/assets/icon.png +0 -0
  143. data/spec/fixtures/syncable_content/assets/index.html +0 -0
  144. data/spec/fixtures/syncable_content/assets/js/script.js +0 -0
  145. data/spec/fixtures/syncable_content/modules/table_util.lua +58 -0
  146. data/spec/fixtures/syncable_content/routes/manyRoutes.lua +11 -0
  147. data/spec/fixtures/syncable_content/routes/singleRoute.lua +5 -0
  148. data/spec/fixtures/syncable_content/services/devdata.lua +18 -0
  149. data/spec/fixtures/syncable_content/services/timers.lua +4 -0
  150. data/spec/spec_helper.rb +119 -0
  151. metadata +498 -0
@@ -0,0 +1,45 @@
1
+ require 'MrMurano/Account'
2
+
3
+ command 'product list' do |c|
4
+ c.syntax = %{murano product list [options]}
5
+ c.description = %{List products}
6
+ c.option '--idonly', 'Only return the ids'
7
+ c.option '--[no-]all', 'Show all fields'
8
+ c.option '-o', '--output FILE', %{Download to file instead of STDOUT}
9
+
10
+ c.action do |args, options|
11
+ acc = MrMurano::Account.new
12
+ data = acc.products
13
+
14
+ io=nil
15
+ if options.output then
16
+ io = File.open(options.output, 'w')
17
+ end
18
+
19
+ if options.idonly then
20
+ headers = [:modelId]
21
+ data = data.map{|row| [row[:modelId]]}
22
+ elsif not options.all then
23
+ headers = [:label, :modelId]
24
+ data = data.map{|r| [r[:label], r[:modelId]]}
25
+ else
26
+ headers = data[0].keys
27
+ data = data.map{|r| headers.map{|h| r[h]}}
28
+ end
29
+
30
+ acc.outf(data, io) do |dd, ios|
31
+ if options.idonly then
32
+ ios.puts dd.join(' ')
33
+ else
34
+ acc.tabularize({
35
+ :headers=>headers.map{|h| h.to_s},
36
+ :rows=>dd
37
+ }, ios)
38
+ end
39
+ end
40
+ io.close unless io.nil?
41
+
42
+ end
43
+ end
44
+
45
+ # vim: set ai et sw=2 ts=2 :
@@ -0,0 +1,27 @@
1
+ require 'MrMurano/Product'
2
+
3
+ command 'product device write' do |c|
4
+ c.syntax = %{murano product device write <identifier> <alias> <value> ([<alias> <value>]…)}
5
+ c.summary = %{Write values into a device}
6
+
7
+ c.action do |args,options|
8
+ sn = args.shift
9
+ prd = MrMurano::Product.new
10
+ if (args.count % 2) != 0 then
11
+ prd.error "Last alias is missing a value to write."
12
+ else
13
+ data = Hash[*args]
14
+ ret = prd.write(sn, data)
15
+ prd.outf(ret) do |dd|
16
+ ret.each_pair do |k,v|
17
+ if v == 'ok' then
18
+ say "#{k.to_s}: #{v}"
19
+ else
20
+ prd.error "#{k.to_s}: #{v}"
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ # vim: set ai et sw=2 ts=2 :
@@ -0,0 +1,80 @@
1
+
2
+ command 'show' do |c|
3
+ c.syntax = %(murano show)
4
+ c.summary = %(Show readable information about the current configuration)
5
+ c.description = %(Show readable information about the current configuration)
6
+
7
+ c.action do |args, options|
8
+
9
+ if args.include?('help') then
10
+ ::Commander::UI.enable_paging
11
+ say MrMurano::SubCmdGroupHelp.new(c).get_help
12
+ else
13
+ acc = MrMurano::Account.new
14
+
15
+ selectedBusinessId = $cfg['business.id']
16
+ selectedBusiness = nil
17
+ acc.businesses.each do |row|
18
+ selectedBusiness = row if row[:bizid] == selectedBusinessId
19
+ end
20
+
21
+ selectedProductId = $cfg['product.id']
22
+ selectedProduct = nil
23
+ acc.products.each do |row|
24
+ selectedProduct = row if row[:modelId] == selectedProductId
25
+ end
26
+
27
+ selectedSolutionId = $cfg['solution.id']
28
+ selectedSolution = nil
29
+ acc.solutions.each do |row|
30
+ selectedSolution = row if row[:apiId] == selectedSolutionId
31
+ end
32
+
33
+ if $cfg['user.name'] then
34
+ puts %(user: #{$cfg['user.name']})
35
+ else
36
+ puts 'no user selected'
37
+ end
38
+
39
+ if selectedBusiness then
40
+ puts %(business: #{selectedBusiness[:name]})
41
+ else
42
+ puts 'no business selected'
43
+ end
44
+
45
+ if selectedProduct then
46
+ puts %(product: #{selectedProduct[:label]})
47
+ else
48
+ if selectedProductId then
49
+ puts 'selected product not in business'
50
+ else
51
+ puts 'no product selected'
52
+ end
53
+ end
54
+
55
+ if selectedSolution then
56
+ puts %(solution: https://#{selectedSolution[:domain]})
57
+ else
58
+ if selectedSolutionId then
59
+ puts 'selected solution not in business'
60
+ else
61
+ puts 'no solution selected'
62
+ end
63
+ end
64
+
65
+ end
66
+ end
67
+ end
68
+
69
+ command 'show location' do |c|
70
+ c.syntax = %(murano show location)
71
+ c.summary = %(Show readable location information)
72
+ c.description = %(Show readable information about the current configuration)
73
+
74
+ c.action do |args, options|
75
+ puts %(base: #{$cfg['location.base']})
76
+ $cfg['location'].each { |key, value| puts %(#{key}: #{$cfg['location.base']}/#{value}) }
77
+ end
78
+ end
79
+
80
+ # vim: set ai et sw=2 ts=2 :
@@ -0,0 +1,14 @@
1
+ require 'MrMurano/SubCmdGroupContext'
2
+
3
+ command :solution do |c|
4
+ c.syntax = %{murano solution}
5
+ c.summary = %{About Solution}
6
+ c.description = %{Sub-commands for working with solutions}
7
+
8
+ c.action do |args, options|
9
+ ::Commander::UI.enable_paging
10
+ say MrMurano::SubCmdGroupHelp.new(c).get_help
11
+ end
12
+ end
13
+
14
+ # vim: set ai et sw=2 ts=2 :
@@ -0,0 +1,39 @@
1
+
2
+ command 'solution create' do |c|
3
+ c.syntax = %{murano solution create <name>}
4
+ c.summary = %{Create a new solution}
5
+ c.option '--save', %{Save new solution id to config}
6
+
7
+ c.action do |args, options|
8
+ acc = MrMurano::Account.new
9
+ if args.count < 1 then
10
+ acc.error "Name of solution missing"
11
+ exit 1
12
+ end
13
+ name = args[0]
14
+
15
+ ret = acc.new_solution(name)
16
+ if ret.nil? then
17
+ acc.error "Create failed"
18
+ exit 5
19
+ end
20
+ if not ret.kind_of?(Hash) and not ret.empty? then
21
+ acc.error "Create failed: #{ret.to_s}"
22
+ exit 2
23
+ end
24
+
25
+ # create doesn't return anything, so we need to go look for it.
26
+ ret = acc.solutions.select{|i| i[:domain] =~ /#{name}\./}
27
+ sid = ret.first[:apiId]
28
+ if sid.nil? or sid.empty? then
29
+ acc.error "Didn't find an apiId!!!! #{ret}"
30
+ exit 3
31
+ end
32
+ if options.save then
33
+ $cfg.set('solution.id', sid)
34
+ end
35
+ acc.outf sid
36
+
37
+ end
38
+ end
39
+ # vim: set ai et sw=2 ts=2 :
@@ -0,0 +1,34 @@
1
+ require 'MrMurano/Account'
2
+
3
+ command 'solution delete' do |c|
4
+ c.syntax = %{murano solution delete <solution id>}
5
+ c.description = %{Delete a solution}
6
+
7
+ c.action do |args, options|
8
+ acc = MrMurano::Account.new
9
+ if args.count < 1 then
10
+ acc.error "Solution id or name missing"
11
+ return
12
+ end
13
+ name = args[0]
14
+
15
+
16
+ # Need to convert what we got into the internal PID.
17
+ ret = (acc.solutions or []).select{|i| i.has_value?(name) or i[:domain] =~ /#{name}\./ }
18
+
19
+ if $cfg['tool.debug'] then
20
+ say "Matches found:"
21
+ acc.outf ret
22
+ end
23
+
24
+ if ret.empty? then
25
+ acc.error "No solution matching '#{name}' found. Nothing to delete."
26
+ else
27
+ ret = acc.delete_solution(ret.first[:sid])
28
+ if not ret.kind_of?(Hash) and not ret.empty? then
29
+ acc.error "Delete failed: #{ret.to_s}"
30
+ end
31
+ end
32
+ end
33
+ end
34
+ # vim: set ai et sw=2 ts=2 :
@@ -0,0 +1,45 @@
1
+ require 'MrMurano/Account'
2
+ require 'terminal-table'
3
+
4
+ command 'solution list' do |c|
5
+ c.syntax = %{murano solution list [options]}
6
+ c.description = %{List solutions}
7
+ c.option '--idonly', 'Only return the ids'
8
+ c.option '--[no-]all', 'Show all fields'
9
+ c.option '-o', '--output FILE', %{Download to file instead of STDOUT}
10
+
11
+ c.action do |args, options|
12
+ acc = MrMurano::Account.new
13
+ data = acc.solutions
14
+
15
+ io=nil
16
+ if options.output then
17
+ io = File.open(options.output, 'w')
18
+ end
19
+
20
+ if options.idonly then
21
+ headers = [:apiId]
22
+ data = data.map{|row| [row[:apiId]]}
23
+ elsif not options.all then
24
+ headers = [:apiId, :domain]
25
+ data = data.map{|r| [r[:apiId], r[:domain]]}
26
+ else
27
+ headers = data[0].keys
28
+ data = data.map{|r| headers.map{|h| r[h]}}
29
+ end
30
+
31
+ acc.outf(data, io) do |dd, ios|
32
+ if options.idonly then
33
+ ios.puts dd.join(' ')
34
+ else
35
+ acc.tabularize({
36
+ :headers=>headers.map{|h| h.to_s},
37
+ :rows=>dd
38
+ }, ios)
39
+ end
40
+ end
41
+ io.close unless io.nil?
42
+ end
43
+ end
44
+
45
+ # vim: set ai et sw=2 ts=2 :
@@ -0,0 +1,92 @@
1
+
2
+ command :status do |c|
3
+ c.syntax = %{murano status [options] [filters]}
4
+ c.summary = %{Get the status of files}
5
+ c.description = %{Get the status of files
6
+
7
+ Compares the local project against what is up in Murano, returning a summary of
8
+ what things are new or changed.
9
+
10
+ When --diff is passed, for items that have changes, the remote item and local
11
+ item are passed to a diff tool and that output is included.
12
+
13
+ The diff tool and options to it can be set with the config key 'diff.cmd'.
14
+
15
+
16
+ Filters allow for selecting a subset of items to check based on patterns.
17
+
18
+ File glob filters can be used to select local files. The glob is compared with
19
+ the full file path.
20
+
21
+ Each item type also supports specific filters. These always start with #.
22
+ Endpoints can be selected with a "#<method>#<path glob>" pattern.
23
+
24
+
25
+ }.gsub(/^ +/,'')
26
+ c.option '--all', 'Check everything'
27
+
28
+ # Load options to control which things to status
29
+ MrMurano::SyncRoot.each_option do |s,l,d|
30
+ c.option s, l, d
31
+ end
32
+
33
+ c.option '--[no-]asdown', %{Report as if syncdown instead of syncup}
34
+ c.option '--[no-]diff', %{For modified items, show a diff}
35
+ c.option '--[no-]grouped', %{Group all adds, deletes, and mods together}
36
+ c.option '--[no-]showall', %{List unchanged as well}
37
+
38
+ c.action do |args,options|
39
+ options.default :delete=>true, :create=>true, :update=>true, :diff=>false,
40
+ :grouped => true
41
+
42
+ def fmtr(item)
43
+ if item.has_key? :local_path then
44
+ lp = item[:local_path].relative_path_from(Pathname.pwd()).to_s
45
+ if item.has_key?(:line) and item[:line] > 0 then
46
+ return "#{lp}:#{item[:line]}"
47
+ end
48
+ lp
49
+ else
50
+ item[:synckey]
51
+ end
52
+ end
53
+ def pretty(ret, options)
54
+ say "Adding:" if options.grouped
55
+ ret[:toadd].each{|item| say " + #{item[:pp_type]} #{fmtr(item)}"}
56
+ say "Deleteing:" if options.grouped
57
+ ret[:todel].each{|item| say " - #{item[:pp_type]} #{fmtr(item)}"}
58
+ say "Changing:" if options.grouped
59
+ ret[:tomod].each{|item|
60
+ say " M #{item[:pp_type]} #{fmtr(item)}"
61
+ say item[:diff] if options.diff
62
+ }
63
+ if options.showall then
64
+ say "Unchanged:" if options.grouped
65
+ ret[:unchg].each{|item| say " #{item[:pp_type]} #{fmtr(item)}"}
66
+ end
67
+ end
68
+
69
+ @grouped = {:toadd=>[],:todel=>[],:tomod=>[], :unchg=>[]}
70
+ def gmerge(ret, type, options)
71
+ if options.grouped then
72
+ [:toadd, :todel, :tomod, :unchg].each do |kind|
73
+ ret[kind].each{|item| item[:pp_type] = type; @grouped[kind] << item}
74
+ end
75
+ else
76
+ pretty(ret, options)
77
+ end
78
+ end
79
+
80
+ MrMurano::SyncRoot.each_filtered(options.__hash__) do |name, type, klass|
81
+ sol = klass.new
82
+ ret = sol.status(options, args)
83
+ gmerge(ret, type, options)
84
+ end
85
+
86
+ pretty(@grouped, options) if options.grouped
87
+ end
88
+ end
89
+
90
+ alias_command :diff, :status, '--diff', '--no-grouped'
91
+
92
+ # vim: set ai et sw=2 ts=2 :
@@ -0,0 +1,60 @@
1
+
2
+ command :syncdown do |c|
3
+ c.syntax = %{murano syncdown [options] [filters]}
4
+ c.description = %{Sync project down from Murano}
5
+ c.option '--all', 'Sync everything'
6
+
7
+ # Load options to control which things to sync
8
+ MrMurano::SyncRoot.each_option do |s,l,d|
9
+ c.option s, l, d
10
+ end
11
+
12
+ c.option '--[no-]delete', %{Don't delete things from server}
13
+ c.option '--[no-]create', %{Don't create things on server}
14
+ c.option '--[no-]update', %{Don't update things on server}
15
+
16
+ c.example %{Make local be like what is on the server}, %{murano syncdown --all}
17
+ c.example %{Pull down new things, but don't delete or modify anything}, %{murano syncdown --all --no-delete --no-update}
18
+ c.example %{Only Pull new static files}, %{murano syncdown --files --no-delete --no-update}
19
+
20
+ c.action do |args,options|
21
+ options.default :delete=>true, :create=>true, :update=>true
22
+
23
+ MrMurano::SyncRoot.each_filtered(options.__hash__) do |name, type, klass|
24
+ sol = klass.new
25
+ sol.syncdown(options, args)
26
+ end
27
+ end
28
+ end
29
+ alias_command :pull, :syncdown, '--no-delete'
30
+
31
+ command :syncup do |c|
32
+ c.syntax = %{murano syncup [options] [filters]}
33
+ c.description = %{Sync project up into Murano}
34
+ c.option '--all', 'Sync everything'
35
+
36
+ # Load options to control which things to sync
37
+ MrMurano::SyncRoot.each_option do |s,l,d|
38
+ c.option s, l, d
39
+ end
40
+
41
+ c.option '--[no-]delete', %{Don't delete things from server}
42
+ c.option '--[no-]create', %{Don't create things on server}
43
+ c.option '--[no-]update', %{Don't update things on server}
44
+
45
+ c.example %{Deploy project to server}, %{murano syncup --all}
46
+ c.example %{Update static files}, %{murano syncup --files}
47
+ c.example %{Only add or modify static files}, %{murano syncup --files --no-delete}
48
+
49
+ c.action do |args,options|
50
+ options.default :delete=>true, :create=>true, :update=>true
51
+
52
+ MrMurano::SyncRoot.each_filtered(options.__hash__) do |name, type, klass|
53
+ sol = klass.new
54
+ sol.syncup(options, args)
55
+ end
56
+ end
57
+ end
58
+ alias_command :push, :syncup, '--no-delete'
59
+
60
+ # vim: set ai et sw=2 ts=2 :