nu 0.1.12 → 0.1.13
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/lib/nu.rb +1 -0
 - data/lib/nu/cli.rb +23 -39
 - data/lib/nu/project.rb +30 -0
 - metadata +5 -4
 
    
        data/lib/nu.rb
    CHANGED
    
    
    
        data/lib/nu/cli.rb
    CHANGED
    
    | 
         @@ -4,53 +4,37 @@ require 'yaml' 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            module Nu
         
     | 
| 
       6 
6 
     | 
    
         
             
              class CLI < Thor
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
            	  include Thor::Actions
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
              	def initialize(*)
         
     | 
| 
      
 10 
     | 
    
         
            +
              		super
         
     | 
| 
      
 11 
     | 
    
         
            +
              		
         
     | 
| 
      
 12 
     | 
    
         
            +
              		@proj = Nu::Project.new
         
     | 
| 
      
 13 
     | 
    
         
            +
              	end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                desc "install GEMNAME", "installs a gem in the 'pwd'"
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
            	  method_options :location => :string
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            		ensure_default_config
         
     | 
| 
      
 18 
     | 
    
         
            +
              	def install(*names)
         
     | 
| 
      
 19 
     | 
    
         
            +
            		@proj.ensure_default_config
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
              		loc = @proj.get_location
         
     | 
| 
      
 22 
     | 
    
         
            +
              		cl = options['location']
         
     | 
| 
      
 23 
     | 
    
         
            +
              		loc = cl unless cl.nil?
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
            		 
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
            	
         
     | 
| 
       28 
     | 
    
         
            -
            	desc "lib FOLDER", "where do you want to store the gems"
         
     | 
| 
       29 
     | 
    
         
            -
            	def lib(folder)
         
     | 
| 
       30 
     | 
    
         
            -
            		File.delete @config_file if File.exist? @config_file
         
     | 
| 
       31 
     | 
    
         
            -
            		add_file @config_file
         
     | 
| 
       32 
     | 
    
         
            -
            		content = YAML::dump( { 'lib' => folder })
         
     | 
| 
       33 
     | 
    
         
            -
            		append_file @config_file, content
         
     | 
| 
       34 
     | 
    
         
            -
            	end
         
     | 
| 
       35 
     | 
    
         
            -
            	
         
     | 
| 
       36 
     | 
    
         
            -
            	def self.source_root
         
     | 
| 
       37 
     | 
    
         
            -
            		File.dirname(__FILE__)
         
     | 
| 
       38 
     | 
    
         
            -
            	end
         
     | 
| 
       39 
     | 
    
         
            -
            	
         
     | 
| 
       40 
     | 
    
         
            -
            private
         
     | 
| 
       41 
     | 
    
         
            -
            	def ensure_default_config
         
     | 
| 
       42 
     | 
    
         
            -
            		if File.exist? @config_file
         
     | 
| 
       43 
     | 
    
         
            -
            			return
         
     | 
| 
      
 25 
     | 
    
         
            +
            		names.each do |n|
         
     | 
| 
      
 26 
     | 
    
         
            +
            			Nu::Loader.load n, loc
         
     | 
| 
       44 
27 
     | 
    
         
             
            		end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
            	
         
     | 
| 
      
 30 
     | 
    
         
            +
              	desc "lib FOLDER", "where do you want to store the gems"
         
     | 
| 
      
 31 
     | 
    
         
            +
              	def lib(folder)
         
     | 
| 
      
 32 
     | 
    
         
            +
              		@proj.set_location folder
         
     | 
| 
      
 33 
     | 
    
         
            +
              	end
         
     | 
| 
       49 
34 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
            	end
         
     | 
| 
      
 35 
     | 
    
         
            +
              	def self.source_root
         
     | 
| 
      
 36 
     | 
    
         
            +
              		File.dirname(__FILE__)
         
     | 
| 
      
 37 
     | 
    
         
            +
              	end
         
     | 
| 
       54 
38 
     | 
    
         | 
| 
       55 
39 
     | 
    
         
             
              end
         
     | 
| 
       56 
40 
     | 
    
         
             
            end
         
     | 
    
        data/lib/nu/project.rb
    ADDED
    
    | 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Nu
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Project
         
     | 
| 
      
 3 
     | 
    
         
            +
              
         
     | 
| 
      
 4 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 5 
     | 
    
         
            +
                  @config_file = ".nu/options.yaml"
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def ensure_default_config
         
     | 
| 
      
 9 
     | 
    
         
            +
                  if File.exist? @config_file
         
     | 
| 
      
 10 
     | 
    
         
            +
              			return
         
     | 
| 
      
 11 
     | 
    
         
            +
              		end
         
     | 
| 
      
 12 
     | 
    
         
            +
              		add_file @config_file
         
     | 
| 
      
 13 
     | 
    
         
            +
              		content = YAML::dump( {'lib'=>'lib'} )
         
     | 
| 
      
 14 
     | 
    
         
            +
              		append_file @config_file, content 
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
      
 17 
     | 
    
         
            +
                def get_location
         
     | 
| 
      
 18 
     | 
    
         
            +
              		content = YAML.load_file @config_file
         
     | 
| 
      
 19 
     | 
    
         
            +
              		content['lib']
         
     | 
| 
      
 20 
     | 
    
         
            +
              	end
         
     | 
| 
      
 21 
     | 
    
         
            +
            	
         
     | 
| 
      
 22 
     | 
    
         
            +
              	def set_location(name)
         
     | 
| 
      
 23 
     | 
    
         
            +
              	  File.delete @config_file if File.exist? @config_file
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              		content = YAML::dump( { 'lib' => name })
         
     | 
| 
      
 26 
     | 
    
         
            +
            		
         
     | 
| 
      
 27 
     | 
    
         
            +
              		File.open(@config_file, 'w') {|f| f.write(content) }
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: nu
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 1
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 1
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 13
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.1.13
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Dru Sellers
         
     | 
| 
         @@ -17,7 +17,7 @@ autorequire: 
     | 
|
| 
       17 
17 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       18 
18 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
            date: 2010-07- 
     | 
| 
      
 20 
     | 
    
         
            +
            date: 2010-07-18 00:00:00 -05:00
         
     | 
| 
       21 
21 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       22 
22 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       23 
23 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -50,6 +50,7 @@ files: 
     | 
|
| 
       50 
50 
     | 
    
         
             
            - lib/nu/cli.rb
         
     | 
| 
       51 
51 
     | 
    
         
             
            - lib/nu/config.rb
         
     | 
| 
       52 
52 
     | 
    
         
             
            - lib/nu/loader.rb
         
     | 
| 
      
 53 
     | 
    
         
            +
            - lib/nu/project.rb
         
     | 
| 
       53 
54 
     | 
    
         
             
            - lib/nu.rb
         
     | 
| 
       54 
55 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
       55 
56 
     | 
    
         
             
            homepage: http://groups.google.com/group/nu-net
         
     |