lazyportal 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,21 +1,40 @@
1
- To Get Started
2
- ==============
1
+ Getting Started
2
+ ===============
3
3
 
4
- In your project directory, run:
4
+ Install lazyportal like any other Ruby gem:
5
+
6
+ $ gem install lazyportal
7
+
8
+ In your project directory, type:
5
9
 
6
10
  $ lazy
7
11
 
8
- + Creates and prepopulates a hidden .lazy.yaml config file (allowing for overrides)
9
- + Creates a Rakefile (loads rake tasks from lazy's source)
12
+ This will cause lazyportal to generate a Rakefile in that same directory (or append an existing Rakefile if you already have one). This new Rakefile loads a suite of nifty rake tasks that can be used immediately in your uPortal skinning & theming endeavors (and Liferay, too).
10
13
 
11
14
  Tasks
12
15
  =====
13
16
 
17
+ To start and stop tomcat, for example, type:
18
+
19
+ $ rake start
20
+
21
+ And:
22
+
23
+ $ rake stop
24
+
25
+ To list all available tasks along with brief descriptions (rake equivalent to ant -p):
26
+
14
27
  $ rake -T
28
+ <!--
29
+ To go into more detail about a given task:
15
30
 
16
- Lists all available tasks along with brief descriptions.
31
+ $ rake [task]:help -->
17
32
 
18
- $ rake [task]:help
33
+ If you need to run a uPortal ant task, make sure to be really lazy when you do it:
19
34
 
20
- Prints a detailed description about a given task.
35
+ $ rake initportal
36
+
37
+ <!-- Advanced
38
+ ========
21
39
 
40
+ lazyportal searches your project and stores metadata about your project such as path and filenames, root directories and even what database you're using). This makes it easy to write your own custom rake tasks. -->
@@ -0,0 +1,9 @@
1
+
2
+ # require 'rubygems'
3
+ # require 'lazyportal'
4
+ require './lib/lazyportal'
5
+
6
+ include Lazyportal::Tasks
7
+
8
+ Lazyportal::Tasks.load_tasks
9
+
data/TODO.txt CHANGED
@@ -1,3 +1,17 @@
1
+ CURRENTLY
2
+ Writing test suites using Test::Unit
3
+ http://www.ensta-paristech.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html
4
+
5
+ CLI CLASS
6
+ -write some project generators
7
+
8
+ $ lazy uportal
9
+ $ lazy liferay
10
+
11
+ Checks out uportal, tomcat, etc.
12
+ Downloads Liferay, deploys the key, downloads bundle
13
+
14
+
1
15
  - make into a gem
2
16
  - write tab completion script for thor command
3
17
 
@@ -1,6 +1,6 @@
1
1
  module Lazyportal
2
2
 
3
- VERSION = '0.0.9'
3
+ VERSION = '0.1.0'
4
4
 
5
5
  end
6
6
 
@@ -11,9 +11,13 @@ require 'rake'
11
11
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
12
12
 
13
13
  require 'lazyportal/helpers'
14
+ require 'lazyportal/tomcat'
14
15
  require 'lazyportal/tasks'
15
16
  require 'lazyportal/cli'
16
17
 
17
18
  include Lazyportal::Helpers
19
+ include Lazyportal::Tomcat
20
+ # include Lazyportal::Liferay
21
+ # include Layzportal::Uportal
18
22
  include Lazyportal::Tasks
19
23
  include Lazyportal::CLI
@@ -1,48 +1,37 @@
1
- module Lazyportal
2
- module CLI
1
+ module Lazyportal::CLI
3
2
 
4
- def generate_rakefile
5
-
6
- # Rakefile contents includes the Tasks
7
- # module and loads lazy's tasks
8
- tasks = %{
3
+ def generate_rakefile
4
+
5
+ # Rakefile contents includes the Tasks
6
+ # module and loads tasks
7
+ tasks = %{
9
8
  require 'rubygems'
10
9
  require 'lazyportal'
11
10
 
12
11
  include Lazyportal::Tasks
13
-
12
+
14
13
  Lazyportal::Tasks.load_tasks
15
- }
14
+ }
16
15
 
17
- # Use existing Rakefile if one exists
18
- rakefile = existing_rakefile.nil? ? "Rakefile" : existing_rakefile
16
+ # Check for existing Rakefile
17
+ existing_rakefile = Dir["*"].select do |f|
18
+ f.match /rakefile/i
19
+ end.first
19
20
 
20
- # Print message to tell the user
21
- # what happened (need to print the message
22
- # first because otherwise it sees the newly
23
- # created Rakefile)
24
- print_message
25
-
26
- # Append contents to existing Rakefile
27
- # or generate a new Rakefile
28
- create_file rakefile, tasks, :noclobber => true
29
- end
30
-
31
- private
32
-
33
- def print_message
34
- if existing_rakefile.nil?
35
- puts "lazy generated a new Rakefile"
36
- puts "type rake -T to see available tasks"
37
- else
38
- puts "lazy tasks were appended to existing Rakefile"
39
- end
40
- end
41
-
42
- def existing_rakefile
43
- pwd = `echo $PWD`.chomp
44
- Dir[pwd + "/*"].select { |f| f.match /rakefile/i }[0]
21
+ # Use existing Rakefile if one exists
22
+ rakefile = existing_rakefile.nil? ? "Rakefile" : existing_rakefile
23
+
24
+ # Append contents to existing Rakefile
25
+ # or generate a new Rakefile
26
+ create_file rakefile, tasks, :noclobber => true
27
+
28
+ # Print message to tell the user what happened
29
+ if existing_rakefile.nil?
30
+ puts "lazy generated a new Rakefile"
31
+ puts "type rake -T to see available tasks"
32
+ else
33
+ puts "lazy tasks were appended to existing Rakefile"
45
34
  end
46
-
47
35
  end
36
+
48
37
  end
@@ -1,15 +1,13 @@
1
- module Lazyportal
2
- module Helpers
1
+ module Lazyportal::Helpers
3
2
 
4
- def create_file file, contents, modes={}
5
- mode = case modes
6
- when :noclobber then "a+"
7
- when :read_only then "r"
8
- else "w+"
9
- end
10
-
11
- File.open(file, mode) { |f| f.write(contents) }
3
+ def create_file file, contents, modes={}
4
+ mode = case
5
+ when modes[:noclobber] then "a+"
6
+ when modes[:read_only] then "r"
7
+ else "w+"
12
8
  end
13
-
9
+
10
+ File.open(file, mode) { |f| f.write(contents) }
14
11
  end
12
+
15
13
  end
@@ -1,9 +1,7 @@
1
- module Lazyportal
2
- module Tasks
1
+ module Lazyportal::Tasks
3
2
 
4
- def load_tasks
5
- Dir[File.dirname(__FILE__) + "/tasks/**/*.rake"].each { |f| load f }
6
- end
7
-
3
+ def load_tasks
4
+ Dir[File.dirname(__FILE__) + "/tasks/**/*.rake"].each { |f| load f }
8
5
  end
6
+
9
7
  end
@@ -1,12 +1,12 @@
1
1
  task :lazy do
2
- puts ""
3
- puts ' _ ____ ____ _ _ _____ ____ ____ '
4
- puts ' / \ / _ \/_ \/ \/ \ /|/ __// ___\/ ___\ '
5
- puts ' | | | / \| / /| || |\ ||| \ | \| \ '
6
- puts ' | |_/\| |-||/ /_| || | \||| /_ \___ |\___ | '
7
- puts ' \____/\_/ \|\____/\_/\_/ \|\____/\____/\____/ '
8
- puts ""
9
- puts ' "The quality that makes you go to great effort '
10
- puts ' to reduce overall energy expenditure."'
11
- puts ""
2
+ puts ' '
3
+ puts ' _ ____ ____ _ _ _____ ____ ____ '
4
+ puts ' / \ / _ \/_ \/ \/ \ /|/ __// ___\/ ___\ '
5
+ puts ' | | | / \| / /| || |\ ||| \ | \| \ '
6
+ puts ' | |_/\| |-||/ /_| || | \||| /_ \___ |\___ | '
7
+ puts ' \____/\_/ \|\____/\_/\_/ \|\____/\____/\____/ '
8
+ puts ' '
9
+ puts ' "The quality that makes you go to great effort '
10
+ puts ' to reduce overall energy expenditure." '
11
+ puts ' '
12
12
  end
@@ -0,0 +1,22 @@
1
+ tomcat = Lazyportal::Tomcat
2
+
3
+ unless tomcat.exists?
4
+ puts "lazy doesn't see a tomcat."
5
+ puts "Run rake fetch:tomcat to get one."
6
+ exit
7
+ end
8
+
9
+ desc "Starts tomcat."
10
+ task :start do
11
+ tomcat.run "startup.sh"
12
+ end
13
+
14
+ desc "Stops tomcat."
15
+ task :stop do
16
+ tomcat.run "shutdown.sh"
17
+ end
18
+
19
+ desc "Tail catalina.out"
20
+ task :logs do
21
+ tomcat.tail "catalina.out"
22
+ end
@@ -0,0 +1,21 @@
1
+ module Lazyportal::Tomcat
2
+
3
+ # You must have "tomcat" in your tomcat root folder name
4
+ # in order for lazyportal to see it
5
+ def tomcat_root
6
+ Dir["**/*"].select { |f| f.match /tomcat/i }.first
7
+ end
8
+
9
+ def exists?
10
+ tomcat_root.nil?
11
+ end
12
+
13
+ def run script
14
+ system "./#{tomcat_root}/bin/#{script}"
15
+ end
16
+
17
+ def tail log_file
18
+ system "tail -f #{tomcat_root}/logs/#{log_file}"
19
+ end
20
+
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazyportal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-04-23 00:00:00.000000000Z
12
+ date: 2011-04-25 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: jacob.d.lichner@gmail.com
@@ -19,12 +19,15 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - LICENSE.txt
22
+ - Rakefile
22
23
  - README.md
23
24
  - TODO.txt
24
25
  - lib/lazyportal/cli.rb
25
26
  - lib/lazyportal/helpers.rb
26
27
  - lib/lazyportal/tasks/lazy.rake
28
+ - lib/lazyportal/tasks/tomcat.rake
27
29
  - lib/lazyportal/tasks.rb
30
+ - lib/lazyportal/tomcat.rb
28
31
  - lib/lazyportal.rb
29
32
  - lazyportal.gemspec
30
33
  - bin/lazy