netzke_config 0.1.2 → 0.1.3
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.
- data/README.markdown +3 -0
- data/VERSION +1 -1
- data/lib/netzke_config.rb +60 -9
- metadata +2 -2
data/README.markdown
CHANGED
@@ -48,6 +48,9 @@ Retrieves and places *netzke* modules in <code>../my/place</code>.
|
|
48
48
|
|
49
49
|
<code>$ netzke_config --overwrite-all --extjs ~/code/ext-3.2.1/ --download</code>
|
50
50
|
|
51
|
+
+Detailed specifications of each module to include as plugin+
|
52
|
+
|
53
|
+
<code>$ netzke_config --modules neztke_ar:master@skozlov,netzke_core:rails3@kmandrup</code>
|
51
54
|
|
52
55
|
## Copyright ##
|
53
56
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/netzke_config.rb
CHANGED
@@ -21,16 +21,58 @@ class NetzkeConfig < Thor::Group
|
|
21
21
|
class_option :ext_version, :type => :string, :default => '3.2.1', :desc => 'ExtJS version to download'
|
22
22
|
class_option :download, :type => :boolean, :default => false, :desc => 'Download ExtJS if not found in specified extjs location'
|
23
23
|
|
24
|
+
# class_option :basepack, :type => :string, :desc => 'Github branch and account specification for basepack module, fx rails3@kmandrup'
|
25
|
+
# class_option :core, :type => :string, :desc => 'Github branch and account specification for core module, fx master@skozlov'
|
26
|
+
class_option :modules, :type => :string, :desc => 'module specifications for each module, fx neztke_ar:master@skozlov,netzke_core:rails3@kmandrup'
|
27
|
+
|
24
28
|
GITHUB = 'http://github.com'
|
25
29
|
|
26
|
-
def main
|
30
|
+
def main
|
31
|
+
setup_defaults
|
32
|
+
define_modules
|
27
33
|
exit(-1) if !valid_context?
|
28
34
|
configure_modules
|
29
35
|
configure_extjs if options[:extjs]
|
30
36
|
end
|
31
37
|
|
32
38
|
protected
|
39
|
+
attr_accessor :modules_config
|
40
|
+
|
41
|
+
def default_modules
|
42
|
+
["netzke-core", "netzke-basepack"]
|
43
|
+
end
|
44
|
+
|
45
|
+
def setup_defaults
|
46
|
+
@modules_config ||= {}
|
47
|
+
default_modules.each do |module_name|
|
48
|
+
set_module_config 'netzke-basepack'
|
49
|
+
set_module_config 'netzke-core'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def define_modules
|
54
|
+
@modules_config ||= {}
|
55
|
+
return if !options[:modules]
|
56
|
+
module_defs = options[:modules].split(",")
|
57
|
+
|
58
|
+
module_defs.each do |module_spec|
|
59
|
+
spec = module_spec.strip.split(":")
|
60
|
+
module_name = spec[0]
|
61
|
+
branch, account = spec[1].split("@")
|
62
|
+
set_module_config module_name.to_sym, :branch => branch, :account => account
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def set_module_config name, module_options = {}
|
67
|
+
mconfig = modules_config[name.to_sym] = {}
|
68
|
+
mconfig[:branch] = module_options[:branch] || options[:branch]
|
69
|
+
mconfig[:account] = module_options[:account] || options[:account]
|
70
|
+
end
|
33
71
|
|
72
|
+
def module_config name
|
73
|
+
modules_config[name.to_sym]
|
74
|
+
end
|
75
|
+
|
34
76
|
def valid_context?
|
35
77
|
if netzke_app? && rails3_app?
|
36
78
|
true
|
@@ -39,11 +81,15 @@ class NetzkeConfig < Thor::Group
|
|
39
81
|
false
|
40
82
|
end
|
41
83
|
end
|
84
|
+
|
85
|
+
def get_module_names
|
86
|
+
default_modules | modules_config.keys.map{|k| k.to_s}
|
87
|
+
end
|
42
88
|
|
43
89
|
def configure_modules
|
44
90
|
create_module_container_dir
|
45
91
|
inside "#{location}" do
|
46
|
-
|
92
|
+
get_module_names.each do |module_name|
|
47
93
|
get_module module_name
|
48
94
|
config_netzke_plugin module_name
|
49
95
|
end
|
@@ -67,8 +113,10 @@ class NetzkeConfig < Thor::Group
|
|
67
113
|
end
|
68
114
|
end
|
69
115
|
|
70
|
-
def update_module module_name
|
71
|
-
|
116
|
+
def update_module module_name
|
117
|
+
config = module_config(module_name)
|
118
|
+
inside module_name do
|
119
|
+
branch = config[:branch]
|
72
120
|
run "git checkout #{branch}"
|
73
121
|
run "git rebase origin/#{branch}"
|
74
122
|
run "git pull"
|
@@ -76,9 +124,12 @@ class NetzkeConfig < Thor::Group
|
|
76
124
|
end
|
77
125
|
|
78
126
|
def create_module module_name
|
79
|
-
# create dir for module by cloning
|
80
|
-
|
81
|
-
|
127
|
+
# create dir for module by cloning
|
128
|
+
config = module_config(module_name)
|
129
|
+
account = config[:account]
|
130
|
+
run "git clone #{netzke_github account}/#{module_name}.git #{module_name}"
|
131
|
+
inside module_name do
|
132
|
+
branch = config[:branch]
|
82
133
|
run "git checkout #{branch}"
|
83
134
|
end
|
84
135
|
end
|
@@ -137,8 +188,8 @@ class NetzkeConfig < Thor::Group
|
|
137
188
|
File.join(extjs_dir, extjs)
|
138
189
|
end
|
139
190
|
|
140
|
-
def netzke_github
|
141
|
-
"#{GITHUB}/#{
|
191
|
+
def netzke_github account
|
192
|
+
"#{GITHUB}/#{account}"
|
142
193
|
end
|
143
194
|
|
144
195
|
def netzke_app?
|