Remove restriction on the project's package name
There are restrictions regarding how modules are called, but given that packages are tight to repositories anyway; there's no way someone can publish and use an aiken package on 'aiken-lang' without being part of the organization. So the restriction on the command-line is pointless. Plus, it prevents us from using 'aiken-lang' as a placeholder name for tutorials.
This commit is contained in:
		
							parent
							
								
									219e81cb75
								
							
						
					
					
						commit
						d2c03b0094
					
				| 
						 | 
					@ -13,17 +13,6 @@ pub struct PackageName {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl PackageName {
 | 
					impl PackageName {
 | 
				
			||||||
    pub fn restrict(&self) -> Result<(), Error> {
 | 
					 | 
				
			||||||
        if self.owner.starts_with("aiken") {
 | 
					 | 
				
			||||||
            return Err(Error::InvalidProjectName {
 | 
					 | 
				
			||||||
                reason: InvalidProjectNameReason::Reserved,
 | 
					 | 
				
			||||||
                name: self.to_string(),
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Ok(())
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    fn validate(&self) -> Result<(), Error> {
 | 
					    fn validate(&self) -> Result<(), Error> {
 | 
				
			||||||
        let r = regex::Regex::new("^[a-z0-9_-]+$").expect("regex could not be compiled");
 | 
					        let r = regex::Regex::new("^[a-z0-9_-]+$").expect("regex could not be compiled");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,8 +29,6 @@ pub fn exec(args: Args) -> miette::Result<()> {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn create_project(args: Args, package_name: &PackageName) -> miette::Result<()> {
 | 
					fn create_project(args: Args, package_name: &PackageName) -> miette::Result<()> {
 | 
				
			||||||
    package_name.restrict().into_diagnostic()?;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    let root = PathBuf::from(&package_name.repo);
 | 
					    let root = PathBuf::from(&package_name.repo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if root.exists() {
 | 
					    if root.exists() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue