netzke_config 0.1.3 → 0.2.0
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 +22 -2
- data/VERSION +1 -1
- data/lib/netzke_config.rb +60 -34
- data/netzke_config.gemspec +60 -0
- metadata +4 -3
data/README.markdown
CHANGED
@@ -22,13 +22,13 @@ Must be run frokm the root of a Rails 3 Netzke application.
|
|
22
22
|
|
23
23
|
<code>$ netzke_config</code>
|
24
24
|
|
25
|
-
Clones *netzke* modules from 'skozlov' github account in <code>~/netzke/modules</code>.
|
25
|
+
Clones *netzke* modules from 'skozlov' github account in <code>~/netzke/plugin-modules</code>.
|
26
26
|
|
27
27
|
+Clone modules from specific github account+
|
28
28
|
|
29
29
|
<code>$ netzke_config --account kmandrup</code>
|
30
30
|
|
31
|
-
Clones *netzke* modules from 'kmandrup' github account in <code>~/netzke/modules</code>.
|
31
|
+
Clones *netzke* modules from 'kmandrup' github account in <code>~/netzke/plugin-modules</code>.
|
32
32
|
|
33
33
|
+Specify location of netzke modules+
|
34
34
|
|
@@ -52,6 +52,26 @@ Retrieves and places *netzke* modules in <code>../my/place</code>.
|
|
52
52
|
|
53
53
|
<code>$ netzke_config --modules neztke_ar:master@skozlov,netzke_core:rails3@kmandrup</code>
|
54
54
|
|
55
|
+
+Using config file for default modules specifications+
|
56
|
+
|
57
|
+
*~/netzke/modules.config* (default config file)
|
58
|
+
<pre>
|
59
|
+
netzke_core:rails3@kmandrup
|
60
|
+
</pre>
|
61
|
+
|
62
|
+
<code>$ netzke_config --modules neztke_ar:master@skozlov</code>
|
63
|
+
|
64
|
+
+Specifying custom config file for default modules specifications+
|
65
|
+
|
66
|
+
*~/configurations/modules.config* (default config file)
|
67
|
+
<pre>
|
68
|
+
netzke-core:rails3@kmandrup, neztke-basepack:rails3@skozlov
|
69
|
+
</pre>
|
70
|
+
|
71
|
+
Modules specs in the modules option always override those found in the config file
|
72
|
+
|
73
|
+
<code>$ netzke_config --modules neztke_ar:master@skozlov,neztke-basepack:rails3@kmandrup --config-file ~/configurations/modules.config</code>
|
74
|
+
|
55
75
|
## Copyright ##
|
56
76
|
|
57
77
|
Copyright (c) 2009 Kristian Mandrup
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/netzke_config.rb
CHANGED
@@ -2,6 +2,12 @@ require 'active_support/inflector'
|
|
2
2
|
require 'thor'
|
3
3
|
require 'thor/group'
|
4
4
|
|
5
|
+
class NilClass
|
6
|
+
def empty?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
class NetzkeConfig < Thor::Group
|
6
12
|
include Thor::Actions
|
7
13
|
|
@@ -9,10 +15,10 @@ class NetzkeConfig < Thor::Group
|
|
9
15
|
# group :netzke
|
10
16
|
|
11
17
|
# Define arguments
|
12
|
-
argument :location, :type => :string, :default => '~/netzke/modules', :desc => '
|
18
|
+
argument :location, :type => :string, :default => '~/netzke/plugin-modules', :desc => 'Location where netzke modules are to be stored (locally)'
|
13
19
|
# argument :my_arg_name, :type (:string, :hash, :array, :numeric), :default, :required, :optional, :desc, :banner
|
14
20
|
|
15
|
-
class_option :extjs, :type => :string, :default => nil, :desc => '
|
21
|
+
class_option :extjs, :type => :string, :default => nil, :desc => 'Location of ExtJS 3.x.x library'
|
16
22
|
|
17
23
|
class_option :branch, :type => :string, :default => 'rails3', :desc => 'Branch to use for netzke modules'
|
18
24
|
class_option :account, :type => :string, :default => 'skozlov', :desc => 'Github account to get Netzke plugins from'
|
@@ -21,13 +27,13 @@ class NetzkeConfig < Thor::Group
|
|
21
27
|
class_option :ext_version, :type => :string, :default => '3.2.1', :desc => 'ExtJS version to download'
|
22
28
|
class_option :download, :type => :boolean, :default => false, :desc => 'Download ExtJS if not found in specified extjs location'
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
class_option :modules, :type => :string, :desc => 'module specifications for each module, fx neztke_ar:master@skozlov,netzke_core:rails3@kmandrup'
|
30
|
+
class_option :modules, :type => :string, :desc => 'Module specifications for each module, fx neztke_ar:master@skozlov,netzke_core:rails3@kmandrup'
|
31
|
+
class_option :config_file, :default => '~/netzke/modules.config', :type => :string, :desc => 'Location of config file for default module specifications'
|
27
32
|
|
28
33
|
GITHUB = 'http://github.com'
|
29
34
|
|
30
35
|
def main
|
36
|
+
load_config_file
|
31
37
|
setup_defaults
|
32
38
|
define_modules
|
33
39
|
exit(-1) if !valid_context?
|
@@ -36,33 +42,56 @@ class NetzkeConfig < Thor::Group
|
|
36
42
|
end
|
37
43
|
|
38
44
|
protected
|
39
|
-
attr_accessor :modules_config
|
40
|
-
|
41
|
-
def
|
42
|
-
|
45
|
+
attr_accessor :modules_config, :module_specifications, :default_module_specs
|
46
|
+
|
47
|
+
def load_config_file
|
48
|
+
@default_module_specs = ""
|
49
|
+
config_file = options[:config_file]
|
50
|
+
config_file.gsub! /^~/, ENV['HOME']
|
51
|
+
if File.exists?(config_file)
|
52
|
+
@default_module_specs = File.open(config_file).read
|
53
|
+
else
|
54
|
+
say "module config file at #{config_file} not found"
|
55
|
+
end
|
43
56
|
end
|
44
57
|
|
45
58
|
def setup_defaults
|
46
|
-
@modules_config ||= {}
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
59
|
+
@modules_config ||= {}
|
60
|
+
puts "default_module_specs: '#{default_module_specs}'"
|
61
|
+
all_modules = []
|
62
|
+
all_modules << default_module_specs if !default_module_specs.empty?
|
63
|
+
all_modules << options[:modules] if options[:modules]
|
64
|
+
puts "all modules: #{all_modules}"
|
65
|
+
@module_specifications = all_modules.join(',') || ""
|
51
66
|
end
|
52
67
|
|
53
68
|
def define_modules
|
54
69
|
@modules_config ||= {}
|
55
|
-
return if
|
56
|
-
module_defs = options[:modules].split(",")
|
70
|
+
return if module_specifications.empty?
|
57
71
|
|
72
|
+
puts "module_specifications: #{module_specifications}"
|
73
|
+
module_defs = module_specifications.split(",")
|
58
74
|
module_defs.each do |module_spec|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
75
|
+
module_spec = module_spec.strip
|
76
|
+
if module_spec && !module_spec.empty?
|
77
|
+
spec = module_spec.strip.split(":")
|
78
|
+
module_name = spec[0]
|
79
|
+
if spec[1]
|
80
|
+
branch, account = spec[1].split("@")
|
81
|
+
else
|
82
|
+
branch, account = spec[0].split("@") if spec[0]
|
83
|
+
branch, account = "", "" if !spec[0]
|
84
|
+
end
|
85
|
+
set_module_config module_name.to_sym, :branch => branch, :account => account
|
86
|
+
end
|
63
87
|
end
|
64
88
|
end
|
65
89
|
|
90
|
+
def default_modules
|
91
|
+
return [] if default_module_specs && !default_module_specs.strip.empty?
|
92
|
+
["netzke-core", "netzke-basepack"]
|
93
|
+
end
|
94
|
+
|
66
95
|
def set_module_config name, module_options = {}
|
67
96
|
mconfig = modules_config[name.to_sym] = {}
|
68
97
|
mconfig[:branch] = module_options[:branch] || options[:branch]
|
@@ -74,12 +103,11 @@ class NetzkeConfig < Thor::Group
|
|
74
103
|
end
|
75
104
|
|
76
105
|
def valid_context?
|
77
|
-
if
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
106
|
+
if !rails3_app?
|
107
|
+
say "Must be run from a rails 3 application root directory", :red
|
108
|
+
return false
|
109
|
+
end
|
110
|
+
true
|
83
111
|
end
|
84
112
|
|
85
113
|
def get_module_names
|
@@ -115,8 +143,9 @@ class NetzkeConfig < Thor::Group
|
|
115
143
|
|
116
144
|
def update_module module_name
|
117
145
|
config = module_config(module_name)
|
118
|
-
|
119
|
-
|
146
|
+
return if !config
|
147
|
+
inside module_name do
|
148
|
+
branch = config[:branch]
|
120
149
|
run "git checkout #{branch}"
|
121
150
|
run "git rebase origin/#{branch}"
|
122
151
|
run "git pull"
|
@@ -126,8 +155,9 @@ class NetzkeConfig < Thor::Group
|
|
126
155
|
def create_module module_name
|
127
156
|
# create dir for module by cloning
|
128
157
|
config = module_config(module_name)
|
158
|
+
return if !config
|
129
159
|
account = config[:account]
|
130
|
-
run "git clone #{
|
160
|
+
run "git clone #{github account}/#{module_name}.git #{module_name}"
|
131
161
|
inside module_name do
|
132
162
|
branch = config[:branch]
|
133
163
|
run "git checkout #{branch}"
|
@@ -188,14 +218,10 @@ class NetzkeConfig < Thor::Group
|
|
188
218
|
File.join(extjs_dir, extjs)
|
189
219
|
end
|
190
220
|
|
191
|
-
def
|
221
|
+
def github account
|
192
222
|
"#{GITHUB}/#{account}"
|
193
223
|
end
|
194
224
|
|
195
|
-
def netzke_app?
|
196
|
-
File.directory? 'lib/netzke'
|
197
|
-
end
|
198
|
-
|
199
225
|
def rails3_app?
|
200
226
|
File.exist? 'Gemfile'
|
201
227
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{netzke_config}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Kristian Mandrup"]
|
12
|
+
s.date = %q{2010-06-22}
|
13
|
+
s.description = %q{Configure Netzke modules as plugins for a Netzke app and link ExtJS library to boot}
|
14
|
+
s.email = %q{kmandrup@gmail.com}
|
15
|
+
s.executables = ["netzke_config", "netzke_config.bat"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE",
|
18
|
+
"README.markdown"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".gitignore",
|
23
|
+
"LICENSE",
|
24
|
+
"README.markdown",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"bin/netzke_config",
|
28
|
+
"bin/netzke_config.bat",
|
29
|
+
"lib/netzke_config.rb",
|
30
|
+
"lib/netzke_config.thor",
|
31
|
+
"netzke_config.gemspec",
|
32
|
+
"spec/netzke_config_spec.rb",
|
33
|
+
"spec/spec.opts",
|
34
|
+
"spec/spec_helper.rb",
|
35
|
+
"wiki/home.textile"
|
36
|
+
]
|
37
|
+
s.homepage = %q{http://github.com/kristianmandrup/netzke_config}
|
38
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = %q{1.3.7}
|
41
|
+
s.summary = %q{Configure a Netzke app for Netzke development and debuging}
|
42
|
+
s.test_files = [
|
43
|
+
"spec/netzke_config_spec.rb",
|
44
|
+
"spec/spec_helper.rb"
|
45
|
+
]
|
46
|
+
|
47
|
+
if s.respond_to? :specification_version then
|
48
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
+
s.specification_version = 3
|
50
|
+
|
51
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
55
|
+
end
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- bin/netzke_config.bat
|
54
54
|
- lib/netzke_config.rb
|
55
55
|
- lib/netzke_config.thor
|
56
|
+
- netzke_config.gemspec
|
56
57
|
- spec/netzke_config_spec.rb
|
57
58
|
- spec/spec.opts
|
58
59
|
- spec/spec_helper.rb
|