MrMurano 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 907d8f71d784965567eff90d5ca1d88e29e08b93
4
- data.tar.gz: c97c0feb26e1f54898a8c24da2d1e84d30e7a6c0
3
+ metadata.gz: e3d8ab1106bc7c79174b671075339b574dd017de
4
+ data.tar.gz: 53c2be7de4579527f6174ffbc0957109d3a29d51
5
5
  SHA512:
6
- metadata.gz: 436e65b69681a6df929bcbd8fe8a55842363dd6f13abae114d35209d59d83c575d082e8fd01737693d368a725defd8116b6c1aa59e638c5e566a6f39121bce4a
7
- data.tar.gz: 639221f5cb46bea583e71d3945e6a3b74043548fef47dea5b234e7dae232ca1a02db0c264a31150130947fb4e5802e8bb581e648a549e8ac571add4e15a57c09
6
+ metadata.gz: 36c4e019e27f568af176f0544ac3137c720aab8f4a7e49f83d00faefdea09b23d9e3bc8855cf008ed4b6c3620dda5bf58b28296303166bd3567f1a86505d2611
7
+ data.tar.gz: cc2e8f89109bd70c3fb6aaaa8bdf28c12caeeb6aedb47e0294445124a628d5b4d3e034259df287d92241be45a1eabaa3326ee7f4b37aecd089126711346d0ca9
data/.gitignore CHANGED
@@ -13,6 +13,7 @@ Pods/
13
13
  pkg/
14
14
 
15
15
  .mrmuranorc
16
+ .mrmuranorc.private
16
17
  files/
17
18
  endpoints/
18
19
  modules/
