drcapulet-russell 0.1.0 → 0.1.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.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,13 @@
1
+ == 0.1.1
2
+
3
+ * Refactored the -v flag command: Now reads from VERSION.yml which is automatically updated every release
4
+ * Added jQuery to the frameworks
5
+ * Now config installer checks the version against the current one to update for new release changes
6
+
7
+ == 0.1.0 / 09 March 2009
8
+
9
+ * Gem Build
10
+
1
11
  == 0.0.1 / 08 March 2009
2
12
 
3
13
  * Setting up the entire thing
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
- :patch: 0
4
3
  :minor: 1
4
+ :patch: 1
@@ -1,3 +1,4 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'version'))
1
2
  require "yaml"
2
3
 
3
4
  module Russell
@@ -11,8 +12,9 @@ module Russell
11
12
  def perform
12
13
  begin
13
14
  @config = YAML::load(File.open("#{Russell.base_directory}/russell.config"))
15
+ check_config_version(@config)
14
16
  read_and_install_with_config(@config)
15
- rescue
17
+ rescue => error
16
18
  q = ask("No config file exists. Create one?", "Not creating one. Exiting")
17
19
  if (q == 1)
18
20
  create_config
@@ -34,6 +36,22 @@ module Russell
34
36
  end
35
37
  end
36
38
 
39
+ def check_config_version(config)
40
+ @version = Russell::Version.read_version
41
+ if config['version'] != @version[:q]
42
+ q = ask("Config file is outdated. Would you like to create a new one?", "")
43
+ if (q == 1)
44
+ create_config
45
+ exit
46
+ else
47
+ exit
48
+ end
49
+ else
50
+ return true
51
+ end
52
+
53
+ end
54
+
37
55
  def create_config
38
56
  config = {}
39
57
  @frameworks = YAML::load(File.open("#{Russell.base_directory}/frameworks/manifest.yml"))
@@ -45,6 +63,10 @@ module Russell
45
63
  config["#{fwname}"] = false
46
64
  end
47
65
  end
66
+
67
+ @version = Russell::Version.read_version
68
+ config["version"] = @version[:q]
69
+
48
70
  write_config(config)
49
71
  end
50
72
 
@@ -63,7 +85,7 @@ module Russell
63
85
  def read_and_install_with_config(config)
64
86
  command = :install_one
65
87
  config.each do |fw, value|
66
- if value
88
+ if value && (fw != "version")
67
89
  self.options[:noask] = true
68
90
  self.options[:framework] = fw
69
91
  do_command(command, options)
@@ -29,6 +29,8 @@ module Russell
29
29
  q = ask(@css["prefix"], framework.capitalize.chomp, @css["type"], @css["response"])
30
30
  else
31
31
  q = 1
32
+ puts "Installing the #{framework} framework"
33
+ puts "======================================"
32
34
  end
33
35
 
34
36
  if (q == 1)
@@ -64,13 +66,12 @@ module Russell
64
66
  def show_src_code(config)
65
67
  if config['src']
66
68
  puts ""
67
- puts "----------------------------"
68
69
  puts "To include in your project, add the following to the head section of your file:"
69
- puts ""
70
70
  config['src'].each do |line|
71
71
  puts " #{line}"
72
72
  end
73
73
  puts ""
74
+ puts ""
74
75
  end
75
76
  end
76
77
 
@@ -1,3 +1,5 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'version'))
2
+
1
3
  module Russell
2
4
  module Commands
3
5
  class PrintVersion
@@ -11,8 +13,10 @@ module Russell
11
13
  # The quiet option may make scripting easier
12
14
  # puts ::Russell.version[:string]
13
15
  # else
16
+ @version = Russell::Version.read_version
17
+
14
18
  lines = []
15
- lines << "Russell #{::Russell.version[:string]}"
19
+ lines << "Russell #{@version[:string]}"
16
20
  lines << "Copyright (c) 2009 Alex Coomans"
17
21
  lines << "Released under the MIT License."
18
22
  puts lines.join("\n")
data/lib/russell/exec.rb CHANGED
@@ -79,6 +79,7 @@ END
79
79
  end
80
80
 
81
81
  opts.on_tail("-v", "--version", "Print version") do
82
+
82
83
  self.options[:command] = :print_version
83
84
  end
84
85
  end
@@ -1,4 +1,3 @@
1
-
2
1
  module Russell
3
2
  module Version
4
3
  # Returns a hash representing the version.
@@ -9,51 +8,30 @@ module Russell
9
8
  #
10
9
  # This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum
11
10
  # I (alex) then swiped it from Compass - so thanks there!
12
- attr_writer :version
13
- def version
14
- return @version if defined?(@version)
15
-
16
- read_version_file
17
- parse_version
18
-
19
- if r = revision
11
+ attr_reader :major, :minor, :patch
12
+
13
+ def scope(file) # :nodoc:
14
+ File.join(File.dirname(__FILE__), '..', '..', file)
15
+ end
16
+
17
+ def read_version
18
+ yaml = YAML::load(File.open("#{Russell.base_directory}/VERSION.yml"))
19
+ @major = (yaml['major'] || yaml[:major]).to_i
20
+ @minor = (yaml['minor'] || yaml[:minor]).to_i
21
+ @patch = (yaml['patch'] || yaml[:patch]).to_i
22
+
23
+ @version = {:string => "#{@major}.#{@minor}.#{@patch}"}
24
+ @version[:q] = "#{@major}.#{@minor}.#{@patch}"
25
+
26
+ if r = revision_from_git
20
27
  @version[:rev] = r
21
28
  @version[:string] << " [#{r[0...7]}]"
22
29
  end
23
-
24
30
  @version
25
31
  end
26
-
32
+
27
33
  protected
28
-
29
- def scope(file) # :nodoc:
30
- File.join(File.dirname(__FILE__), '..', '..', file)
31
- end
32
-
33
- def read_version_file
34
- @version = {
35
- :string => File.read(scope('VERSION')).strip
36
- }
37
- end
38
-
39
- def parse_version
40
- dotted_string, @version[:label] = @version[:string].split(/-/, 2)
41
- numbers = dotted_string.split('.').map { |n| n.to_i }
42
- [:major, :minor, :teeny].zip(numbers).each do |attr, value|
43
- @version[attr] = value
44
- end
45
- end
46
-
47
- def revision
48
- revision_from_git || revision_from_file
49
- end
50
-
51
- def revision_from_file
52
- if File.exists?(scope('REVISION'))
53
- rev = File.read(scope('REVISION')).strip
54
- rev = nil if rev !~ /[a-f0-9]+/
55
- end
56
- end
34
+
57
35
 
58
36
  def revision_from_git
59
37
  if File.exists?(scope('.git/HEAD'))
@@ -64,5 +42,7 @@ module Russell
64
42
  end
65
43
  end
66
44
 
45
+ module_function :read_version, :revision_from_git, :scope
46
+
67
47
  end
68
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drcapulet-russell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Coomans
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-08 00:00:00 -08:00
12
+ date: 2009-03-12 00:00:00 -07:00
13
13
  default_executable: russell
14
14
  dependencies: []
15
15