netzke_config 0.1.2

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.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Kristian Mandrup
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # NetzkeConfig
2
+
3
+ This task helps configure a Netzke app with Netzke submodules and optionally ExtJS for Netzke development and debugging.
4
+
5
+ ## Install
6
+
7
+ <code>gem install netzke_config</code>
8
+
9
+ ## Usage
10
+
11
+ Must be run frokm the root of a Rails 3 Netzke application.
12
+
13
+ +Display usage instructions+
14
+
15
+ <code>netzke_config --help</code>
16
+
17
+ *Note: Ignore the double netzke_config after usage: (which is currently an "error" in Thor)*
18
+
19
+ ## Usage examples
20
+
21
+ +Use defaults+
22
+
23
+ <code>$ netzke_config</code>
24
+
25
+ Clones *netzke* modules from 'skozlov' github account in <code>~/netzke/modules</code>.
26
+
27
+ +Clone modules from specific github account+
28
+
29
+ <code>$ netzke_config --account kmandrup</code>
30
+
31
+ Clones *netzke* modules from 'kmandrup' github account in <code>~/netzke/modules</code>.
32
+
33
+ +Specify location of netzke modules+
34
+
35
+ <code>$ netzke_config ../my/place</code>
36
+
37
+ Retrieves and places *netzke* modules in <code>../my/place</code>.
38
+
39
+ +Create symbolic link to existing *ExtJs* library and force overwrite of all symbolic links+
40
+
41
+ <code>$ netzke_config --force-links --extjs ~/code/ext-3.2.1/</code>
42
+
43
+ +Force overwrite of local *netzke* modules by newly retrieved remote modules. Also forces overwrite of all symbolic links+
44
+
45
+ <code>$ netzke_config --force-all --extjs ~/code/ext-3.2.1/</code>
46
+
47
+ +Attempt download of *ExtJs* library if it doesn't exist+
48
+
49
+ <code>$ netzke_config --overwrite-all --extjs ~/code/ext-3.2.1/ --download</code>
50
+
51
+
52
+ ## Copyright ##
53
+
54
+ Copyright (c) 2009 Kristian Mandrup
55
+
@@ -0,0 +1,45 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "netzke_config"
8
+ gem.summary = %Q{Configure a Netzke app for Netzke development and debuging}
9
+ gem.description = %Q{Configure Netzke modules as plugins for a Netzke app and link ExtJS library to boot}
10
+ gem.email = "kmandrup@gmail.com"
11
+ gem.homepage = "http://github.com/kristianmandrup/netzke_config"
12
+ gem.authors = ["Kristian Mandrup"]
13
+ gem.add_development_dependency "rspec", ">= 1.2.9"
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
21
+ # require 'spec/rake/spectask'
22
+ # Spec::Rake::SpecTask.new(:spec) do |spec|
23
+ # spec.libs << 'lib' << 'spec'
24
+ # spec.spec_files = FileList['spec/**/*_spec.rb']
25
+ # end
26
+ #
27
+ # Spec::Rake::SpecTask.new(:rcov) do |spec|
28
+ # spec.libs << 'lib' << 'spec'
29
+ # spec.pattern = 'spec/**/*_spec.rb'
30
+ # spec.rcov = true
31
+ # end
32
+ #
33
+ # task :spec => :check_dependencies
34
+ #
35
+ # task :default => :spec
36
+ #
37
+ # require 'rake/rdoctask'
38
+ # Rake::RDocTask.new do |rdoc|
39
+ # version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
+ #
41
+ # rdoc.rdoc_dir = 'rdoc'
42
+ # rdoc.title = "netzke_config #{version}"
43
+ # rdoc.rdoc_files.include('README*')
44
+ # rdoc.rdoc_files.include('lib/**/*.rb')
45
+ # end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.2
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+
4
+ require 'netzke_config'
5
+ NetzkeConfig.start
@@ -0,0 +1 @@
1
+ @"ruby.exe" "%~dpn0" %*
@@ -0,0 +1,157 @@
1
+ require 'active_support/inflector'
2
+ require 'thor'
3
+ require 'thor/group'
4
+
5
+ class NetzkeConfig < Thor::Group
6
+ include Thor::Actions
7
+
8
+ # group used when displaying thor tasks with: thor list or thor -T
9
+ # group :netzke
10
+
11
+ # Define arguments
12
+ argument :location, :type => :string, :default => '~/netzke/modules', :desc => 'location where netzke modules are stored'
13
+ # argument :my_arg_name, :type (:string, :hash, :array, :numeric), :default, :required, :optional, :desc, :banner
14
+
15
+ class_option :extjs, :type => :string, :default => nil, :desc => 'location of ExtJS 3.x.x library'
16
+
17
+ class_option :branch, :type => :string, :default => 'rails3', :desc => 'Branch to use for netzke modules'
18
+ class_option :account, :type => :string, :default => 'skozlov', :desc => 'Github account to get Netzke plugins from'
19
+ class_option :force_all, :type => :boolean, :default => false, :desc => 'Force force of all files, including existing modules and links'
20
+ class_option :force_links, :type => :boolean, :default => true, :desc => 'Force force of symbolic links'
21
+ class_option :ext_version, :type => :string, :default => '3.2.1', :desc => 'ExtJS version to download'
22
+ class_option :download, :type => :boolean, :default => false, :desc => 'Download ExtJS if not found in specified extjs location'
23
+
24
+ GITHUB = 'http://github.com'
25
+
26
+ def main
27
+ exit(-1) if !valid_context?
28
+ configure_modules
29
+ configure_extjs if options[:extjs]
30
+ end
31
+
32
+ protected
33
+
34
+ def valid_context?
35
+ if netzke_app? && rails3_app?
36
+ true
37
+ else
38
+ say "Must be run from a Netzke rails3 application root directory", :red
39
+ false
40
+ end
41
+ end
42
+
43
+ def configure_modules
44
+ create_module_container_dir
45
+ inside "#{location}" do
46
+ ["netzke-core", "netzke-basepack"].each do |module_name|
47
+ get_module module_name
48
+ config_netzke_plugin module_name
49
+ end
50
+ end
51
+ end
52
+
53
+ def create_module_container_dir
54
+ if File.directory?(location)
55
+ run "rm -rf #{location}" if force_all?
56
+ end
57
+ empty_directory "#{location}" if !File.directory?(location)
58
+ end
59
+
60
+
61
+ def get_module module_name
62
+ run "rm -rf #{module_name}" if force_all?
63
+ if File.directory? module_name
64
+ update_module module_name
65
+ else
66
+ create_module module_name
67
+ end
68
+ end
69
+
70
+ def update_module module_name
71
+ inside module_name do
72
+ run "git checkout #{branch}"
73
+ run "git rebase origin/#{branch}"
74
+ run "git pull"
75
+ end
76
+ end
77
+
78
+ def create_module module_name
79
+ # create dir for module by cloning
80
+ run "git clone #{netzke_github}/#{module_name}.git #{module_name}"
81
+ inside module_name do
82
+ run "git checkout #{branch}"
83
+ end
84
+ end
85
+
86
+ def config_netzke_plugin module_name
87
+ inside 'vendor/plugins' do
88
+ module_src = local_module_src(module_name)
89
+ run "rm -f #{module_name}" if force_links?
90
+ run "ln -s #{module_src} #{module_name}"
91
+ end
92
+ end
93
+
94
+ def configure_extjs
95
+ extjs_dir = options[:extjs]
96
+ if !File.directory? extjs_dir
97
+ say "No directory for extjs found at #{extjs_dir}", :red
98
+ extjs_dir = download_extjs if download?
99
+ end
100
+
101
+ return if !File.directory(extjs_dir)
102
+
103
+ inside extjs_dir do
104
+ if !File.exist? 'ext-all.js'
105
+ say "Directory #{extjs_dir} does not appear to contain a valid ExtJS library. File 'ext-all.js' missing.", :red
106
+ return
107
+ end
108
+ end
109
+ inside 'public' do
110
+ run "rm -f extjs" if force_links?
111
+ run "ln -s #{extjs_dir} extjs"
112
+ end
113
+ end
114
+
115
+ private
116
+
117
+ def download?
118
+ options[:download]
119
+ end
120
+
121
+ def force_all?
122
+ options[:force_all]
123
+ end
124
+
125
+ def force_links?
126
+ options[:force_links]
127
+ end
128
+
129
+ def branch
130
+ options[:branch]
131
+ end
132
+
133
+ def download_extjs
134
+ extjs_dir = options[:extjs]
135
+ run "mkdir -p #{extjs_dir}"
136
+ run %Q{ cd #{extjs_dir} && curl -s -o extjs.zip "http://www.extjs.com/deploy/ext-#{ext_version}.zip" && unzip -q extjs.zip && rm extjs.zip }
137
+ File.join(extjs_dir, extjs)
138
+ end
139
+
140
+ def netzke_github
141
+ "#{GITHUB}/#{options[:account]}"
142
+ end
143
+
144
+ def netzke_app?
145
+ File.directory? 'lib/netzke'
146
+ end
147
+
148
+ def rails3_app?
149
+ File.exist? 'Gemfile'
150
+ end
151
+
152
+ def local_module_src module_name
153
+ "#{options[:location]}/#{module_name}"
154
+ end
155
+
156
+ end
157
+
@@ -0,0 +1,106 @@
1
+ require 'thor/group'
2
+
3
+
4
+ class NetzkeConfig < Thor::Group
5
+ include Thor::Actions
6
+
7
+ # group used when displaying thor tasks with: thor list or thor -T
8
+ group :netzke
9
+
10
+ # Define arguments
11
+ argument :location, :type => :string, :default => '~/netzke/modules', :desc => 'location where netzke modules are stored'
12
+ # argument :my_arg_name, :type (:string, :hash, :array, :numeric), :default, :required, :optional, :desc, :banner
13
+
14
+ class_option :extjs, :type => :string, :desc => 'location of extjs', :optional => true
15
+
16
+ NETKE_GITHUB = 'http://github.com/skozlov/'
17
+
18
+ def main
19
+ check_valid_context
20
+ create_module_container_dir
21
+ clone_modules
22
+ checkout_rails3
23
+ pull_changes
24
+ create_symlinks
25
+ config_extjs if options[:extjs]
26
+ end
27
+
28
+ protected
29
+
30
+ def check_valid_context
31
+ if !File.directory? 'lib/netzke' && !File.exist? 'Gemfile'
32
+ say "Must be run from a Netzke rails3 application root directory", :red
33
+ exit -1
34
+ end
35
+ end
36
+
37
+ def create_module_container_dir
38
+ empty_directory "#{location}"
39
+ end
40
+
41
+ def clone_modules
42
+ inside "#{location}" do
43
+ ["netzke-core", "netzke-basepack"].each do |module_name|
44
+ get_module module_name
45
+ config_netzke_plugin module_name
46
+ end
47
+ end
48
+ end
49
+
50
+ def get_module module_name
51
+ if File.directory? module_name
52
+ update_module module_name
53
+ else
54
+ create_module module_name
55
+ end
56
+ end
57
+
58
+ def update_module module_name
59
+ inside module_name do
60
+ run "git checkout rails3"
61
+ run "git rebase origin/rails3"
62
+ run "git pull"
63
+ end
64
+ end
65
+
66
+ def create_module module_name
67
+ empty_directory module_name
68
+ inside module_name do
69
+ run "git clone #{NETKE_GITHUB}/#{module_name}"
70
+ run "git checkout rails3"
71
+ end
72
+ end
73
+
74
+ def config_netzke_plugin module_name
75
+ inside 'vendor/plugins' do
76
+ module_src = local_module_src(module_name)
77
+ run "ln -s #{module_src} #{module_name}"
78
+ end
79
+ end
80
+
81
+ def config_extjs
82
+ extjs_dir = options[:extjs]
83
+ if !File.directory? extjs_dir
84
+ say "No directory for extjs found at #{extjs_dir}", :red
85
+ return
86
+ else
87
+ inside extjs_dir do
88
+ if !File.exist? 'ext-all.js'
89
+ say "Directory #{extjs_dir} does not appear to contain a valid ExtJS library. File 'ext-all.js' missing.", :red
90
+ return
91
+ end
92
+ end
93
+ inside 'public' do
94
+ run "ln -s #{options[:extjs]} extjs"
95
+ end
96
+ end
97
+ end
98
+
99
+ private
100
+
101
+ def local_module_src module_name
102
+ "#{options[:location]}/#{module_name}"
103
+ end
104
+
105
+ end
106
+
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "NetzkeConfig" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'netzke_config'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
@@ -0,0 +1,6 @@
1
+ h1. NetzkeConfig
2
+
3
+ A Thor task to do stuff!
4
+
5
+ h2. Copyright
6
+
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: netzke_config
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 2
9
+ version: 0.1.2
10
+ platform: ruby
11
+ authors:
12
+ - Kristian Mandrup
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-06-22 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 2
31
+ - 9
32
+ version: 1.2.9
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: Configure Netzke modules as plugins for a Netzke app and link ExtJS library to boot
36
+ email: kmandrup@gmail.com
37
+ executables:
38
+ - netzke_config
39
+ - netzke_config.bat
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - LICENSE
44
+ - README.markdown
45
+ files:
46
+ - .document
47
+ - .gitignore
48
+ - LICENSE
49
+ - README.markdown
50
+ - Rakefile
51
+ - VERSION
52
+ - bin/netzke_config
53
+ - bin/netzke_config.bat
54
+ - lib/netzke_config.rb
55
+ - lib/netzke_config.thor
56
+ - spec/netzke_config_spec.rb
57
+ - spec/spec.opts
58
+ - spec/spec_helper.rb
59
+ - wiki/home.textile
60
+ has_rdoc: true
61
+ homepage: http://github.com/kristianmandrup/netzke_config
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options:
66
+ - --charset=UTF-8
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ requirements: []
86
+
87
+ rubyforge_project:
88
+ rubygems_version: 1.3.7
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: Configure a Netzke app for Netzke development and debuging
92
+ test_files:
93
+ - spec/netzke_config_spec.rb
94
+ - spec/spec_helper.rb