data/README.markdown CHANGED
@@ -1,5 +1,7 @@
1
1
  # MrMurano
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/MrMurano.svg)](https://badge.fury.io/rb/MrMurano)
4
+
3
5
  Do more from the command line with [Murano](https://exosite.com/platform/)
4
6
 
5
7
  ## Usage
@@ -8,20 +10,18 @@ To start from an existing project in Murano
8
10
  ```
9
11
  mkdir myproject
10
12
  cd myproject
11
- mr syncdown --all
13
+ mr syncdown -same
12
14
  ```
13
15
 
14
- Do stuff, see what changed: `mr status --all` or `mr diff -same`.
15
- Then deploy `mr syncup --all`
16
+ Do stuff, see what changed: `mr status -same` or `mr diff -same`.
17
+ Then deploy `mr syncup -same`
16
18
 
17
19
 
18
20
 
19
21
  ## Install
20
22
 
21
- Source install for now.
22
23
  ```
23
- git clone MrMurano
24
- cd MrMurano
25
- rake install
24
+ > gem install MrMurano
26
25
  ```
27
26
 
27
+
@@ -86,6 +86,7 @@ module MrMurano
86
86
  end
87
87
 
88
88
  def products
89
+ raise "Missing Bussiness ID" if $cfg['business.id'].nil?
89
90
  r = endPoint('business/' + $cfg['business.id'] + '/product/')
90
91
  Net::HTTP.start(r.host, r.port, :use_ssl=>true) do |http|
91
92
  request = Net::HTTP::Get.new(r)
@@ -104,6 +105,7 @@ module MrMurano
104
105
  end
105
106
 
106
107
  def solutions
108
+ raise "Missing Bussiness ID" if $cfg['business.id'].nil?
107
109
  r = endPoint('business/' + $cfg['business.id'] + '/solution/')
108
110
  Net::HTTP.start(r.host, r.port, :use_ssl=>true) do |http|
109
111
  request = Net::HTTP::Get.new(r)
@@ -21,12 +21,13 @@ module MrMurano
21
21
  ret = get('/' + id.to_s)
22
22
  aheader = ret['script'].lines.first.chomp
23
23
  dheader = /^--#ENDPOINT (?i:#{ret['method']}) #{ret['path']}$/
24
+ rheader = %{--#ENDPOINT #{ret['method']} #{ret['path']}\n}
24
25
  if block_given? then
25
- yield dheader + "\n" unless dheader =~ aheader
26
+ yield rheader unless dheader =~ aheader
26
27
  yield ret['script']
27
28
  else
28
29
  res = ''
29
- res << dheader + "\n" unless dheader =~ aheader
30
+ res << rheader unless dheader =~ aheader
30
31
  res << ret['script']
31
32
  res
32
33
  end
@@ -4,6 +4,15 @@ require 'pp'
4
4
 
5
5
  module MrMurano
6
6
  class Config
7
+ #
8
+ # internal transient this-run-only things (also -c options)
9
+ # specified from --configfile
10
+ # private .mrmuranorc.private at project dir (for things you don't want to commit)
11
+ # project .mrmuranorc at project dir
12
+ # user .mrmuranorc at $HOME
13
+ # system .mrmuranorc at /etc
14
+ # defaults Internal hardcoded defaults
15
+ #
7
16
  ConfigFile = Struct.new(:kind, :path, :data) do
8
17
  def load()
9
18
  return if kind == :internal
@@ -24,13 +33,16 @@ module MrMurano
24
33
 
25
34
  attr :paths
26
35
 
36
+ CFG_SCOPES=%w{internal specified project private user system defaults}.map{|i| i.to_sym}.freeze
27
37
  CFG_FILE_NAME = '.mrmuranorc'.freeze
38
+ CFG_PRVT_NAME = '.mrmuranorc.private'.freeze
28
39
 
29
40
  def initialize
30
41
  @paths = []
31
42
  @paths << ConfigFile.new(:internal, nil, IniFile.new())
32
- # :specified --config FILE goes here. (see load_specific)
43
+ # :specified --configfile FILE goes here. (see load_specific)
33
44
  prjfile = findProjectFile()
45
+ @paths << ConfigFile.new(:private, prjfile.dirname + CFG_PRVT_NAME)
34
46
  @paths << ConfigFile.new(:project, prjfile)
35
47
  @paths << ConfigFile.new(:user, Pathname.new(Dir.home) + CFG_FILE_NAME)
36
48
  @paths << ConfigFile.new(:system, Pathname.new('/etc') + CFG_FILE_NAME.sub(/^\./,''))
@@ -87,7 +99,7 @@ module MrMurano
87
99
  end
88
100
 
89
101
  # key is <section>.<key>
90
- def get(key, scope=[:internal, :specified, :project, :user, :system, :defaults])
102
+ def get(key, scope=CFG_SCOPES)
91
103
  scope = [scope] unless scope.kind_of? Array
92
104
  paths = @paths.select{|p| scope.include? p.kind}
93
105
 
@@ -149,10 +161,21 @@ end
149
161
  command :config do |c|
150
162
  c.syntax = %{mr config [options] <key> [<new value>]}
151
163
  c.summary = %{Get and set options}
164
+ c.description = %{
165
+ You can get, set, or query config options with this command. All config options
166
+ are in a 'section.key' format. There is also a layer of scopes that the keys can
167
+ be saved in.
168
+
169
+ }
170
+
171
+ c.example %{See what the current combined config is}, 'mr config --dump'
172
+
152
173
  c.option '--system', 'Use only the system config file'
153
174
  c.option '--user', 'Use only the config file in $HOME'
154
- c.option '--project', 'Use only the config file in the project'
175
+ c.option '--project', 'Use only the config file in the project (.mrmuranorc)'
176
+ c.option '--private', 'Use only the private config file in the project (.mrmuranorc.private)'
155
177
  c.option '--specified', 'Use only the config file from the --config option.'
178
+
156
179
  c.option '--unset', 'Remove key from config file.'
157
180
  c.option '--dump', 'Dump the current combined view of the config'
158
181
 
@@ -163,25 +186,29 @@ command :config do |c|
163
186
  elsif args.count == 0 then
164
187
  say_error "Need a config key"
165
188
  elsif args.count == 1 and not options.unset then
166
- options.defaults :system=>false, :user=>false, :project=>false, :specified=>false
189
+ options.defaults :system=>false, :user=>false, :project=>false,
190
+ :specified=>false, :private=>false
167
191
 
168
192
  # For read, if no scopes, than all. Otherwise just those specified
169
193
  scopes = []
170
194
  scopes << :system if options.system
171
195
  scopes << :user if options.user
172
196
  scopes << :project if options.project
197
+ scopes << :private if options.private
173
198
  scopes << :specified if options.specified
174
- scopes = [:internal, :specified, :project, :user, :system, :defaults] if scopes.empty?
199
+ scopes = MrMurano::Config.CFG_SCOPES if scopes.empty?
175
200
 
176
201
  say $cfg.get(args[0], scopes)
177
202
  else
178
203
 
179
- options.defaults :system=>false, :user=>false, :project=>true, :specified=>false
204
+ options.defaults :system=>false, :user=>false, :project=>true,
205
+ :specified=>false, :private=>false
180
206
  # For write, if scope is specified, only write to that scope.
181
207
  scope = :project
182
208
  scope = :system if options.system
183
209
  scope = :user if options.user
184
210
  scope = :project if options.project
211
+ scope = :private if options.private
185
212
  scope = :specified if options.specified
186
213
 
187
214
  args[1] = nil if options.unset
@@ -1,4 +1,4 @@
1
1
  module MrMurano
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MrMurano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Conrad Tadpol Tilstra